Repository navigation
Description
Very excited about this package; thanks for all the great work so far. While load testing an app with an async endpoint written with {plumber2}, I noticed unusually low throughput (see summary stats below). When I ran a similar {plumber2} app without async, the performance improved. This is odd because both apps contain a single I/O bound endpoint, so I would expect the async version to have better throughput. For comparison, I ran a third app written with {plumber} instead of {plumber2} that uses {mirai} for async processing. This third app performed better than the synchronous app, which is expected. But the first app and the third app both use {mirai} for async processing, so I'm stumped why the async app written with {plumber2} would be slower.
Summary stats from each load test are as follows. Each load test simulated 200 users with 1-2 seconds between requests for a duration of 1 minute.
| load_test | min_response_time_ms | med_response_time_ms | max_response_time_ms | total_seconds | total_requests | rps |
|---|---|---|---|---|---|---|
| plumber2-sync | 6.86 | 465.80 | 689.46 | 59.68 | 5325 | 89.23 |
| plumber2-async | 51.83 | 8203.13 | 8600.50 | 59.20 | 1130 | 19.09 |
| plumber-async | 3.46 | 8.82 | 150.68 | 59.70 | 6770 | 113.40 |
I've compiled my findings in the repo here. I couldn't think of a better way to package this as a minimally reproducible example, so if the above isn't actionable please let me know and I'll take another stab at it.
The following is the output from sessioninfo::session_info() from inside one of the API containers.
─ Session info ────────────────────────────────────────────────────────────────────────────────────────────────
setting value
version R version 4.5.1 (2025-06-13)
os Ubuntu 24.04.2 LTS
system aarch64, linux-gnu
ui X11
language (EN)
collate en_US.UTF-8
ctype en_US.UTF-8
tz Europe/Berlin
date 2025-11-08
pandoc 3.1.3 @ /usr/bin/pandoc
quarto NA
─ Packages ────────────────────────────────────────────────────────────────────────────────────────────────────
package * version date (UTC) lib source
base64enc 0.1-3 2015-07-28 [1] CRAN (R 4.4.1)
brio 1.1.5 2024-04-24 [1] CRAN (R 4.4.1)
brotli 1.3.2 2025-03-18 [1] CRAN (R 4.4.2)
cli 3.6.5 2025-04-23 [1] CRAN (R 4.4.3)
codetools 0.2-20 2024-03-31 [1] CRAN (R 4.5.1)
DBI * 1.2.3 2024-06-02 [1] CRAN (R 4.4.1)
digest 0.6.37 2024-08-19 [1] CRAN (R 4.4.1)
evaluate 1.0.5 2025-08-27 [1] CRAN (R 4.4.3)
fiery 1.3.0 2025-08-20 [1] CRAN (R 4.4.3)
firesafety 0.1.0 2025-09-10 [1] CRAN (R 4.4.3)
firestorm 0.1.0 2025-09-01 [1] CRAN (R 4.4.3)
future 1.67.0 2025-07-29 [1] CRAN (R 4.4.3)
getopt 1.20.4 2023-10-01 [1] CRAN (R 4.4.1)
globals 0.18.0 2025-05-08 [1] CRAN (R 4.4.3)
glue 1.8.0 2024-09-30 [1] CRAN (R 4.4.1)
httpuv 1.6.16 2025-04-16 [1] CRAN (R 4.4.3)
jsonlite 2.0.0 2025-03-27 [1] CRAN (R 4.4.2)
knitr 1.50 2025-03-16 [1] CRAN (R 4.5.1)
later 1.4.4 2025-08-27 [1] CRAN (R 4.4.3)
lifecycle 1.0.4 2023-11-07 [1] CRAN (R 4.4.1)
listenv 0.9.1 2024-01-29 [1] CRAN (R 4.4.1)
magrittr 2.0.4 2025-09-12 [1] CRAN (R 4.4.3)
mirai * 2.5.1 2025-10-06 [1] CRAN (R 4.4.3)
nanonext 1.7.1 2025-10-01 [1] CRAN (R 4.4.3)
optparse * 1.7.5 2024-04-16 [1] CRAN (R 4.4.1)
otel 0.2.0 2025-08-29 [1] CRAN (R 4.4.3)
palmerpenguins * 0.1.1 2022-08-15 [1] CRAN (R 4.4.1)
parallelly 1.45.1 2025-07-24 [1] CRAN (R 4.4.3)
pillar 1.11.1 2025-09-17 [1] CRAN (R 4.4.3)
pkgconfig 2.0.3 2019-09-22 [1] CRAN (R 4.4.1)
plumber * 1.2.2 2024-03-26 [1] CRAN (R 4.4.1)
plumber2 * 0.1.0 2025-09-22 [1] CRAN (R 4.4.3)
promises * 1.4.0 2025-10-22 [1] CRAN (R 4.4.3)
purrr 1.1.0 2025-07-10 [1] CRAN (R 4.4.3)
R6 2.6.1 2025-02-15 [1] CRAN (R 4.5.1)
ragg 1.5.0 2025-09-02 [1] CRAN (R 4.4.3)
rapidoc 9.3.4 2023-11-17 [1] CRAN (R 4.4.1)
Rcpp 1.1.0 2025-07-02 [1] CRAN (R 4.4.3)
reqres 1.0.0 2025-08-20 [1] CRAN (R 4.4.3)
rlang 1.1.6 2025-04-11 [1] CRAN (R 4.4.3)
routr 1.0.0 2025-08-21 [1] CRAN (R 4.4.3)
roxygen2 7.3.3 2025-09-03 [1] CRAN (R 4.4.3)
sessioninfo 1.2.3 2025-02-05 [1] CRAN (R 4.4.2)
sodium 1.4.0 2024-12-16 [1] CRAN (R 4.4.2)
stringi 1.8.7 2025-03-27 [1] CRAN (R 4.4.3)
stringr 1.5.2 2025-09-08 [1] CRAN (R 4.4.3)
svglite 2.2.2 2025-10-21 [1] CRAN (R 4.4.3)
swagger 5.17.14.1 2024-06-28 [1] CRAN (R 4.4.1)
systemfonts 1.3.1 2025-10-01 [1] CRAN (R 4.5.1)
textshaping 1.0.4 2025-10-10 [1] CRAN (R 4.4.3)
tibble 3.3.0 2025-06-08 [1] CRAN (R 4.4.3)
triebeard 0.4.1 2023-03-04 [1] CRAN (R 4.4.1)
urltools 1.7.3.1 2025-06-12 [1] CRAN (R 4.4.3)
vctrs 0.6.5 2023-12-01 [1] CRAN (R 4.4.1)
websocket 1.4.4 2025-04-10 [1] CRAN (R 4.4.3)
webutils 1.2.2 2024-10-04 [1] CRAN (R 4.4.1)
xfun 0.54 2025-10-30 [1] CRAN (R 4.4.3)
xml2 1.4.1 2025-10-27 [1] CRAN (R 4.4.3)
[1] /opt/R/4.5.1/lib/R/library
* ── Packages attached to the search path.
Activity
thomasp85 commentedon Nov 8, 2025
Thanks for this. I'll dig into it and see if I can find some good explanations and fixes.
thomasp85 commentedon Dec 8, 2025
Can I get you to check with the current dev version. I have done numerous improvements to the performance around the stack so hopefully you should see some improvements
joekirincic commentedon Dec 13, 2025
Excellent! The performance of the async version with
{plumber2}is much more competitive now (see table below). It's a little counterintuitive that the synchronous version is now the fastest of the three, but I'm not complaining. I'm cool with closing this issue if you are.thomasp85 commentedon Dec 16, 2025
Those are great improvements! I never touched anything related to asynchronous in the latest performance improvement run, so I'm sure there is still something to gain there specifically.
Would you be willing to add a second plumber2 async measure where you don't use the async tag but rather replicate what happens in the plumber api (handler returns a promise) and post the comparison. For some reason I can't get you docker image to work but I'm sure its a "me" issue
joekirincic commentedon Jan 3, 2026
Happy to. I added the requested implementation (called
plumber2-async-manual) and reran the load tests. The results can be found in the table below. I've also included updated output fromsessioninfo::session_info()in case that's useful.The three async apps are still competitive with one another. Surprisingly,
plumber2-async-manualwas slightly slower thanplumber2-async. This holds after several reruns of the load tests. It's surprising because the former app defines thequery_penguinsfunction inside of the mirais upfront with the call tomirai::everywhere, so I would expect it to be slightly faster thanplumber2-asyncbecause it wasn't serializing thequery_penguinsfunction during each request. It's also surprising that theplumber-asyncapp still manages to process 45 more requests thanplumber2-async-manualbecause both return a promise in the same manner.If there's anything else I can do to help, definitely let me know!
thomasp85 commentedon Jan 13, 2026
You don't by chance have the distribution of response times at hand? The min, median, and max values would suggest a bigger difference in total_requests than there actually is