ngo
ngo copied to clipboard
Improve the scalability of SyncIoDisk
The SyncIoDisk
in sgx-disk
is not scalable on concurrency.
The problem is that there is a lock hold while doing I/O. This lock can be removed if using read_at
and write_at
API.
Workaround: Use std::os::unix::fs::FileExt::read_at
and write_at
API, remove the lock.
Bench result:
Code:
This is good perf improvement. But the implementation contains a bug... The offset should be calculated as follows.
offset += buf.as_slice().len()
Another thing is that the implementation should better use pwritev
so that the number of OCalls is always one per request, instead of one per buffer.
Improvement: Use libc::ocall::preadv64
andpwritev64
API.
Bench result:
Code:
Great. Now we can submit a pull request.