Sync Mojo calls are much slower than IPC |
|||
Issue descriptionSee this thread: https://groups.google.com/a/chromium.org/forum/#!topic/speed/6UwVwIdbZlY for details For sending 144 byte string, sync IPC with the old IPC::ChannelWin takes 6us while Mojo takes 44us. IPC layered mojo takes 11us. Maybe we don't care about the latter case since it's temporary and there'll be overhead of layering. However a 7x slowdown is pretty large and it would be good to understand why it's the case and if we can bring it to parity. Here's a cl that brings back IPC::ChannelWin for testing: https://chromium-review.googlesource.com/c/572140/ More information also in bug 698460 which Antoine linked to in the thread.
,
Jul 17 2017
On Jul 16, 2017 9:29 PM, "jam via monorail" <monorail+v2.498573691@ chromium.org> wrote: In the general case there are zero PostTasks on the sending side - the calling thread blocks and wakes up as soon as the sending pipe becomes readable. The signaling happens directly from the IO thread, no task queueing. Receiving side of course looks like async IPC.
,
Jul 17 2017
,
Jul 18 2017
The following revision refers to this bug: https://chromium.googlesource.com/chromium/src.git/+/1a3d539e2bcfdb49349915d0959fe4c14d2f8cd9 commit 1a3d539e2bcfdb49349915d0959fe4c14d2f8cd9 Author: Yuzhu Shen <yzshen@chromium.org> Date: Tue Jul 18 00:59:34 2017 Fix sync IPC perf tests. - Actually uses IPC::SyncChannel to send sync messages. - More accurately record the endtime. After this change the Mojo sync IPC is faster than IPC-over-Mojo sync IPC: (On linux z620; release build with profiling turned on.) MojoChannelPerfTest.ChannelProxySyncPing IPC_ChannelProxy_Perf_50000x_144 6507.49 ms MojoInterfacePerfTest.MultiprocessSyncPing IPC_MultiprocessSync_Perf_50000x_144 5283.86 ms BUG= 743263 Change-Id: Ie1834869b8d88e25a5986bdc9714132d6b7fc87b Reviewed-on: https://chromium-review.googlesource.com/575032 Commit-Queue: Yuzhu Shen <yzshen@chromium.org> Commit-Queue: John Abd-El-Malek <jam@chromium.org> Reviewed-by: John Abd-El-Malek <jam@chromium.org> Cr-Commit-Position: refs/heads/master@{#487326} [modify] https://crrev.com/1a3d539e2bcfdb49349915d0959fe4c14d2f8cd9/ipc/ipc_mojo_perftest.cc
,
Jul 18 2017
The following are numbers after the fix of #4. Env: Windows7; Z840; release non-component build. ToT (dac2a303c878550ecb912cc442d6424ad02fdf76): ======================================================== IPC-over-Mojo: MojoChannelPerfTest.ChannelProxySyncPing IPC_ChannelProxy_Perf_50000x_12 2446.36 ms IPC_ChannelProxy_Perf_50000x_144 2501.22 ms IPC_ChannelProxy_Perf_50000x_1728 2672.26 ms IPC_ChannelProxy_Perf_12000x_20736 2380.44 ms IPC_ChannelProxy_Perf_1000x_248832 731.403 ms Mojo MojoInterfacePerfTest.MultiprocessSyncPing IPC_MultiprocessSync_Perf_50000x_12 1457.14 ms IPC_MultiprocessSync_Perf_50000x_144 1485.81 ms IPC_MultiprocessSync_Perf_50000x_1728 1562.66 ms IPC_MultiprocessSync_Perf_12000x_20736 1170.98 ms IPC_MultiprocessSync_Perf_1000x_248832 360.992 ms ======================================================== ToT + CL 572140: ======================================================== Raw IPC: MojoChannelPerfTest.ChannelProxySyncPing IPC_ChannelProxy_Perf_50000x_12 1386.46 ms IPC_ChannelProxy_Perf_50000x_144 1437.1 ms IPC_ChannelProxy_Perf_50000x_1728 1574.55 ms IPC_ChannelProxy_Perf_12000x_20736 1311.02 ms IPC_ChannelProxy_Perf_1000x_248832 638.576 ms Mojo: MojoInterfacePerfTest.MultiprocessSyncPing IPC_MultiprocessSync_Perf_50000x_12 1556.12 ms IPC_MultiprocessSync_Perf_50000x_144 1588.83 ms IPC_MultiprocessSync_Perf_50000x_1728 1668.74 ms IPC_MultiprocessSync_Perf_12000x_20736 1143.21 ms IPC_MultiprocessSync_Perf_1000x_248832 421.44 ms ======================================================== I think Mojo sync call's performance is roughly the same as raw IPC. However, IPC-over-Mojo is 1.7x~2.0x slower than Mojo. There might be something that we could do there.
,
Jul 25 2017
The following revision refers to this bug: https://chromium.googlesource.com/chromium/src.git/+/3ec434e7999cbe17867e415786dea0a8753063fa commit 3ec434e7999cbe17867e415786dea0a8753063fa Author: yzshen <yzshen@chromium.org> Date: Tue Jul 25 20:26:43 2017 IPC perf tests: make sure we use the same IO thread for Mojo and IPC::Channel. This is the common settings for chrome processes. And it is a more fair comparison for IPC-over-Mojo, because otherwise it will have one more thread hop. ======================================================= Before: [ RUN ] MojoChannelPerfTest.ChannelProxySyncPing IPC_ChannelProxy_Perf_50000x_12 2446.18 ms IPC_ChannelProxy_Perf_50000x_144 2531.74 ms IPC_ChannelProxy_Perf_50000x_1728 2671.44 ms IPC_ChannelProxy_Perf_12000x_20736 1982.34 ms IPC_ChannelProxy_Perf_1000x_248832 722.78 ms [ RUN ] MojoInterfacePerfTest.MultiprocessSyncPing IPC_MultiprocessSync_Perf_50000x_12 1479.53 ms IPC_MultiprocessSync_Perf_50000x_144 1503.54 ms IPC_MultiprocessSync_Perf_50000x_1728 1579.21 ms IPC_MultiprocessSync_Perf_12000x_20736 795.372 ms IPC_MultiprocessSync_Perf_1000x_248832 362.226 ms ======================================================= After: [ RUN ] MojoChannelPerfTest.ChannelProxySyncPing IPC_ChannelProxy_Perf_50000x_12 1830.47 ms IPC_ChannelProxy_Perf_50000x_144 1917.38 ms IPC_ChannelProxy_Perf_50000x_1728 2077.17 ms IPC_ChannelProxy_Perf_12000x_20736 2004.43 ms IPC_ChannelProxy_Perf_1000x_248832 646.541 ms [ RUN ] MojoInterfacePerfTest.MultiprocessSyncPing IPC_MultiprocessSync_Perf_50000x_12 1491.91 ms IPC_MultiprocessSync_Perf_50000x_144 1520.53 ms IPC_MultiprocessSync_Perf_50000x_1728 1593.22 ms IPC_MultiprocessSync_Perf_12000x_20736 796.643 ms IPC_MultiprocessSync_Perf_1000x_248832 362.22 ms Bug: 743263 Change-Id: Ie88cf3992242307078c96b3c2d99fb17670454cc Reviewed-on: https://chromium-review.googlesource.com/585215 Reviewed-by: John Abd-El-Malek <jam@chromium.org> Commit-Queue: Yuzhu Shen <yzshen@chromium.org> Cr-Commit-Position: refs/heads/master@{#489414} [modify] https://crrev.com/3ec434e7999cbe17867e415786dea0a8753063fa/ipc/ipc_mojo_perftest.cc
,
Jul 25 2017
New numbers after the fixes: ========================================================== Mojo v.s. Raw IPC: Message size IPC time / Mojo time (Multiprocess Async) 12 0.7629088537 144 0.7963307122 1728 0.7868184199 20736 0.9662769433 248832 1.809091465 Message size IPC time / Mojo time (Multiprocess Sync) 12 0.9126146589 144 0.9737779754 1728 0.9899441763 20736 1.000973771 248832 1.734349247 ========================================================== Mojo v.s. IPC-over-Mojo: Message size IPC time / Mojo time (Multiprocess Async) 12 1.142084093 144 1.140816704 1728 1.160322814 20736 1.38266146 248832 2.193903466 Message size IPC time / Mojo time (Multiprocess Sync) 12 1.237172101 144 1.258429701 1728 1.288468299 20736 1.741986894 248832 1.746560011 ========================================================== This link shows the original numbers to generate the results above: https://docs.google.com/spreadsheets/d/1slOefrP2FqHwMYuEmrbMAmfoMbA76ddsL6CMGB0wjRU/edit?usp=sharing We could see that Mojo sync calls are as fast as raw IPCs up till message size of 20736, and are a lot faster with message size of 2048832. |
|||
►
Sign in to add a comment |
|||
Comment 1 by jam@chromium.org
, Jul 17 2017