Question

How To Fix Lag Spikes on Server

I keep getting alerts from the monitoring feature I set up that say the site is experiencing high latency.

Server is node/express.

How do I go about fixing this? I tried profiling my app with --inspect, I also tried the 3rd party tool “Clinic” with different views, I tried looking at my google analytics, but still was unable to find anything useful.

All my resources seem to spike at the same time. https://i.imgur.com/sLD2Iog.png

How do i even start thinking about how to solve this problem?


Submit an answer
Answer a question...

This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

This comment has been deleted

KFSys
Site Moderator
Site Moderator badge
January 6, 2023

Hi @skeddtemp,

It’s expected for the resources to jump at the same time. The reason behind these should be fairly simple. It’s possible you have some cronjob configured at the time of the spikes, or you have a bot crawling your website thus generating a high load.

If you can find a pattern of when the spikes appear try logging in to your Droplet and caching the spike in real-time and trying to troubleshoot it. See what processes are running, use htop to see what is causing this high load, etc.