Support » How-To and Troubleshooting » P2 theme causing very high admin-ajax.php usage

P2 theme causing very high admin-ajax.php usage

  • hal9000


    I have had a warning from my hosts that my site is hammering the cpu (between 60-80%) on a shared host and in the logs it seems to be down to the wp-admin/admin-ajax.hp file.
    This seems to be involved with comment request from the p2 theme (as far as i can tell from the log)
    I know the file is ok as the hashes for the file on my server are exactly the same as from the wp2.84 install file.

    So has anyone got any ideas?
    Does this get used a lot on the P2 theme as when my site gets busy and the server get hammered this won’t be acceptable and sustainable by the server hosts. (Xilo)
    I do have a set of about 20 plugins and the theme isn’t standard (www.aimb.ws) but this seems to happen even with almost all the plugins disabled.
    Is there anyway of monitoring which files get used lots other than the raw log files.

Viewing 15 replies - 1 through 15 (of 22 total)
  • hal9000


    It seems that every 15 or so seconds (according to fiddler) the admin-ajax.php checks for new comments and new posts.
    If i had say 20 users sat on the page this would give the server a fair bit of hammering even though the users are not doing anything, right.
    Is this an inherent part of the P2 theme that nothing can be done against

    go to your functions.php file and delete these two lines:

    add_action( 'wp_ajax_prologue_latest_posts', 'prologue_latest_posts' ); // Load new posts
    add_action( 'wp_ajax_prologue_latest_comments', 'prologue_latest_comments' ); //check for new comments and loads comments into widget


    go to your functions.php file and delete these two lines

    Tried it but the only problem is that new post and replies don’t appear until the page is refreshed…



    cool that is a plan if the host gets a bit upset.
    Thanks texet that is a good backup
    as gene says this is a dirty fix but not a complete solution as it doesnt function the same.

    althought people are used to pressing f5 to refresh the page which is ok i guess

    Hi Hal, have you checked to see if your server resources have gone down considerably since you applied texet’s fix?


    althought people are used to pressing f5 to refresh the page

    Hmm, After applying texet’s fix, I wonder if there would be some code that could be added added that would refresh the page after clicking on “Post it”…



    nope not tried it yet – just about to go on hols to south africa for weeks

    @hal: Have a great vacation!



    Search for “var updateRate” in functions.php.
    You’ll see a number. This is the frequency Ajax would check for updates in milliseconds. Update the number to something larger.

    [signature moderated Please read the Forum Rules]

    Thanks smallwei, I’ll do that.


    I have changed the updateRate from 30000 (30 seconds) to 3600000 (1 hour) but can still see lurking visitors accessing the same page every 30 seconds.

    Is the file cached client side ?

    Mark, how did you find out the accessing time? Did you use firebug? How about when you try it yourself? Is it still hitting it every 30 sec?

    The file shouldn’t be cached as far as I know.

    – smallwei

    Thanks smallwei , I am using tail to watch the logs via ssh.

    Our apache2 was set to not log our local connections but when disabled I can see all the local machines accessing every 30 seconds just like the outside visitors.

    Here is just one client example :-

    mnhm-5f74c811.pool.mediaways.net - - [19/Nov/2009:08:08:14 +0100]
    mnhm-5f74c811.pool.mediaways.net - - [19/Nov/2009:08:08:44 +0100]
    mnhm-5f74c811.pool.mediaways.net - - [19/Nov/2009:08:09:14 +0100]
    mnhm-5f74c811.pool.mediaways.net - - [19/Nov/2009:08:09:44 +0100]
    mnhm-5f74c811.pool.mediaways.net - - [19/Nov/2009:08:10:15 +0100]

    I am using WordPress-MU if that makes any difference to the way themes are shared / handled.

    It’s possible the reason is due to WP-MU.
    Sorry I don’t have WP-MU installed so can’t really tell you exactly.

    – smallwei

    OK , well the constant refreshing doesn’t appear to be a problem at the moment as my site isn’t busy , but its something to bear in mind.

Viewing 15 replies - 1 through 15 (of 22 total)
  • The topic ‘P2 theme causing very high admin-ajax.php usage’ is closed to new replies.