![]() ![]() In this exercise we will use a combination of good old ps/top and some load-testing to induce the problem so that we can confirm its presence (and to check whether changes to the code are having the intended effect). In production, you would use an APM solution to monitor your RAM usage which would alert you to the problem. Confirming the diagnosis Measuring memory usage Install and run the server locally before we proceed onto confirming the problem and analysing our Node process’s heap with heapdump to figure out a fix. Take a quick look at client.js for an idea of how clients use our service. You can probably find the leak by just looking through the code - it’s very short - but the idea is that we pinpoint the leak without reading the code. The source code for the service is available on our Github under calc-server. ![]() The memory usage seems to grow constantly over the lifetime of the process, which becomes especially evident when we experience a spike in usage of the service. We have a service running in production that implements an RPN calculator over WebSockets. What follows is a walkthrough of an exercise that was part of the cirriculum of a Node.js performance workshop that Igor Soarez and I taught at WDCNZ recently. Fortunately, they usually aren’t difficult to find. Memory leaks are quite common in production applications. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |