Async endpoints are much slower compared to equivalent ones written with `{plumber}`.

Abierto
#61 6 comentarios 0 reacciones 0 asignados Ver en GitHub

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
4/5
Tiempo estimado
3-5 días
Aptitud para principiantes
35/100
Tipo de issue
Error
Claridad
Necesita aclaración
Estado de actividad
Estancado
Stack tecnológico
r

Línea de trabajo

Start with the linked performance-optimization-for-plumber-apis repository and reproduce its plumber2 synchronous and asynchronous load tests. Compare those results with the plumber/mirai case and inspect the plumber2 async entry points involved. Done means identifying why the async endpoint is slower and confirming the fix with comparable throughput measurements.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

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.
Lenguaje dominante
R
Estrellas
119
Forks
17
Métricas de merge de PR
Sin PR fusionados en 30 d

Preparar el entorno

Este proyecto no incluye contenedor de desarrollo, Dockerfile ni guía de contribución, así que la configuración corre por tu cuenta: empieza por su README y consulta nuestra guía para la primera contribución para los pasos generales.

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de posit-dev/plumber2

Todos los issues de posit-dev/plumber2

Issues similares

Más issues de R

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.