Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[LibOS] Add Page Cache feature for trusted files #2011

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

sahason
Copy link
Contributor

@sahason sahason commented Sep 27, 2024

check issue #1712 for details.

This PR introduces a manifest option sgx.trusted_files_cache_size which specifies the cache size allocated for trusted files. A trusted file is cached if the file is opened more than 10 times. Cache eviction policy is Least Recently Used aka LRU. This optimization is used when there are frequently-reused files.

Below are the results with and without this PR for nginx run:

Marit Threads Native SGX (without page cache) SGX (with page cache) Degradation without page cache Degradation with page cache
Requests/sec 64 965844 386647 759754 60% 21%

Fixes #1712

How to test this PR?

Change worker_processes value to auto in CI-Examples/nginx/nginx-gramine.conf.template
Add open_file_cache max=1024 inactive=10s; under http { block in CI-Examples/nginx/nginx-gramine.conf.template

cd gramine/CI-Examples/nginx
make clean && make SGX=1

Native run:

./install/sbin/nginx -c conf/nginx-gramine.conf
wrk -t64 -c300 -d30s http://127.0.0.1:8002/random/10K.1.html

SGX run:

gramine-sgx nginx
wrk -t64 -c300 -d30s http://127.0.0.1:8002/random/10K.1.html

Initial 1-3 run with gramine-sgx might give low performance results as trusted file chunks are added to the page cache for the first time. After 1-3 iterations results become consistent.


This change is Reviewable

The Page Cache feature for trusted files has been implemented using a Least
Recently Used (LRU) eviction policy. Files that are accessed more than 10
times will be cached to enhance performance. Additionally, a new manifest
option `sgx.trusted_files_cache_size` has been introduced to specify the
size of the cache allocated for trusted files.

Signed-off-by: Sonali Saha <sonali.saha@intel.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Nginx performance degradation in Gramine-SGX attributed to SHA256 hashing
1 participant