3

I have a NodeJS application using express as web framework, exposing a single API that receives a JSON file and uses the data of the json file to fill up a word document template and generate a PDF which is delivered as download in the API response.

For the JSON to Word document, we are using carbone.io library, which I believe does the following IO operations:

  • Reads the docx template
  • Writes the resulting word file

Then our API calls a postscript to convert the docx to PDF (libreoffice) and then a Response.download of the resulting PDF.

Currency is very complicated specially considering libuv's default thread pool size value of 4. So, I'd like to increment the thread pool size by setting UV_THREADPOOL_SIZE, however, I'd like to know how can I calculate the appropriate value to set for the different environments my application runs.

This application would be running on docker containers and would have several instances deployed with k8s, but I'd really like it to be able to handle more than one request per a few seconds. We expect at least 100 requests/s (not TPS as the whole transformation and conversion process takes its time) for this application at the initial stage and scale with time.

So my question is this: how can I do to estimate an appropriate value for UV_THREADPOOL_SIZE?

Thank you!

T.S.
  • 192
  • 2
  • 13

0 Answers0