gramine-sgx time deployment

Skip to first unread message

Augusto César Pereira Henriques

Sep 10, 2022, 10:51:28 AM9/10/22

When I executed my program in gramine-sgx mode and it took a while to conclude the process (about 3 minutes). The thing is, when I executed it for the second time, it took a few seconds to complete the process (but it took longer compared to gramine-direct mode). So my question, is it normal for this to happen? Is there any architecture diagram that can explain the gramine-sgx deployment workflow?


Vij, Mona

Sep 10, 2022, 6:19:46 PM9/10/22
to Augusto César Pereira Henriques,

Its not normal unless you have other enclaves running on the platform and there was not enough EPC (Enclave page Cache) for your enclave.


So it can take long if you are oversubscribing EPC and Linux driver ends up paging the EPC. Otherwise if you have enough EPC on your platform, it should more or less take same amount of time to build the enclave. Execution time depends on what your program does.


How much EPC do you have on your system and how big an enclave were you trying to create? What does your program do?




You received this message because you are subscribed to the Google Groups "Gramine Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to
To view this discussion on the web visit

Augusto Henriques

Oct 16, 2022, 10:38:20 AM10/16/22
to Gramine Users

Thanks and I'm sorry for the late reply.

EPC size: 0xbc00000

About  "how big an enclave were you trying to create?", what do you mean? Are you asking for sgx.enclave_size from my template manifest, the one that I built? If that's the case, my sgx.enclave_size is 512M (if I'm wrong, please tell me, I'm still nooby in gramine and Intel SGX).

About my program that I'm trying to isolate: It is a server that receives data from client and its job is to analyze the data and send back the result of the analyzed data. The file is not so big (27,2 kB).

If you want more details, please let me know.


Dmitrii Kuvaiskii

Oct 17, 2022, 5:16:44 AM10/17/22
to Augusto Henriques, Gramine Users
I do not see anything special about your system (which has an EPC size of ~200MB), and your specified enclave size (512MB).

I cannot see how it is possible that your first run under `gramine-sgx` is very slow, but your second run is very fast. This should not be possible -- the execution times must be more or less the same. Are you sure your program itself doesn't introduce this variation in execution times, regardless of Gramine?

Another theory is that your system was under heavy load (independent of your Gramine runs) during the first run. So your first run of `gramine-sgx` was delayed because of other tasks your system performed.

I suggest to run your workload natively, without Gramine, like 10 times and measure its deviation in execution times. Then run your workload with Gramine 10 times and measure the deviation.

Yours sincerely,
Dmitrii Kuvaiskii
Reply all
Reply to author
0 new messages