WordPress.org

Ready to get started?Download WordPress

Forums

Help! Server load problems with WordPress! (28 posts)

  1. WPChina
    Member
    Posted 8 years ago #

    Help! I host my websites at Westhost.com, and I have been there for about 7 years. Recently, we changed 6 of our websites from different CMS into WordPress. Somce of those other websites used PHPNuke, some used MovableType, and one used a home-grown CMS. Now all 6 use WordPress

    In the last few months that I have changed all those wbesites to WordPress, I have been receiving warnings from Westhost that my websites have been using too many system resources on the server and they are threatening to shut me down! Of the 6 WordPress websites I run, 4 have received multiple warnings.

    Now, over the last few months, none of my websites have seen a dramatic rise in traffic. And, I still have one website (my largest) which gets about 50,000 page impressions a day (quite a lot for a blog), but that is NOT using WordPress and it is causing no server load problems. it is humming along fine with minimal problems to Westhost.

    The problem is WordPress. I have seen others on theis board complain about similar problems. It seems to use lots of resources when accessing the database.

    Here is a print of my logs to show where the problems lie:

    - Apache

    2 PID USER %CPU S PR NI TTY #C TIME+ COMMAND
    22725 websitename 51.6 R 25 0 ? 0 0:05.85 /usr/sbin/httpd -DHAVE_PROXY -DHAVE_ACCESS -DHAVE_ACTIONS -DHAVE_ALIAS -DHAVE_ASIS -D
    19471 websitename 5.3 R 15 0 ? 0 1:44.52 /usr/sbin/httpd -DHAVE_PROXY -DHAVE_ACCESS -DHAVE_ACTIONS -DHAVE_ALIAS -DHAVE_ASIS -D
    22908 websitename 5.1 R 22 5 pts/0 0 0:00.27 /usr/local/mysql/bin/mysqld --defaults-extra-file=/usr/local/mysql/data/my.cnf --base
    19235 websitename 4.2 R 15 0 ? 1 2:01.89 /usr/sbin/httpd -DHAVE_PROXY -DHAVE_ACCESS -DHAVE_ACTIONS -DHAVE_ALIAS -DHAVE_ASIS -D
    22906 websitename 2.6 S 21 5 pts/0 0 0:00.14 /usr/local/mysql/bin/mysqld --defaults-extra-file=/usr/local/mysql/data/my.cnf --base
    26731 websitename 0.0 R 15 0 ? 1 0:00.35 /usr/sbin/httpd -DHAVE_PROXY -DHAVE_ACCESS -DHAVE_ACTIONS -DHAVE_ALIAS -DHAVE_ASIS -D
    18795 websitename 0.0 R 20 5 pts/0 1 0:00.07 /usr/local/mysql/bin/mysqld --defaults-extra-file=/usr/local/mysql/data/my.cnf --base
    18749 websitename 0.0 S 17 0 pts/0 0 0:00.03 /bin/sh /usr/local/mysql/bin/mysqld_safe --datadir=/var/lib/mysql --pid-file=/var/run
    18792 websitename 0.0 S 20 5 pts/0 1 0:00.03 /usr/local/mysql/bin/mysqld --defaults-extra-file=/usr/local/mysql/data/my.cnf --base
    18794 websitename 0.0 S 20 5 pts/0 0 0:00.03 /usr/local/mysql/bin/mysqld --defaults-extra-file=/usr/local/mysql/data/my.cnf --base

    Does anyone have suggestions or is there a plan for the future to remedy this?

    tks!

  2. davidchait
    Member
    Posted 8 years ago #

    - if you aren't already running WP-Cache, do.
    - if you have WP's native 'object cache' enabled, disable it.
    - if you have plugins doing heavy queries or dynamic generation, need to look into them further. WP-Cache will 'eliminate' certain dynamicism from your site without rework..

    -d

  3. WPChina
    Member
    Posted 8 years ago #

    Ok, thank you, I just found and installed the WP-Cache plugin.

    For native object enabled, where can I find that? Is that in the wp-config.php? If so, I am using version 2.0.3, and that does not have it enabled, right? Therefore I needn't worry about it, right?

    I will monitor this first site for a few hours and then make changes to my other blogs using WP. I appreciate your great help!

  4. WPChina
    Member
    Posted 8 years ago #

    Sorry David, you answered me here at http://wordpress.org/support/topic/52452

    but I am confused when I put it up against the info in this thread.

    Therefore, please bear with me as I try to get this straightened out--I don't want to cause my server too much extra stress by doing the wrong thing.

    I have 2.0.3 installed. I also now have WP-Cache plugin installed and it seems to be running ok. In wp-config.php I do not have define('DISABLE_CACHE', true);.

    My question for you is this: Since I have WP-Cache running, should I add define('DISABLE_CACHE', true); to my wp-config.php, or should I just keep it the same way?

    Currently all I have is:
    define('WP_CACHE', true); //Added by WP-Cache Manager

    Thank you for clarification.

  5. davidchait
    Member
    Posted 8 years ago #

    I believe under 2.0.3, DISABLE_CACHE (which refers to the INTERNAL object cache) is needed. I think it was finally defaulted OFF in 2.0.4.

    WP_CACHE on the other hand refers to, well, WP-Cache, the plugin....

    -d

  6. WPChina
    Member
    Posted 8 years ago #

    Ok, this is what my wp-config.php looks like now after I installed WP-Cache:

    define('WP_CACHE', true); //Added by WP-Cache Manager
    define('DB_NAME', 'database'); // The name of the database
    define('DB_USER', 'username'); // Your MySQL username
    define('DB_PASSWORD', 'password'); // ...and password
    define('DB_HOST', 'localhost'); // 99% chance you won't need to change this value
    define('DISABLE_CACHE', true);

    Does the above look correct?

    But my host says I am using 3.5% of the server and they need me to get down to about 2%. My blog only has about 4000 pageviews a day and I am not having these problems with my website that has 50,000 pageviews a day or with one of my old MT blogs with 3000 pageviews. I really really like WP and I want to find a solution to this.

  7. davidchait
    Member
    Posted 8 years ago #

    you are using 3.5% of the server over what time period? if you've turned on wp-cache (that is, you went into the options panel for it, made sure it is on, says it is caching pages, should have some count of cached pages listed...), and disabled the internal cache, your server impact should have dropped off. But, if they're taking an aggregate over a number of dats, you only JUST installed this stuff in the past 48 hours! They need to give it another day or two at least to 'settle in', and make sure they take a snapshot over the course of a day and not a peak timeslice midday or something silly. ;)

    -d

  8. Chris_K
    Member
    Posted 8 years ago #

    Some good stuff in this thread: http://wordpress.org/support/topic/70303?replies=49

  9. oncidium
    Member
    Posted 8 years ago #

    I am having a similar problem...don't think it's the number of visits on my but connections staying open. Any other ideas besides what has already been mentioned here?

  10. WPChina
    Member
    Posted 8 years ago #

    Ok, Westhost responded with this messsage to me:

    It looks like your apache server was restarted about 9.5 hours ago and since then your apache processes have produced a 4.52% CPU load. I believe this is about what it was when I first e-mailed you. Yesterday afternoon it was around 3.3%.

    I ran your home page through a web site analysis tool (http://www.websiteoptimization.com/services/analyze/) and it gave a few suggestions for reducing the amount of work that Apache has to do to serve your home page. You might check that out. The biggest problems I saw were the total size of your images and the total number of http requests that had to be made to load the page.

    When I ran my site through that page, there were many images, but I have a 95% of my images served from a dedicated ad server that is not affiliated with my VPS in any way (it's in another country, too). Most of those HTTP requests were not to my VPS, but rather to my other dedicated server.

    The bottom of my pages now say:
    <!-- Dynamic Page Served (once) in 4.338 seconds -->
    <!-- Cached page served by WP-Cache -->

    So, all seems well from my end, but I'm still eating CPU. Aargh....

  11. yosemite
    Member
    Posted 8 years ago #

    Geez. Maybe they need more hamsters in that server? Have they been fed?

  12. davidchait
    Member
    Posted 8 years ago #

    Color me confused. If you're on a VPS, then there's no such thing as using too much server load. The VPS should be capped, and that's that.

    If you are using 4% of the CPU in apache, I'd like to know how many pages were served up in those 9.5 hours! And is the time in apache or in PHP? (if they can tell) And is the machine properly tuned to start with, i.e., lots of ram, well sized disk/file cache? I assume that time doesn't include SQL.

    We'd need to know a LOT more to help you beyond this point. Once you have WP-Cache in place, that generally pulls a site below the radar. So without seeing your primary site, all of the sites you host on that server, and stats for that 9.5h period for each of the sites, not sure we can be of much help. ;)

    -d

  13. WPChina
    Member
    Posted 8 years ago #

    Would this help:

    Server Version: Apache/1.3.27 (Unix) (Red-Hat/Linux) PHP/5.0.3
    Server Built: Sep 2 2003 09:16:44
    Current Time: Friday, 23-Jun-2006 17:26:05 MDT
    Restart Time: Thursday, 22-Jun-2006 23:00:44 MDT
    Parent Server Generation: 0
    Server uptime: 18 hours 25 minutes 21 seconds
    Total accesses: 9781 - Total Traffic: 27.4 MB
    CPU Usage: u1817.37 s62.62 cu.16 cs.14 - 2.84% CPU load
    .147 requests/sec - 432 B/second - 2932 B/request
    2 requests currently being processed, 2 idle servers

  14. davidchait
    Member
    Posted 8 years ago #

    Well, that shows 2.8% load, which is better. And only approx 1GB xfer over a monet, if I do some rough math correctly... And a request every 8s, which doesn't sound high at all given that a single user could generate at least a handful of requests (meaning maybe 2 or 3 users per minute).

    I still don't know what the CPU load is really coming from. But even with 3% load, they could have 30 other users working as heavily as you, and still not start over-taxing the server necessarily...

    -d

  15. alemcherry1
    Member
    Posted 8 years ago #

    are you on a VPN or shared host? I am surprised to hear that even a site with 50k page views doesnt get banned on a shared host!

  16. WPChina
    Member
    Posted 8 years ago #

    alemcherry1: I am on a VPS (virtual private server). This blog only has about 4000 page views a day. When I talked before about one of my swebsites having 50,000 pageviews, that is also on a VPS at Westhost, but it is not using WordPress and it hardly uses any server resources (though it eats lots of bandwidth).

    Now it shows:

    Server Version: Apache/1.3.27 (Unix) (Red-Hat/Linux) PHP/5.0.3
    Server Built: Sep 2 2003 09:16:44
    Current Time: Saturday, 24-Jun-2006 16:48:32 MDT
    Restart Time: Thursday, 22-Jun-2006 23:00:44 MDT
    Parent Server Generation: 0
    Server uptime: 1 day 17 hours 47 minutes 48 seconds
    Total accesses: 20484 - Total Traffic: 45.8 MB
    CPU Usage: u3268.24 s109.06 cu.2 cs.16 - 2.24% CPU load
    .136 requests/sec - 318 B/second - 2342 B/request
    1 requests currently being processed, 1 idle servers

    So now I am only on 2.24% CPU load, though yesterday when I checked a few times I was between 2.2% and 3.1% at various times. My WP-Cache is working well, it seems, and here are a list of the other plugins I have:

    Customizable Post Listings 1.1
    Custom Query String 2.7
    Custom Post Templates 0.9
    WP-EMail 2.04
    Front Page Categories 0.2
    Posts Expire 1.02
    WP-Print 2.02
    WP-PostRatings 1.02
    runPHP 2.1b
    Related Posts 2.02
    wpuntexturize 0.91
    Weighted Words 1.1
    wp-cache 2.0.17

    I will continue to monitor it over the next couple of days...

  17. davidchait
    Member
    Posted 8 years ago #

    I still don't understand. Most VPS setups are 'black boxes', you do whatever you want to in them. If you run out of VPS memory, or swap space, or CPU cycles, you run out. If you're on a shared VPS system with 'burstable' resources, and there's say 16 users on the system, each maxing out their resources, you'd just end up 'capped' at whatever minimum resource you should get. I've never heard of a VPS where they're tracking your CPU usage as part of the overall box -- what's the point of a VPS in that setup (aside from crash-control, and chewing up more overall memory of the box's total)?

    I don't know much about the plugins you listed. Though, again, WP-Cache should be serving up static cached pages most of the time. But I don't know what those pages are, whether they pull in lots of other content, etc.

    -d

  18. WPChina
    Member
    Posted 8 years ago #

    David, I agree with you. I feel that using 2-4% of a server sometimes is fine--even if there are 100 other clients on the server. I am not "abusing" the server, either, and, MOST importantly, Westhost includes WordPress as one of its default add-ons to all VPS packages. This means that lots of their users are expected to use WordPress, and they should be able to deal with these loads.

    Anyway, I will continue to monitor and see what happens with usage.

  19. davidchait
    Member
    Posted 8 years ago #

    But again, there's two underlying issues:

    1. if things still seem 'too high', you need to look at your access logs, see what's being hit a lot, what might be causing overhead (lots of little retrievals) versus bandwidth.

    2. They're really using VPS technology in a strange way. Looks like they have no hard caps on CPU, so it's like a shared environment, yet each VPS runs its own email, web, sql, etc. servers, so the memory (and cpu) overhead, given less caching of code, would be significantly higher. They give you the 'crash proof' and 'security' benefits of running a VPS, but potentially not the CPU or RAM guarantees. Then again, they price it like regular shared hosting.

    3. If they are running like average shared-host, they overload their boxes. But in addition, they are running VPS stuff which is that much more intensive, so overloading is a much more immediate hit (and a bigger one). If they want you under 2%, they have at least 50 users per box, likely double or triple that.

    Of course, I don't know machine specs (how much ram, how many CPUs @ what speed, what drive/raid config, are executable processes sharing ram for code for optimization, etc.), or enough about how their approach to 'VPS hosting' works to comment further. ;)

    At the end of the day, hosts set what they feel is 'abusive' based on their needs to load up a box. And if you're paying $3.95 a month, can't complain much. ;)

    -d

  20. WPChina
    Member
    Posted 8 years ago #

    Ok, Westhost says I am now down to below 2%. Good. It seems WP-Cache is working. I will make this thread "resolved" now, and hope I don't need to revisit this issue again. :-)

  21. davidchait
    Member
    Posted 8 years ago #

    At some point, send a link to the site we've been discussing (via my contact form on my site if you don't want it public) -- would be good to see what the 'content level' is like that was stressing their server so much. ;)

  22. WPChina
    Member
    Posted 8 years ago #

    Ok, now Westhost has disabled one of my sites again. I am at a crossroads--I have used them for many years and the site they turned off has been on their servers for about 7 years.

    1) WordPress obviously does have some problems. I don't want arguments from all of you, as I have been in this business for a long time and have worked with all the major free and paid CMS systems and WordPress needs to find a way to not eat so much CPU. It shouldn't have a caveat that says "only use on super-duper fast computers"--it should operate just as well as other CMS in normal environments.

    2) That being said, I want to continue using WP as we have invested lots of time and money into building sites around WP.

    3) I am looking now for relaible servers somewhere in North America. I don't want to use a company that has only been around for a few months--I want one that has been around for a few years. As I am in Asia, I am unfamilar with so many hosts, so I hope some of you can assist.

    Tks!

  23. davidchait
    Member
    Posted 8 years ago #

    If you've been with them for 7 years, surprised they aren't treating you better. Then again, if you are running a fairly heavy site on an overloaded server, at $4/mo or something, well, you get what you pay for. ;)

    There are some major sites running WP. I don't know what they've done to 'tune', but certainly they do 'tune'. On a shared server, the server might be better optimized for HTML sites, not dynamic PHP sites. I also don't know how the other CMS systems compare to WP in terms of code execution, caching, dynamicism, etc.

    And, that said, I do think there needs to be a big effort launched by some of the core team to look at performance optimization for both shared and dedi servers, and a list of possible guidelines for each, PLUS some code revision to help. I personally think the code could use some performance analysis and tuning. ;)

    -d

  24. WPChina
    Member
    Posted 8 years ago #

    I am a reseller who is paying them much, much more than US$4/mo and I am hosting lots of our company's and our clients there... yes, I wish they were getting me better treatment, especially since I have lived through a few episodes over the years where THEY had major problems lasting for weeks on their servers (in one instance, the only gift they gave me for so much hassle was a bit more server space)... it seems like companies like that seem to forget all too easily...

    So... I have decided to get a dedicated server from Westhost (about US$260/mo with all the extras) and see how that works for this site. Westhost does seem reliable, and sice I am not in the US, it's difficult for me to understand the lay of the land there. Stick with the devil I know...

    Yes, it would be good to see more core optimization in WP :-)

  25. davidchait
    Member
    Posted 8 years ago #

    for $260, I hope it is a NICE server, and fully managed (including security updates, firewall/intrusion stuff, etc.).

    -d

  26. WPChina
    Member
    Posted 8 years ago #

    Well, I didn't go with Westhost's server. Instead I moved the site to my own dedicated server in an IDC in my city. But WP is STILL causing problems.

    Here is my current server setup:

    OS: Redhat
    CPU: Dual-Xeon 2.8G(3.0G)
    MEM: 2GB
    HD : 73GB x 2 (RAID 1)

    This server is hosting one small flat-file html website that gets about 1000 pageviews a day. And it is hosting my WP site which has about 4500 pageviews.

    My WP keeps causing too many coonections and is overheating my server. I am at a crossroads now and I do not want to move back to Movabletype...

    Any ideas?

  27. yosemite
    Member
    Posted 8 years ago #

    But WP is STILL causing problems.

    Got a link?

  28. WPChina
    Member
    Posted 8 years ago #

    Give me ur email address and I will send it to you. I don't like posting my URLs on forums... I just restarted the server and cleared all connections, so it should be ok for a while. It's 9pm in Asia and I've been up since 3AM with these problems so I am going to sleep now....

Topic Closed

This topic has been closed to new replies.

About this Topic