Stream: wamr

Topic: Optimize WAMR: Small binaries & parallel execution


view this post on Zulip Steve (May 14 2025 at 15:25):

I'm currently trying to use WAMR in a heavily parallelized application. I have benchmarks running for this application that shows that WAMR is hitting 86% of my native speed in a single thread but that performance drops off significantly with multiple threads.

I'm looking for advice from WAMR experts on how to build and use WAMR most effectively given my environment.

To clarify, I am running as many small WebAssembly modules as possible looking to optimize for time rather than space.

I'm currently building with fast_jit and without hardware bounds checks.

view this post on Zulip Steve (May 14 2025 at 15:25):

------------------------------------------------------------------------------------------------------------------------------------------
Benchmark                                                                                Time             CPU   Iterations UserCounters...
------------------------------------------------------------------------------------------------------------------------------------------
token_transactions/min_time:5.000/min_warmup_time:1.000/real_time/threads:1          47160 ns        46890 ns       148459 transaction_time=47.1604us transactions=21.2042k/s
token_transactions/min_time:5.000/min_warmup_time:1.000/real_time/threads:2          52020 ns        49768 ns       134234 transaction_time=26.0102us transactions=38.4465k/s
token_transactions/min_time:5.000/min_warmup_time:1.000/real_time/threads:4          64209 ns        57525 ns       111384 transaction_time=16.0522us transactions=62.2969k/s
token_transactions/min_time:5.000/min_warmup_time:1.000/real_time/threads:8         102226 ns        83479 ns        74656 transaction_time=12.7782us transactions=78.2583k/s
token_transactions/min_time:5.000/min_warmup_time:1.000/real_time/threads:16        225669 ns       156788 ns        32352 transaction_time=14.1043us transactions=70.9003k/s
token_transactions/min_time:5.000/min_warmup_time:1.000/real_time/threads:32        507825 ns       141228 ns        12896 transaction_time=15.8695us transactions=63.0139k/s
token_transactions/min_time:5.000/min_warmup_time:1.000/real_time/threads:64        896231 ns       154784 ns         8448 transaction_time=14.0036us transactions=71.4102k/s
token_transactions/min_time:5.000/min_warmup_time:1.000/real_time/threads:128      1613972 ns       158502 ns         4224 transaction_time=12.6092us transactions=79.3074k/s
token_transactions/min_time:5.000/min_warmup_time:1.000/real_time/threads:256      2915854 ns       157127 ns         3328 transaction_time=11.3901us transactions=87.7959k/s
token_transactions/min_time:5.000/min_warmup_time:1.000/real_time/threads:512      6507146 ns       183015 ns         1536 transaction_time=12.7093us transactions=78.6827k/s
token_transactions/min_time:5.000/min_warmup_time:1.000/real_time/threads:1024     8599593 ns       202500 ns         1024 transaction_time=8.39804us transactions=119.075k/s
token_transactions/min_time:5.000/min_warmup_time:1.000/real_time/threads:2048    24181246 ns       233584 ns         2048 transaction_time=11.8072us transactions=84.6937k/s
token_transactions/min_time:5.000/min_warmup_time:1.000/real_time/threads:4096    37847957 ns       211060 ns         4096 transaction_time=9.24022us transactions=108.222k/s
token_transactions/min_time:5.000/min_warmup_time:1.000/real_time/threads:8192    72479376 ns       206789 ns         8192 transaction_time=8.84758us transactions=113.025k/s
token_transactions/min_time:5.000/min_warmup_time:1.000/real_time/threads:16384  142267166 ns       208227 ns        16384 transaction_time=8.6833us transactions=115.164k/s
coin_transactions/min_time:5.000/min_warmup_time:1.000/real_time/threads:1           42141 ns        42085 ns       164714 transaction_time=42.141us transactions=23.7299k/s
coin_transactions/min_time:5.000/min_warmup_time:1.000/real_time/threads:2           42439 ns        42378 ns       165524 transaction_time=21.2197us transactions=47.1261k/s
coin_transactions/min_time:5.000/min_warmup_time:1.000/real_time/threads:4           45792 ns        45711 ns       150484 transaction_time=11.448us transactions=87.3519k/s
coin_transactions/min_time:5.000/min_warmup_time:1.000/real_time/threads:8           56366 ns        56271 ns       124280 transaction_time=7.04573us transactions=141.93k/s
coin_transactions/min_time:5.000/min_warmup_time:1.000/real_time/threads:16          83458 ns        83232 ns        85280 transaction_time=5.2161us transactions=191.714k/s
coin_transactions/min_time:5.000/min_warmup_time:1.000/real_time/threads:32         151053 ns       106136 ns        41632 transaction_time=4.72042us transactions=211.846k/s
coin_transactions/min_time:5.000/min_warmup_time:1.000/real_time/threads:64         249221 ns       114625 ns        41408 transaction_time=3.89408us transactions=256.8k/s
coin_transactions/min_time:5.000/min_warmup_time:1.000/real_time/threads:128        457146 ns       113368 ns        15232 transaction_time=3.57146us transactions=279.998k/s
coin_transactions/min_time:5.000/min_warmup_time:1.000/real_time/threads:256        799427 ns       108666 ns         9216 transaction_time=3.12276us transactions=320.229k/s
coin_transactions/min_time:5.000/min_warmup_time:1.000/real_time/threads:512       1670683 ns       110192 ns         3072 transaction_time=3.26305us transactions=306.461k/s
coin_transactions/min_time:5.000/min_warmup_time:1.000/real_time/threads:1024      3584987 ns       113055 ns         2048 transaction_time=3.50096us transactions=285.636k/s
coin_transactions/min_time:5.000/min_warmup_time:1.000/real_time/threads:2048      9674782 ns       127742 ns         2048 transaction_time=4.72401us transactions=211.684k/s
coin_transactions/min_time:5.000/min_warmup_time:1.000/real_time/threads:4096     19895501 ns       141395 ns         4096 transaction_time=4.8573us transactions=205.876k/s
coin_transactions/min_time:5.000/min_warmup_time:1.000/real_time/threads:8192     38847796 ns       136568 ns         8192 transaction_time=4.74216us transactions=210.874k/s
coin_transactions/min_time:5.000/min_warmup_time:1.000/real_time/threads:16384    79561378 ns       134940 ns        16384 transaction_time=4.85604us transactions=205.929k/s

view this post on Zulip Steve (May 14 2025 at 15:27):

As you can see here, 21.2042k/s on WASM and 23.7299k/s natively. These numbers are really respectable. However as the threads increase native tops out at 320.223k/s while WAMR tops out at 119.075k/s.

Token = WASM
Coin = Native

view this post on Zulip lum1n0us (May 26 2025 at 01:14):

I am not sure if my advice will fit your cases until I learn more details. Here are some common suggestions:

WebAssembly for Proxies (C++ host implementation). Contribute to proxy-wasm/proxy-wasm-cpp-host development by creating an account on GitHub.

view this post on Zulip lum1n0us (Jun 23 2025 at 00:10):

It seems like there hasn't been any activity on this issue for a while. If you have any further questions or updates, please feel free to share them with us.

To keep our project organized, we plan to close this issue soon if there are no new developments. Of course, you can always reopen it or start a new thread if needed.

Thank you for your understanding and cooperation!


Last updated: Dec 06 2025 at 07:03 UTC