microsoft / scitt-ccf-ledger

Supply Chain Integrity Transparency and Trust ledger application using Confidential Consortium Framework (CCF)
MIT License
35 stars 16 forks source link

Improve historical query cache #83

Open letmaik opened 1 year ago

letmaik commented 1 year ago

We currently use a simple LRU cache in the historical query adapter to keep track of when to drop cached transactions to avoid going out of memory. This is based on the transaction count and is hard-coded to 100. Given that transactions have different sizes it would be more economical to use the transaction size to determine the cache size and then set a limit like 100 MiB, based on the available enclave memory set in oe_sign.conf. With small claim sizes this would effectively raise the cache limit by one or more magnitudes of transactions.

achamayou commented 1 year ago

Related to https://github.com/microsoft/CCF/issues/3234

ivarprudnikov commented 8 months ago

Current oe_sign.conf file https://github.com/microsoft/scitt-ccf-ledger/blob/main/app/oe_sign.conf CCF doc on memory setting in the file https://microsoft.github.io/CCF/main/operations/resource_usage.html#memory Openenclave docs on the use of the configuration in this file https://github.com/openenclave/openenclave/blob/master/docs/GettingStartedDocs/buildandsign.md#signing-an-sgx-enclave

achamayou commented 1 month ago

A set_soft_cache_limit() API was added to CCF in https://github.com/microsoft/CCF/pull/6282, to allow applications to easily set a limit.