Does Elastic APM for node js uses different thread for sending events or the same node thread?


(Khushboo) #1

Node js being a single thread application, How does APM behaves in such case? . Does it use same thread which application uses or a different thread . ? Will it impact the current performance of the application?


(Daniel T Lee) #2

+1 :+1: for that.

I have similar question.
How about uWSGi working on python?
Does it uses one other thread (or worker?) for uWSGi?

And how much impact will this apm agent will effect to application?


(Thomas Watson) #3

The Node.js agent uses the same thread as the application it self.

Errors are sent to the APM Server as they happen. If an uncaught exceptions is detected that normally crashes the process, the process is temporarily kept alive while the error is being sent to the APM Server after which the process crashes as normal.

Performance data is buffered in memory and only sent to the APM Server periodically. The interval can be tuned using either the flushInterval or the maxQueueSize config options.

Everything that's sent to the APM Server is done so asynchronously.


(Benjamin Wohlwend @ APM) #4

Thanks for the question Daniel! Generally speaking, the Python agent by default uses a background thread to send data (both errors and transactions), one thread per worker process. For transactions, we queue up collected data and send it periodically.

For uWSGI specifically, you'll have to ensure that the enable-threads option is enabled, otherwise we can't create the background thread.

As for overhead, it's difficult to give exact numbers, as it relies heavily on your specific workload. There are a few knobs with which you can control overhead (e.g. by only sample a subset of transactions, changing the queue length, disabling collection of source code snippets for transaction etc.). Most of these knobs are only available in the upcoming version 2.0 of the agent, which should be released in a few weeks. We'll also document on how you can ensure that Elastic APM doesn't incur too much overhead on your app.


(system) #5

This topic was automatically closed 20 days after the last reply. New replies are no longer allowed.