Daemon
Daemon copied to clipboard
Can we make synchronous IPC faster by doing a mixed shmem/pipe one?
While working on #1114:
- https://github.com/DaemonEngine/Daemon/pull/1114
I noticed that message size of synchrnous IPC based trap calls have huge impact on performance.
I wonder if it would be possible to make such pipe speed totally independant from message size this way:
- Game write message body in shmem at a given address;
- Game reserve response body in shmem at a given address;
- Game send to engine over pipe a very short message telling the engine the message is ready in shmem at the given address, and where the response should be written in shmem;
- Engine receives the message and processes the message body;
- Engine writes the response in shmem at a given address;
- Engine sends back to game over pipe a very short response telling the game the response is ready in shmem at the known address.
I guess the problem of synchronous IPC between game and engine using shmem is to actually synchronize the access, maybe we can only use the pipe for synchronizing the access, not for exchanging the actual data.
I guess in theory it sounds faster, but I don't actually know whether such a thing will be faster in practice? Maybe we can avoid a kernel round trip by only using user space. Would need to be prototyped and benchmarked to be sure that this has a noticeable effect.