Stress test / hang test of large Node.JS application - node.js

We have a large website with express and the whole application is written in Node.JS.
When the mongo db is down our app starts hanging when you refresh the browser on home page and also in other page. This is caused because of the behaviour of the mongoose library when the mongo database goes down. the app is served from ubuntu 14.04 machines.
My question is how to test application "hangs".
What kind of tests should I perform to know that i don't have any more web app hangs. The problem is that a hang can be caused by multiple reasons and not just by the mongoose issue which i have fixed.
How can I test that?
What kind of tools and techniques are recommended?

Related

Is it possible to identify what is blocking an await?

I've got an intermittent problem on our application (.net core, mongo database and hosted with Azure).
Occasionally requests appear to get stuck. A profiler trace using application insights shows this:
So the application is being held at an await for 17 seconds, before running the query for 63ms.
Is it possible, or is there a technique for finding out why it's hanging there and what's blocking it? (note, I'm not asking specifically why it's hanging at this point...but how to find out)

Angular 8 Universal (Server Side Rendering) app is crashing

I have deployed an Angular 8 universal app in a server droplet of Digital Ocean. It is running in production. The server config is 4GB memory and 2 vCPU. The app is run via nodejs in the server. It's been running fine for over a month until recently it suddenly started crashing in no definite time. Since it's running in my client's computer browser, I don't know any way to monitor the error in their console. I also run this app with NOHUP command which dumps all the server side node js logs in a nohup.out file. But nohup.out file shows nothing about the crash.
Things that happened around the crash event started to happen.
1. I have pushed an update which is totally unrelated to the bootstrapping of the app. As per my understanding the Angular universal only renders the initial view and sends it to client browser. After that it's the browser that takes care of rest of the jobs.
The app uses websocket to maintain a bidirectional connectivity with the backend app written in Java. Also I don't think WS is the reason, because after implementing the WS feature, it ran just fine for over a week.
Thirdly i noticed that there are some image links(of the website) that are loaded from a CDN/Edge server and for last couple of days some static files located in the CDN server are taking too long to load/download. The response time to load those files spike up to 25-26 seconds sometimes. Since these static files are loaded during startup, can the delay of loading the static files cause any type of timeout event when Node JS renders the page in the startup?
As you can understand I have no clue how to debug this thing. Is there anyway who faced similar crashing issue with Angular Universal and help me point to the right direction? Thanks

Performance issue on Oracle Linux with VB6 client application

I have a Linux server which is hosting a Oracle database and there are around 500 client applications written in VB6 that connect to this Linux server. When the number of users are down to lets say under 20 the application runs Fast enough for all the clients but as the number of users grow the applications becomes slower and slower to a stage where it is almost unusable. I have debugged the application and it looks like database /server is the bottle neck. How can I debug the exact issue and resolve?

Node.js app takes a long time to start up and connect to? Why?

I have this app I'm developing and I thought of moving the VM I was using to real hardware. My Raspberry Pi 2 came to mind, a quad-core 900mhz ARM v7 with 1GB of ram. This hardware clocks at twice the speed I set my VM to run (a typical low end VPS equivalent) so it should be more than enough.
Installed Raspbian, nginx and the nodejs package from their repository using apt-get. Everything is super! But I noticed this distinct slowness when accessing the app. It's like a 7-10 sec pause before everything loads.
To test it further I installed full-fledged Node.js app called Tiddlywiki which I installed and used many times in the past. And it's true, there it was again that 7-10 sec delay when you refresh the page.
The app seems to run fine, POST and GET is instant once it's up and running in the Web Browser, but the delay is there if I refresh the page.
NOTE: If I restart the Pi and wait for it to restart the first time I access the app URL the delay seems to double, about 15 sec. Nginx html pages seem lightning fast in comparison.
Any thoughts on this?
Apparently Node.JS apps are quite fast on the Raspberry Pi 2.
The app I was test driving had and still has some weird behavior when using a password to encrypt content and starting the server with --password 12345678 made everything run very slow.
Running the app without a password is lightning fast.
PS. The app in question was Tiddlywiki, which can be run as a server for collaboration and such.

Node.js, Sails.js servers time out

Environment: Windows Server 2008
I have a Node.js and a Sails.js apps. For example, my Node.js app does something like this:
http.createServer(function(req,res){...}).listen(8000);
Both are really simple apps, but I need them available at all times. I had problems creating a Windows Service, so i created a task for each app in the Task Scheduler.
They seem to be working fine except for when the apps haven't been used for over an hour or so (not sure on the exact timing). After some time when I go to localhost:8000, my Node.js app (same with my Sails.js app) responds only after about 10-20 seconds, and in less than a second in the following requests.
I am thinking about writing another task :) - a warm-up script that will send periodic requests to keep the apps running. But there's gotta be a better way! Is there a server timeout setting in Node.js/Sails.js that can be disabled/modified?

Resources