Open chaudhryfaisal opened 9 months ago
@jinghe-INTC any update on this?
There is problem in building the project:
...
error[E0635]: unknown feature `core_panic`
--> /home/jinghe/.cargo/git/checkouts/teaclave-sgx-sdk-be25c2ad2f03718d/1b1d033/sgx_tstd/src/lib.rs:140:12
|
140 | #![feature(core_panic)]
| ^^^^^^^^^^
error[E0635]: unknown feature `int_error_internals`
--> /home/jinghe/.cargo/git/checkouts/teaclave-sgx-sdk-be25c2ad2f03718d/1b1d033/sgx_tstd/src/lib.rs:102:12
|
102 | #![feature(int_error_internals)]
| ^^^^^^^^^^^^^^^^^^^
Some errors have detailed explanations: E0425, E0432, E0557, E0635.
For more information about an error, try `rustc --explain E0425`.
and the rustc version is:
$ rustc --version
rustc 1.79.0-nightly (aa1c45908 2024-04-06)
Probably it needs an earlier build of Rust.
I am still investigating your code, but I'm wondering if your measurement excluded the overhead of the ECALLs for openssl_no_enclave? If so, that could account for the significant difference in performance between running the code inside and outside the enclave.
There is problem in building the project:
... error[E0635]: unknown feature `core_panic` --> /home/jinghe/.cargo/git/checkouts/teaclave-sgx-sdk-be25c2ad2f03718d/1b1d033/sgx_tstd/src/lib.rs:140:12 | 140 | #![feature(core_panic)] | ^^^^^^^^^^ error[E0635]: unknown feature `int_error_internals` --> /home/jinghe/.cargo/git/checkouts/teaclave-sgx-sdk-be25c2ad2f03718d/1b1d033/sgx_tstd/src/lib.rs:102:12 | 102 | #![feature(int_error_internals)] | ^^^^^^^^^^^^^^^^^^^ Some errors have detailed explanations: E0425, E0432, E0557, E0635. For more information about an error, try `rustc --explain E0425`.
and the rustc version is:
$ rustc --version rustc 1.79.0-nightly (aa1c45908 2024-04-06)
Probably it needs an earlier build of Rust.
since code base is based on https://github.com/apache/incubator-teaclave-sgx-sdk it requires nightly-2022-10-22. I have updated repo to include correct rust-toolchain
please try again with latest pull or with correct tool chain
I am still investigating your code, but I'm wondering if your measurement excluded the overhead of the ECALLs for openssl_no_enclave? If so, that could account for the significant difference in performance between running the code inside and outside the enclave.
yes for openssl_no_enclave measurement ECALL is excluded, how ever ECALL overhead is not much as I have done other tests with putting ring library inside enclave and overhead was only ~3-5 micro seconds. I believe large difference is due to crypto operations done in software vs hardware, So some CPU flags / operations are not configured correctly for openssl to leverage CPU instructions to perform crypto operations.
I have built the updated code successfully, and run it on a VM from a Ice-Lake@2300Mhz host. There was performance degradation in enclave, but much less than that you reported.
I also tried it on different hardware platforms, and the difference were all below 50%.
Can you tell me the latest result you got, and the OS/Kernel/SDK version?
I am still investigating your code, but I'm wondering if your measurement excluded the overhead of the ECALLs for openssl_no_enclave? If so, that could account for the significant difference in performance between running the code inside and outside the enclave.
yes for openssl_no_enclave measurement ECALL is excluded, how ever ECALL overhead is not much as I have done other tests with putting ring library inside enclave and overhead was only ~3-5 micro seconds. I believe large difference is due to crypto operations done in software vs hardware, So some CPU flags / operations are not configured correctly for openssl to leverage CPU instructions to perform crypto operations.
So the result of openssl_enclave
included the ECALL overhead. I tried measuring an empty ECALL, and the overhead was ~4.0 micro seconds, almost the same as what you got. That means the performance difference is about 26.3% according to the measurement above.
OK so I did a lot of testing on my side and I am not able to get 5K TPS consistently. I am able to replicate it sometime when I rebuild / install sgx-ssl SDK or try to switch between rev1 and rev2. When I try on completely new setup I am getting numbers closer to your test ( ~30% diff in HW mode and ~12% diff in SIM mode ). I also added empty function and ring to the mix to compare numbers and here are my results
# Simulation
stage iters secs msecs iters/s diff.s
empty_function_enclave 1_000 0.001 1.192 838_850
empty_function_no_enclave 1_000 0.000 0.001 871_080_139
openssl_enclave 1_000 0.027 27.005 37_029 -11.79 %
openssl_no_enclave 1_000 0.024 23.822 41_978
ring_enclave 1_000 0.022 21.975 45_506 +8.40 %
ring_no_enclave 1_000 0.023 23.224 43_059
lb_empty_enclave latency (μs) avg: 1, min: 1, max: 2
lb_empty_no_enclave latency (μs) avg: 0, min: 0, max: 0
lb_openssl_enclave latency (μs) avg: 26, min: 25, max: 66
lb_openssl_no_enclave latency (μs) avg: 22, min: 22, max: 26
lb_ring_enclave latency (μs) avg: 22, min: 21, max: 27
lb_ring_no_enclave latency (μs) avg: 23, min: 22, max: 28
# Hardware
stage iters secs msecs iters/s diff.s
empty_function_enclave 1_000 0.004 4.176 239_449
empty_function_no_enclave 1_000 0.000 0.001 928_505_106
openssl_enclave 1_000 0.033 32.663 30_616 -30.38 %
openssl_no_enclave 1_000 0.023 22.741 43_973
ring_enclave 1_000 0.026 26.497 37_739 -14.18 %
ring_no_enclave 1_000 0.023 23.227 43_053
lb_empty_enclave latency (μs) avg: 4, min: 4, max: 8
lb_empty_no_enclave latency (μs) avg: 0, min: 0, max: 0
lb_openssl_enclave latency (μs) avg: 32, min: 31, max: 40
lb_openssl_no_enclave latency (μs) avg: 22, min: 22, max: 27
lb_ring_enclave latency (μs) avg: 26, min: 26, max: 31
lb_ring_no_enclave latency (μs) avg: 23, min: 22, max: 26
@jinghe-INTC how can we analyze performance loss between ring and openssl inside the enclave?
Both Ring library and SGX SSL had modifications for the SGX, but that on SGX SSL was a little more. So a slight more performance loss is reasonable.
Overview: When computing ECC signatures inside and outside the Intel SGX enclave using the OpenSSL library, we observed a significant performance difference. Inside the enclave, the performance is about 5,000 operations, while outside the enclave, it is 43,000 operations. However, when using the Ring library, the performance is similar inside and outside the enclave.
Additional Information:
Steps to Reproduce:
POC Code