• I got the “you are using too many CPU resources” warning from my webhost (lunarpages) and they shuttled my account off to the land of pigs and I have 2 weeks to fix it.

    I’ve got 2 wordpress installs that are taking up most of the cpu – one with 3500-4000 pageviews a day and 660+ posts and a second brand new blog that I fear will soon cause a problem as traffic increases as it’s not as barebones as the older blog.

    I’ve spent the last week optimizing them and still they won’t move my account back to good status.

    Removing old plugins, cleaning up unused tables and the unused options had the biggest impact on load times (4 years of ignoring the database was maybe not a good choice).

    Installed WP_Super_cache on both so that will help with peak load times.

    Removed all the variables in my header and hardcoded everything I could.

    I’ve also upgrade to php5 and taken most everything out of the sidebar on the busiest of the blogs and when I put it back I’ll hardcode in as much as possible.

    I removed all of my revisions – that removed over 6000 rows from my database and my queries against wp_posts and term_relationships sped up considerably. I like like the revisions but I tend to have 10-25 revisions per post (I change my mind alot when writing) and the result was a lot of junk – poor design on the revisions – should have been a separate table – I also suspect the indices that come with the install are not sufficient because removing a few thousand rows should not impact the performance that much with a well design index).

    QUESTION #1 -> Any suggestions for better indicies on the tables that are saddled with being both production data (the real post) and the backups (posts, term_relationships, post_meta)? (did I miss any tables?)

    I think I’ve optimized everything I can in terms of the sql if I am reading the results of WP_Tuning correctly. Which means the rest of the time is spent in php.

    QUESTION #2 -> Short of hard coding most everything (in which case the advantages of wordpress are pretty much lost) is there anything I can do to speed up the php side of things? I would really love to stay on a shared server if possible based on cost and with my pageviews I see no reason why that should be a problem.

    QUESTION #3 -> I’m not sure I’m reading WP_Tuning correctly – I think this table indicates that my queries are pretty much fine and the time is in php (sorry – I know hard to read) – this is a single post load but things are similar for a page with multiple posts and most admin stuff like saving a new post:

    Index Marker %Time %DB Time %DB Count Time DB Time DB Count Memory Output
    (msec) (msec) (kb) lev(bytes)
    0 Start 78 47 14 295.0 3.2 2 ?
    1 plugins_loaded 3 4 14 11.8 0.2 2 10,486.9 1(0)
    2 widgets_init 1 0 0 3.9 0.0 0 10,624.4 1(0)
    3 init 1 0 0 5.3 0.0 0 10,671.1 1(0)
    4 posts_selection 3 14 21 10.8 1.0 3 10,623.7 1(0)
    5 posts_selection 4 22 43 14.1 1.5 6 10,745.0 2(1572)
    6 wp_head 0 0 0 0.1 0.0 0 10,755.7 1(2445)
    7 loop_start 10 13 7 37.4 0.9 1 10,751.8 1(3476)
    8 get_sidebar 0 0 0 1.1 0.0 0 10,780.4 1(13425)
    9 get_footer 0 0 0 0.9 0.0 0 10,780.5 1(19045)
    10 Stop 10,782.8 1(19095)
    Total 100 100 100 380.5 6.9 14

    But I think this is say total time to load the page was 380.5 msec and only 6.9 was spent in the database. Of the 380.5 looks like 295 msec are happening at start – what happens here? Can it be optimized?

    (personally I think these times don’t seem bad and maybe the reason things aren’t okay is that I keep messing with the blog and if I let them sit untouched for 48 hours things will be fine – but if that is the case then I wonder – what does that say about the future when I want to work on my blog? I think it means I’ll spike the CPU again so I’m being a bit paranoid)

    QUESTION #4 – the one thing I could not figure out are my permalinks. The are currently set to %postname% only, which has shown to be a performance issue in some cases. When looking into the options table I could find no entry for rewrite rules. I was also unable to get the rewrite rules viewer plugin to work. Where the heck are the rewrite rules stored? I’m not seeing excessive queries when I create a new posts (there are about 30-40 queries and it takes about .4 cpu secs). I changed the permalinks to %year%/%month%/%postname% and the performance was exactly the same and still no rewrite_rules appeared in teh options table.

    What am I missing? Could this be the problem? If so why am I not seeing a difference when I switch to the more prefered permalink structure?

    QUESTION #5 – am I missing anything else that anyone can think of that will help my performance? I’ve learned more about WP than I ever wanted to know this week (I am a former software developer – I became a manager for a reason – it’s way less work). 🙂

    The blogs in question are http://blog.lisacall.com and http://www.makebigart.com

    Any help would be most appreciated!

    —lisa

  • The topic ‘A week optimizing wordpress and still not fast enough – what am I missing?’ is closed to new replies.