W3TC + CDN spikes RAM usage and slower image uploads
-
After enabling CDN with Stackpath on W3TC, I noticing a constant 15% increase in memory usage on the server, and uploading images to a new post using the media uploader takes about 10 to 15 seconds, when before it used to take 1 to 3 seconds.
1. Are these expected behaviors?
2. Why is this happening?
3. Is there any way to fix this?
-
Hello @wppit
I am sorry about the issue you are experiencing and I am happy to assist you with this.
Are you one shared server? Are you still experiencing the issue?
There is a possibility that you got some spikes when uploading files to CDN.
Can you also please share the settings in Performance>CND>Advanced and your website URL if convenient?
Thanks!Yes, I’m still experiencing the same issue and worse, since today the CPU spiked about 17% for several hours tool, and the RAM also spiked a little more.
I’m using a virtual machine.
I also noticed that I/Os are also spiking.
Website is pureinfotech.com, only setting enabled on “Performance>CDN>Advanced” is:
– “Disabled CDN for the following roles” and “Administrator is checked”Then all defaults. For example,
– wp-includes file types to upload: *.css;*.js;*.gif;*.png;*.jpg;*.xml
– Theme file types to upload: *.css;*.js;*.gif;*.png;*.jpg;*.ico;*.ttf;*.otf,*.woff,*.less
– Custom file list:
favicon.ico
{wp_content_dir}/gallery/*
{wp_content_dir}/uploads/avatars/*
{plugins_dir}/wordpress-seo/css/xml-sitemap.xsl
{plugins_dir}/wp-minify/min*
{plugins_dir}/*.js
{plugins_dir}/*.css
{plugins_dir}/*.gif
{plugins_dir}/*.jpg
{plugins_dir}/*.png
– Rejected files:
{uploads_dir}/wpcf7_captcha/*
{uploads_dir}/imagerotator.swf
{plugins_dir}/wp-fb-autoconnect/facebook-platform/channel.htmlAll these settings are disabled:
– Only purge CDN manually
– Disable CDN on SSL pages
– Use CDN links for the Media Library on admin pages
– Add CORS header
– Set cookie domain to “pureinfotech.com”– File types to import: (not configured)
– Rejected user agents: (not configured)Hello @wppit
Thank you for the info. The settings are looking fine.
Judging by your recent posts, you are frequently experiencing the CPU/RAM usage issues.
Does the issue persist if the CDN is disabled? Also, it would be a good idea to disable other plugins and leave W3 Total Cache enabled, just to see if the issue is still there.
Thank you!It is very common when WP installation is created but missing Firewall protection. They can abuse WP installation without even login. You will see CPU spike each day due to updates but abuse works without CPU spike. Each 2 minutes it will be login attempt and if not blocked by Firewall it will start to consume RAM. In the first stage it will use all your resources but this is not the end. When you do not have SWAP, it will collapse your server. When your SWAP is exhausted it will collapse in any way. Just place Sucuri which is free plugin. You will see each 2 minutes login attempt. Maybe this is the cause.
@bcvcbhqyxcgakhh thanks for your advice, but the problem is that it started happening exactly when I enabled the CDN feature of W3TC.
@vmarko I’m testing again disabling the CDN, but for the record this problem started way back, and at time I thought it was something else, some I moved the website to a new server, and it appears that I forgot to enable the cdn feature, and while it was disabled the server didn’t spike the extra ram. Then when I realized that cdn wasn’t enabled, I turned it on again, and immediately the ram spiked around 15% and stayed that way.
@vmarko Here are the test results:
– RAM 26% with w3tc plugin disabled, CPU 12%
– RAM 32% with w3tc plugin enabled and NOT CDN, CPU 8%
– RAM 44% with w3tc + CDN (Theme files, media library attachments, CSS, JS files etc will quickly for site visitors.) enabled, CPU 6%CPU percentage is quite low. Disable all checkboxes for w3tc and see what happens. When nothing happens install https://wp-rocket.me/. Maybe this is as a testing phase.
Hello @wppit
Thank you for the information.
Can you please share your server specs? And one more thing is Stackpath CDN enabled using API or Generic mirror?
Thanks!@vmarko thanks for the reply.
The server has 2 cores and 4GB of RAM.
I believe it’s using the API optin. When I clicked the authorize button, I have to enter the API information.
Thanks,1. It is important also SWAP value as 4GB of RAM is very low for WP and
2. you need to post also -/+ buffers/cache
How much of the used memory has been put up to use as buffers and cache. How much memory is truly being used by processes you are running?
-/+ buffers/cache
3. innodb_buffer_pool_size is amount?So, many variables are missing and w3tc is probably not a cause.
- This reply was modified 4 years, 7 months ago by bcvcbhqyxcgakhh.
- This reply was modified 4 years, 7 months ago by bcvcbhqyxcgakhh.
- This reply was modified 4 years, 7 months ago by bcvcbhqyxcgakhh.
- This reply was modified 4 years, 7 months ago by bcvcbhqyxcgakhh.
- This reply was modified 4 years, 7 months ago by bcvcbhqyxcgakhh.
Hello @wppit
Thank you @bcvcbhqyxcgakhh for your suggestions and I believe you are correct.
@wppit Is the RAM usage declining over time or does it stay at 44%?
Have you tried enabling Stackpath CDN using the Generic mirror and Replace default hostname with the stack path URL?
Thanks!@bcvcbhqyxcgakhh Although swap is important, vps companies advise you against swap on SSDs as it’ll cause performance issue over time.
Also, I don’t know what’s the buffers/cache reference means. I don’t know if they’re talking about the w3tc or something on the server. In addition, I don’t understand innodb_buffer_pool_size…
It’s early to tell, but I think I MIGHT have found the memory problem. It might be a piece of code in the theme, I’m trying to fix it. However, images still take a long time about 7 to 10 seconds to upload, when without the plugin upload in 1 or 2 seconds.
Does w3tc sends the images to the cdn as they’re uploaded? Or after it’s published and it gets cached?
Hello @wppit
Yes W3 Total cache automatically uploads images to CDN.
THanks@bcvcbhqyxcgakhh during the upload by the user or after the post is saved or published.
thanks,
- The topic ‘W3TC + CDN spikes RAM usage and slower image uploads’ is closed to new replies.