intel / linux-sgx

Intel SGX for Linux*
https://www.intel.com/content/www/us/en/developer/tools/software-guard-extensions/linux-overview.html
Other
1.33k stars 544 forks source link

Question about running multiple enclaves in sgx #878

Open niusenc opened 2 years ago

niusenc commented 2 years ago

Hi,

I developed a sgx application in an Ubuntu 18.04 machine (8 CPUs, 8G memory), but the application is very time-consuming. To improve the performance, I run multiple encalves simultaneously. I have the following questions:

  1. Since my machine has 8 CPUs, suppose I run 3 enclaves simultaneously, will those 3 enclaves run in parallel in 3 different CPUs?
  2. I compare the performance while running multiple enclaves. I found that, running 2 enclaves simultaneously takes shortest time, running only 1 enclave takes second shortest time, running 3 enclaves simultaneously takes longest time. I am a little confused about the results. If enclaves can run simultaneously, why not 3 enclaves takes shortest time?

Thanks in advance.

guzongmin commented 2 years ago

Enclave would not be exclusive to one CPU. Only when using the enclave with ecall the enclave code run with the exact CPU core which invokes the ecall. So it does not depend on how many enclaves you use, but the ecall's number.