504/502 Errors on high traffic website

Posted in: Newsmag
Post count: 7

I have a problem with the backend of the theme that causes the 504/502 errors on the site when we get a spike in traffic. The backend and the front of the site will become unresponsive for a couple minutes at the time due to this. We have it hosted on a premium tier 1 plan with WP Engine so the server shouldn’t be an issue. We get about 1.5 million page views a month and climbing.

This is the ticket reply I got from the tech team at WP Engine:

_________________________________________________________________________________________________
Hey there, Sasha!

It was a pleasure speaking with you over the phone earlier! I truly apologize for all of the delay!

Upon investigation into the time the server load spiked, I see the only install affected with 504/502 errors was *******. I can see /admin-ajax.php was hit about 21 times in a minute on that install. This is quite high and will definitely cause 504/502 errors. The highest hits I calculated in a 10 minute window:

160 [action] => td_ajax_update_views
54 [action] => heartbeat
40 [action] => td_ajax_block
I searched in your plugins/themes to see what could be causing this high of an admin-ajax hit and found the following paths:

wp-content/themes/Newsmag/includes/wp_booster/td_ajax.php

532:function td_ajax_update_views() {
555:add_action( ‘wp_ajax_nopriv_td_ajax_update_views’, ‘td_ajax_update_views’ );
556:add_action( ‘wp_ajax_td_ajax_update_views’, ‘td_ajax_update_views’ );
wp-content/themes/Newsmag/js/tagdiv_theme.js

3249: page_type_action = ‘td_ajax_update_views’;
What I recommend is taking these details to a developer or the theme developer to limit the admin-ajax.php requests way down.”

_________________________________________________________________________________________________

How can we get this sorted out?

thank you,

Sasha

Post count: 6600

Hi,

This happens when you use the ajax view count: http://screencast.com/t/Wt67qXEX49
We don’t recommend using this feature if you have a high traffic on your website as this ajax counter makes a request to your host each time a page loads.

Thanks

Post count: 9544

General note:
with a very high traffic site, you should consider not using any “hit counter” which has to query/write to dbase every page load/refresh. It’s better, in our experience with one of our sites with large traffic, to use local hosted stats on server side (e.g., Webtrends, Piwik, or similar), or google analytics, or similar.

This is also why most hosting companies now ban “wp-postviews” plugin for same reason.

Post count: 7

Thank you,

We have disabled the ajax count and have seen some improvement in speed, but still not as fast as we would want it to be. We will run another server test either today or tomorrow to se if there is less calls…

I’ll update when we find out

Post count: 128

I am having the same issue. My webhost said the same. I have disabled it and like you have had some improvement but still not working properly.

Post count: 217

On some days I have this issue too.

Post count: 7909

Hi,

Please provide more details about some server settings that could affect this, so we can also check it on our side.
Also do you use a cache plugin? Did you optimized your site using this guide? – https://forum.tagdiv.com/how-to-make-the-site-faster/

Please make sure you meet the theme server requirements – https://forum.tagdiv.com/newsmag-requirements-for-newsmag/ and also check the System Status parameters – https://forum.tagdiv.com/system-status-parameters-guide/ especially the php memory.

To improve your server response time you can try to reduce the number of queries (fewer plugins, fewer blocks on page, reduce the elements which use ajax requests/pagination like mega menus/load more/infinite load). To improve the loading speed look the MySQL query cache: http://dev.mysql.com/doc/refman/5.1/en/query-cache.html we also use it on our demo.

Please create your own topics as this one was created one year ago..

Thanks!

Viewing 7 posts - 1 through 7 (of 7 total)
The forum ‘Newsmag’ is closed to new topics and replies.