I have a plumber API that takes unexpectedly long to run and I have trouble understanding what the reason for that could be. Let me give you some context:
that API doesn't do any fancy calculations, locally runs in a couple of seconds for json files of 4-5 MB (including importing data). Our expectation was that it would run similarly fast when wrapped in a plumber API, but to our surprise it's quite the contrary.
R Studio Connect API - curl timing results:
time_namelookup: 0.004264 time_connect: 0.004503 time_appconnect: 0.000000 time_pretransfer: 0.004548 time_redirect: 0.000000 time_starttransfer: 0.005525 ---------- time_total: 20.593546
Local API - timing of the most important code pieces
Starting server to listen on port 7992 Running the swagger UI at http://127.0.0.1:7992/__swagger__/
Working on it...
Time difference of 3.83 secs <- loading json
Raw file ready to rock...
Time difference of 0.81 secs <- data prep
Time difference of 0.10 secs <- variables calculation
Other than that there are no other operations that take time. As you can see the same code runs for over 20 seconds on RSC vs. nearly 5 seconds locally. How come there's such a huge difference between those timings between RSC and when running locally? Is there any way to speed that up?