WordPress.org

Ready to get started?Download WordPress

Forums

Slow WordPress - it drove me crazy! (29 posts)

  1. fuocorav
    Member
    Posted 6 years ago #

    It took me three weeks and I am trying to get it up and running. Yesterday it's finally running smoothly. Now, I tried to create a custom page template and it threw WordPress into a slow crawl. I now have to face that I have to abandon WordPress for good because no one was able to help me.

    http://csdr-cde.ca.gov

    Why is it slow? I installed LiteSpeed server and only has one mysql db for that WordPress blog.

  2. Samuel Wood (Otto)
    Tech Ninja
    Posted 6 years ago #

    It's hard to say exactly why anything is slow, but I doubt that it got slower just because you made a page template.

    You could try using WP-Super-Cache. That always gives good speedups.

    You can also find out if it's taking a long time on the database by adding this to your theme's footer.php file:
    <!-- <?php echo get_num_queries(); ?> queries. <?php timer_stop(1); ?> seconds. -->

    Then load the page and View Source on it. Look at the bottom to find the number of queries run and how long page generation actually took.

  3. Len Kutchma
    Member
    Posted 6 years ago #

    You also have an unclosed <h1> tag for Multimedia and a whole whack of unclosed images tags.

  4. fuocorav
    Member
    Posted 6 years ago #

    I'll check it out. Yesterday and today, it was running fast. It was on LiteSpeed (LSWS), very fast web server.

    Then I attempted to create a page template that shows posts by a specific category. Then, it created havoc.

    PHP works fine (I tested other non-WP pages and it's loading fast).

    I looked at mysql runtime status and found this line in red:

    The number of requests to read a row based on a fixed position. This is high if you are doing a lot of queries that require sorting of the result. You probably have a lot of queries that require MySQL to scan whole tables or you have joins that don't use keys properly.

    it's now 1774K.

    The queries/seconds is

    "<!-- 13 queries. 40.170 seconds. -->"

  5. fuocorav
    Member
    Posted 6 years ago #

    Even when I logged in Dashboard, it's slow.

  6. Samuel Wood (Otto)
    Tech Ninja
    Posted 6 years ago #

    What version of WordPress do you have? Make sure you upgrade to 2.3.2. There were some bad joins in 2.3 that would cause massive slowdowns in certain circumstances.

  7. fuocorav
    Member
    Posted 6 years ago #

    it's 2.3.2

  8. fuocorav
    Member
    Posted 6 years ago #

    I looked all over for the solution and came across this topic:

    http://wordpress.org/support/topic/107389?replies=14#post-674586

    Since it runs on LiteSpeed server, I have no idea on how to solve it.

    I recalled the same problem when I upgraded from 1.5 to 2.1 and it's the same problem so I have to revert to 2.04 before overhauling the web server to run on CentOS and Litespeed.

  9. Samuel Wood (Otto)
    Tech Ninja
    Posted 6 years ago #

    Well, the majority of your time is in the page generation. 40 seconds is too long for only 13 queries. Since your database server is giving you messages too, I'd try to find out what queries are taking so much time.

    You can see how long each query is taking with a few modifications.

    In your wp-config.php file, add this line of code to the top:
    define('SAVEQUERIES', true);

    Then, in the theme's footer.php file, you can do this to dump all the queries and how long they took:

    if (SAVEQUERIES) {
    global $wpdb;
    echo '<!--\n';
    print_r($wpdb->queries);
    echo '\n--!>';
    }

    Then looking at the source of the page will show all the queries and a number showing how long they took.

    After you do this, turn the SAVEQUERIES back off by setting it to false in the wp-config.php file. You don't want it to spit out the queries all the time.

  10. Samuel Wood (Otto)
    Tech Ninja
    Posted 6 years ago #

    Looks like we crossposted.

    If it's a wp-cron problem (possible), then you can possibly manually clear it up quickly by doing the following:

    Remove or comment out this line from wp-cron.php:

    if ( $_GET['check'] != wp_hash('187425') )
    	exit;

    Then call wp-cron.php in your browser:
    http://example.com/blog/wp-cron.php

    That will let it run, and clear out any waiting wp-cron jobs. It's not a fix by any means, but it may eliminate the problem quickly, letting you get the site working and figure out the underlying cause.

  11. fuocorav
    Member
    Posted 6 years ago #

    if (SAVEQUERIES) {
    global $wpdb;
    echo '<!--\n';
    print_r($wpdb->queries);
    echo '\n--!>';
    }

    did not work...it just outputs like the text above. No results. I'm doing your second suggestion, commenting out the line including wp_hash.

    I'm still waiting for it to be loading. . .

  12. fuocorav
    Member
    Posted 6 years ago #

    <!-- 13 queries. 0.133 seconds. -->

    bingo!

    Thank you so much for saving my face at my work! I was the one who fought hard to get WP to run a school's website instead on IIS MS Server 2003.

  13. fuocorav
    Member
    Posted 6 years ago #

    Wait a minute...I just made a change in one post then I saved it. Guess what? It's still slow.

    again:

    <!-- 12 queries. 40.156 seconds. -->

    I'll try loading wp-cron.php again.

    What's causing this?

  14. fuocorav
    Member
    Posted 6 years ago #

    I run wp-cron.php again and it's timed out, then I reloaded it again and the website is fast again.

  15. Samuel Wood (Otto)
    Tech Ninja
    Posted 6 years ago #

    When you make a post or make any sort of change to a post, this creates a job that needs to be processed by wp-cron. The reason the site is slow is because it's trying to hit wp-cron and cannot for whatever reason.

    Manually running wp-cron lets the job process and clears it out. When there's no jobs, it doesn't try to hit wp-cron. Thus making the site fast again, until you do something else that triggers a wp-cron job.

    So, you need to determine why your site cannot open a connection to itself. This may be DNS incorrectly configured on the server or any of a dozen other things.

    Create a new PHP file and put this in it:

    <?php
    $argyle = fsockopen( 'example.com', 80, $errno, $errstr, 0.01 );
    if ( $argyle ) {
    fputs( $argyle, "GET /wp-cron.php HTTP/1.0\r\n"
    	. "Host: example.com\r\n\r\n" );
    echo "Success sending the GET.\n";
    } else {
    echo "Error: $errstr ($errno)\n";
    }
    ?>

    Run that. If it outputs an error message, then that information might help. Obviously, replace example.com with your own server name.

  16. fuocorav
    Member
    Posted 6 years ago #

    Hi Otto42,

    You're correct that it's slow when creating a post. I have to reload wp-cron.php manually. Last night, I attempted to create a post and it was slow. So, I reloaded wp_cron.php manually and it was fast again, but I tried to delete a post and I could not do that. I have to trick it into saving it as a draft. It'll disappear from the blog, but it won't be deleted even I deleted it a few times. Later after dinner, it disappeared on its own. Maybe that helps determine the problem.

    Now, I have a theory: the school's blade server cannot get any "outgoing" HTTP requests. From the terminal, I cannot ping google.com, but the webserver is up and running. It appears that for this school, the switcher was set for the server to be opened only for "incoming HTTP requests", not "outgoing" internet access or "outgoing" http requests.

    I assume that when I create a post, it attempts:

    1) to send out pings
    2) to send out a job to wp-cron.php
    3) it could be more???

    I noticed that the google xml sitemaps plug in cannot reach google and other search engines. (I already disabled it).

    I did empty out the ping services (addresses) and disable ping options as I can.

    Otto42, I did try to use your php script but I got this:

    Parse error: syntax error, unexpected T_VARIABLE in /opt/lsws/DEFAULT/html/test.php on line 2

    I do appreciate your big help and efforts!

  17. Samuel Wood (Otto)
    Tech Ninja
    Posted 6 years ago #

    Doh. Typo. I corrected the above code, try it again.

    Also, your explanation doesn't make much sense as far as it goes. You can't really block outgoing http requests like that, or at least you can't do it easily, and anyway there's no reason to do that as it's not any more secure.

    However, you say that you can't ping google.com which is more interesting. It suggests to me that the server doesn't have DNS setup. If this is a Linux box, run "type /etc/resolv.conf" on it, and see if any nameservers are listed. If not, then they may just need to be configured.

  18. fuocorav
    Member
    Posted 6 years ago #

    I got the message:

    Warning: fsockopen() [function.fsockopen]: php_network_getaddresses: getaddrinfo failed: Temporary failure in name resolution in /opt/lsws/DEFAULT/html/test.php on line 2

    Warning: fsockopen() [function.fsockopen]: unable to connect to csdr-cde.ca.gov:80 (Unknown error) in /opt/lsws/DEFAULT/html/test.php on line 2
    Error: (172270024)

    I did run /etc/resolv.conf but permission denied. I'll ask a friend to help me out on getting permission on /etc/resolv.conf

  19. fuocorav
    Member
    Posted 6 years ago #

    [root@localhost etc]# cat /etc/resolv.conf

    search localdomain
    nameserver 10.7.1.3

  20. fuocorav
    Member
    Posted 6 years ago #

    One more thing: I have no control over how the switcher is set up. I have to wait until next week to discuss it with the IT guy who may block outgoing port 80 traffic. If it's not an issue, fine.

  21. Samuel Wood (Otto)
    Tech Ninja
    Posted 6 years ago #

    One more thing: I have no control over how the switcher is set up. I have to wait until next week to discuss it with the IT guy who may block outgoing port 80 traffic. If it's not an issue, fine.

    It's not a port 80 block. Your own error proves that:

    Warning: fsockopen() [function.fsockopen]: php_network_getaddresses: getaddrinfo failed: Temporary failure in name resolution in /opt/lsws/DEFAULT/html/test.php on line 2

    That means it's a DNS failure. It could not look up "csdr-cde.ca.gov" in your DNS server. This explains why wp-cron fails normally. It's trying to make a connection to itself to start wp-cron, but it can't find its own address, so it fails repeatedly, causing the slowdown.

    You need your IT guy to check the DNS settings on that box and make sure they are correct. WordPress requires servers that are capable of looking up their own addresses.

  22. fuocorav
    Member
    Posted 6 years ago #

    Otto, I see. Thanks! I'll discuss it with him. Hopefully, he can fix it.

  23. fuocorav
    Member
    Posted 6 years ago #

    Hi,

    We are still figuring it out. DNS is in DMZ zone and so it's hard to get the web server to communicate with the DNS server.

    i wonder if I use IP address in the WP-options for WP address and Blog address will be using the domain name. Will it resolve the issue?

    I do value your inputs and help...that's what makes WP community so great!

  24. AllyV4
    Member
    Posted 5 years ago #

    Hi,

    I have the same problem on my site where I'm the only one to work on and surf on for now (password protected site) until it's completely ready.

    The big problem is that my homepage needs 20 seconds to display!

    I've done what Otto42 told and yes I can call wp-cron.php in my browser.

    I also have tried to desactivate plugins one by one but it was the same.

    I hope I could fix this problem because this is the last thing I have to fix to launch my site :-(

  25. Anonymous
    Unregistered
    Posted 5 years ago #

    Hi,

    i also have this problem, but there is no reaction on calling wt-cron.php and i've checked also (with that php-code Otto42 posted) DNS. Result:

    Success sending the GET.

    executing wp_cron() takes 20 seconds - I have added a return; as first line of the function and the site is fast as usual. But I dont think i have diabled a "dummy"-function - So i need help to locate the problem.

    This behavier just started a few days ago, without a known reason.

    Thanks for help.

    Chrif

  26. kwbridge
    Member
    Posted 5 years ago #

    My friend can not schedule posts in v 2.6.1 and I am assuming that this is an issue between wp-cron.php and the server. I made a file with the code mentioned above with the required changes

    <?php
    $argyle = fsockopen( 'example.com', 80, $errno, $errstr, 0.01 );
    if ( $argyle ) {
    fputs( $argyle, "GET /wp-cron.php HTTP/1.0\r\n"
    . "Host: example.com\r\n\r\n" );
    echo "Success sending the GET.\n";
    } else {
    echo "Error: $errstr ($errno)\n";
    }
    ?>

    and tested this on her host and on mine - I am running the same version of WordPress. On her host I got Error 110 Connection Timeout. On mine where I can schedule posts I got 'Success Sending the Get'.

    What I want to know is what is the best way to explain this to the host so they don't automatically say it's a wordpress problem?

    Thanks

  27. wild_eep
    Member
    Posted 5 years ago #

    I ran the script and received:
    Error: Connection timed out (110)

    My theory is that my wp-cron jobs aren't running, even though I have sufficient traffic to trigger them. (~1400 visits/day).

    My symptoms are: The stats module in bStats v4 don't stay current, pings do not work, and future-publishing of stories does not work.

  28. baal666
    Member
    Posted 5 years ago #

    I also ran the script and also got:

    Error: Connection timed out (110)

    My site is very slow. I tried to run the wp-cron.php and it helped, but as others pointed out it can take like 20 to 40 seconds to post a text! This is crazy.

    Anyone can help?

    Thanks!

  29. hillkirt
    Member
    Posted 5 years ago #

    I have two frustrating problems with WordPress.

    1) my first post is displayed in its entirety on the opening page and when I click the archives, categories or recent entries I get the first paragraph of the post with no way to read the rest.

    2) it is running impossibly slow (I'll be reading the other messages to see if any of the replies help)

    Thank-you,
    Kirt

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.