Direct I/O with Gramine #1801
Replies: 4 comments 26 replies
-
You are correct. This flag is ignored by Gramine: https://gramine.readthedocs.io/en/stable/devel/features.html#file-system-operations. (By the way, ignoring the This means that the host Linux will not receive this flag during opening of the file.
I think there is no reasoning behind ignoring this flag. I don't remember anyone ever doing such an experiment and asking us this question. In other words: by default Gramine forbids/ignores most flags/features, just to be on the safe side. When a customer comes and asks for a particular flag/feature, then we consider implementing it. So the reason is purely "because nobody cared before". Now that you raise this question, it seems to me that simply forwarding I will educate myself a bit on |
Beta Was this translation helpful? Give feedback.
-
@ila Quick question: according to your experiments, what is the performance improvement when using |
Beta Was this translation helpful? Give feedback.
-
@ila Can you explain a bit more about your scenario:
Update from my side: I hacked a Gramine version that applies Reading more on I continue reading about |
Beta Was this translation helpful? Give feedback.
-
Edit: your patch compiles and builds no problem, however I am not seeing any performance difference than we had before. The steps I did are:
It could also be that any of these steps somehow did not work, but it is hard to tell since I did test in between steps that the To give you an example, this is the query we are running: The fact that there is a difference between the 1st and the successive runs makes me guess that the IO_DIRECT flag was still ignored. Running the very same query outside Gramine gives us 3 equal results, so we don't think it's an issue on your side. Just to clarify, the expected behaviour is 3 equal results for 3 runs, which imply that nothing is being cached, therefore our IO is not buffered. To give you a reference, this is how we are implementing IO_DIRECT in our application: Edit: I also tried the very same workload without file encryption, and the behaviour is still the same (1st run slower than 2nd and 3rd). So, we can rule out application-based encryption as the culprit). I have taken a look at the file you sent, how do you make sure the behaviour is indeed correct? Should it give a different output on Another edit: this is our manifest file if needed: https://github.com/cwida/ClickBench-SGX/blob/main/benchmark.manifest.template |
Beta Was this translation helpful? Give feedback.
-
Hi, we are benchmarking a database system on SGX, where our workload is primarily to read from disk-based (encrypted) files.
We know that there is no caching of computations output, either by the application or the OS. Only the input files are cached, in case of buffered I/O. Therefore, as a way to reduce the overhead of page swapping (incurred running many different huge queries consecutively), we decided to try direct I/O.
However, both
gramine-direct
andgramine-sgx
do not seem to be affected by direct IO. According to the documentation,O_DIRECT
is not supported.Does this mean that there is no way in Gramine to perform direct I/O?
Is there a way to implement this syscall, or to forcefully avoid caching of I/O?
Is directed I/O a safe operation to perform inside SGX, what is the reasoning behind ignoring this flag?
Thanks in advance!
Beta Was this translation helpful? Give feedback.
All reactions