I am running an API on a linux server. For the majority of the day the API runs completely fine, however every single day at 1:00 am/pm I receive a large spike of failures that the end after about 5 minutes. Looking into the failures, there is not one consistent pattern in the requests, and most requests still process fine (just a higher proportion fail). It also is not likely traffic related as 1:00am is a very slow traffic window
I am not the only person who is using this server though, so I suspect that someone else is running a process every 12 hours at this time which is eating up a lot of resources.
My question is if there is a bash
command which I can run on my server to see if there are any processes that are always being run during this window?
CodePudding user response:
Use top command in batch mode to display system statistics in real time and save the output in a textfile
top -b -n 1 > top.txt
To grab more than one iteration of top command, change -n 1 to your disired number. For example -n 100
top -b -n 100 > top.txt
Put the command in a script and execute the script via crontab or as an atjob at 1:00 am then check your textfile