Score:0

Digital Ocean WordPress Memory frequent Spike with less than 100 Traffic

ve flag

Everything was running perfectly fine, but from last 4 days my site on root domain got high memory usage alerts.

I created a same clone site with same Nginx Configs on Subdomain the site is running flawless but when I redirect back to root domain memory goes high. Please can someone guide whats the issue.

I checked in htop PHP-FM is taking consuming maximum memory with 0 traffic and it subdomain parallelly its normal.

Few important notes: I use Cloudflare even turning I am under attack doesn't helps. Can someone please help me with this

sv flag
Welcome to ServerFault. Your question may be closed due to lack of specifics. Please provide as much info as possible, such as memory available in the server, how long does the (memory) spike occur, how do you define / find memory spike, etc. https://github.com/pixelb/ps_mem/blob/master/ps_mem.py can be used to find memory usage to some extend. You may also use https://wordpress.org/plugins/query-monitor/ to get insights about WordPress in general.
Score:0
gp flag
Tim

High memory usage isn't always problem - memory is there to be used so the OS / software uses it as a cache. It's only a problem if the OS starts killing processes because it doesn't have enough memory.

You've really given us very little information, not even "top" output, so what I've put below is a guess.

In your case I suspect you have configured PHP to have more threads available than your available memory capacity. You should make sure you haven't over-allocated memory to each PHP worker and that you don't have too many workers configured.

On Ubuntu my config is at /etc/php/7.4/fpm/pool.d/www.conf . The key entries as I've configured for my server with 512MB RAM and 1GB swap is below.

pm = dynamic
pm.max_children = 3
pm.start_servers = 1
pm.min_spare_servers = 1
pm.max_spare_servers = 1

You can alternately use "pm = ondemand" which means no PHP workers are created until they're required. That's only useful for very low volume websites where response time isn't too important.

In your php.ini (which for me is /etc/php/7.4/fpm/php.ini) you can configure the memory limit per worker thread. This is how much memory each worker thread is given - adjust it as low as you can while your website still works. This is configured for Wordpress.

memory_limit = 128M
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.