1

I see that Parse Server instances running on AWS EC2 show increasing response times. The longer an instance is in service, the longer the response time, even though the number of requests / instance stays the same.

In this article it say:

Imagine that a running instance of your server is only using 25/30% CPU before latency goes up. At that point, you have to deploy a new instance of the same server to maintain a low latency. Why? Because of the use of a single thread, incoming requests are quickly queued, especially if one the request takes time to build the response.

From this answer I understand that the commands process._getActiveHandles() and process._getActiveRequests() can be used to inspect the queue.

  • Where specifically in the output of these commands do I see how many requests are in the queue, so I can see whether a backlog is building up?
  • How can I tell whether the queue is overflowing, would that be in the Node.js logs?
Manuel
  • 14,274
  • 6
  • 57
  • 130
  • 1
    This article really isn't completely accurate. While it's true that whatever is running in JavaScript land is single-threaded, it is usually the case that most of the real work is in native code and using a thread pool. Node.js consists of the JavaScript engine and a whole pile of hybrid modules that span native and JavaScript code. In any case, what you're looking at on `process` is completely unrelated to HTTP requests that the author is referring to. – Brad Jun 06 '20 at 17:33
  • Would it still make sense to run 2 Parse Server instances with Node.js's cluster mode if the VM has 2 virtual CPU cores? Or is that also irrelevant because the underlying modules would use both cores anyway - I guess I'm mixing up things here :/ – Manuel Jun 06 '20 at 17:37
  • 1
    I've never used Parse, so I couldn't tell you other than to profile the code yourself and see. It's likely going to depend on your specific application workload. In my case, I've never had a Node.js application that needed to be split into multiple processes (via cluster or otherwise) to saturate a number of CPU cores. Without any extra effort, I've had no issues fully utilizing multi-core machines. So, if you have something specific about your application that requires this, sure, but if not... it probably isn't worth the effort and complexity. – Brad Jun 06 '20 at 17:40

0 Answers0