Best way to debug which plugin(s) are causing random memory spikes on my server
-
Hello!
I am hoping you can help lead me in the right direction to help me debug why my site will randomly have huge memory spikes which ends up taking down my entire instance which is run on AWS lightsail.
I run an ecommerce site that has moderate complexity, but very low traffic. Like almost never more than 5 concurrent users. And usually only 1 or 2.
The instance has 4GB of ram, and 2 vCPUs and 80GB storage. Which from all my research should be way more than enough.
Here you can see a graph from Google Analytics of users over the past month. I’m sure It’s not totally accurate because of bot traffic and analytics blockers, but you can see its on the order of magnitude that this type of server should be able to handle without breaking a sweat. (usually less than 200 active users per day)
View post on imgur.com
CPU usage is also generally very low and rarely goes above 10 percent.
View post on imgur.com
The memory usage for wordpress generally hovers around 60%, even with only a single user on the site. This seems high to me, but I’ve also read that wordpress will use available free memory as a cache, so not sure if that is a red flag itself, or just as designed.
View post on imgur.com
I have around 35 active plugins which is a little more than average, but nothing crazy, as most of them are required things like plugins for payment providers, etc. and the others we use for custom behavior that would take a ton of time to program ourselves.
View post on imgur.com
Randomly, anywhere from once a week to once a month, the memory usage will randomly skyrocket, and the php error console will unload tons of out of memory errors. Since I havent set up swap yet on light sail, this causes the cpu usage to sky rocket which causes the CPU burst capability to go down to 0, which once at 0 completely shuts down the instance, until you login to the admin console and hard reboot it. You are not even able to ssh into it once it gets into this state.
View post on imgur.com
View post on imgur.com
Here you can see it happened twice within 2 days.
I know I can look into setting up swap to stop the server from hard locking up when this happens, but obviously that is just a side effect of the real problem.
Here are the logs I was able to recover after the fact from when it started. Wondering if anyone has any ideas what this might be from, or how I can start debugging what’s going on.
I see one part of thew log showing
\PayPalCommerce\Session\SessionHandler\0insufficient_funding_tries
but not sure if that could really be the problem or why that would cause the server to go bezerk.
Since it is so random, debugging by just shutting down plugin by plugin and hoping it doesn’t happen again is something I’m kind of trying to avoid as it will take forever, affect production, and I am unable to reproduce on our staging server.
I am thinking about shutting down paypal temporarily to see if that fixes but, but since a lot of people use paypal to checout I am not too keen on that option, since it takes like a more than a month sometimes for it to happen, so It’s very hard to tell when It’s fixed or not.
Wondering if
1) anyone has any guesses based on my details and logs above which plugin might be the biggest culprit,
2) what’s the best monitor or something I can put in place to get more details about what is going wrong for the next time it happens.
Thanks for any help, very much appreciated!
- The topic ‘Best way to debug which plugin(s) are causing random memory spikes on my server’ is closed to new replies.