Consider using pipes instead of unix sockets for PlatformChannelPair. |
||||
Issue descriptionWe currently use socketpair(): https://cs.chromium.org/chromium/src/mojo/edk/embedder/platform_channel_pair_posix.cc?type=cs&q=platformchannelpair&sq=package:chromium&l=68 We also care about performance: https://cs.chromium.org/chromium/src/mojo/edk/embedder/platform_channel_utils_posix.cc?type=cs&q=platformchannelwrite&sq=package:chromium&l=99 This link implies we should investigate using pipe() instead: https://opendmx.net/index.php/Pipe_vs_Unix_Socket_Performance
,
Oct 19 2017
The only difference between memlog-all and memlog-all-socketpair is that I avoided using PlatformChannelPair and made a pipe() directly. This also causes some differences w.r.t. number of emitted trace events, but as discussed in: https://groups.google.com/a/google.com/forum/#!search/chrome-benchmarking/chrome-desktop-memory/UAVNrpO9pw0/QLYq3J3LBAAJ The main cause of slowness is performance of write().
,
Oct 19 2017
Main issue here is that afaik pipes don't support file descriptor transfer. And introducing a separate pipe for data-only messages substantially increases the complexity of the system. A third option which might be tolerable would be to use a pipe for all messages, and a separate domain socket for any fds, synchronizing only when fds are expected for received message. I don't really have time to explore that at the moment though.
,
Oct 19 2017
I ran the same test on Linux. socketpair3 is misnamed - that's the test with a pipe(). socketpair4 uses a socketpair(). Here we see that the performance gains are much more modest. So I would only expect this to have a large impact on macOS.
,
Nov 9 2017
,
Sep 19
Just doing some bug cleanup. This is not a feasible request because pipes don't support transfer of file descriptors. Also if the only performance gain would be on Mac, it's probably moot. I would expect better performance improvements on Mac by building a dedicated Channel implementation directly on mach_msg. |
||||
►
Sign in to add a comment |
||||
Comment 1 by erikc...@chromium.org
, Oct 19 2017184 KB
184 KB View Download