WordPress & Permalinks for Pages

After my post on increasing WordPress Performance, I’ve been helping several other people with their overloaded website.
The most unique probably is the one owned by (let’s call him) Mr. King.

Mr. King has got a very popular website. PageRank 2 only, but since it’s a niche rarely targeted by others, people are flocking there anyway.
He’s making (my guess) thousands of dollars every month, just from Google AdSense shown on his website.

However, the popularity brings other problems. His powerful server (I think it’s a quad core,with 4 GB RAM) was constantly overloaded.
After I optimized the server, it’s working fine now.

Except for the static pages.

First, a little bit about “static” page in WordPress. It’s not really static actually, it’s dynamically generated. In itself it’s not a problem.
However, when you utilize WordPress’ permalink feature, essential to make your website more visible on Google, **and** you have thousands of pages; then it started to get, um, “interesting”. Note that this may probably an understatement 🙂 considering the fun I had while optimizing the website.

Basically, I think this is how permalink for pages works in WordPress :

[ 1 ] A visitor requested a page, in the form of a people (and Google) friendly link.
Example : http://asiablogging.com/links-2-asia/

[ 2 ] Due to WordPress-generated .htaccess file, Apache will translate the permalink into loading index.php and passing along that permalink to it.

[ 3 ] WordPress will lookup that permalink in the rewrite table, and got the real URL.

The rewrite lookup record can be viewed with this SQL command :
select * from wp_options where option_name=’rewrite_rules’;

[ 4 ] The real URL loaded and shown to the visitor.

So far so good.

However, when we’re talking about **thousands** of pages, then things started to become messy.

Last time I checked, the rewrite lookup table (the thing I was talking about in point 3 above) for Mr. King’s website is about 21 MB in size.
And **everytime** he add a new page, that record will be recreated again, from scratch.

WP developers have acknowledged the problem as very serious. This is because the way it works at the moment (WordPress version 2.3.1), this scheme is not scalable / will give poor performance over as little as 1000 pages.
And since it’s within the WordPress’ core, it will require a rather significant overhaul to get this fixed.

Don’t get it wrong, they’re (I think) most happy and flattered that some people are actually trying to make WordPress to work as substitute of a Wiki 🙂 It’s just that there’s this technical glitch at the moment that will be causing difficulties to many others from following the same path.
So last time I checked, they’re very interested to get this fixed.

Back to Mr.King – I have now optimized the server so it performs much faster, despite the bottleneck I described above.
There’s still slowdown noticable when creating a new page, but it’s now quite bearable

Anyway, again that was fun indeed. I guess this is why I chose IT as my career path back there years ago – it was fun (and very useful to many people), and it still is today.
Enjoy !

His server had problems and crashing his website. Mr King said that the datacenter guys are looking into it, but I’m welcome to look around as well.

Soon it’s pretty clear that the hard drive of the server is dying. I told Mr King to relay that to the techies, which responded with “how did you figure it out ?” (dmesg + google – duh).

Long story cut short – they botched big time, but thankfully I managed to snatch a backup of Mr King’s website before it went down the flames.
Now I host Mr King’s website on my server, and he’s a very happy guy again.

25 thoughts on “WordPress & Permalinks for Pages

  1. This guy sounds familiar…. Hey Harry ! nice article … I need to get in touch with you. Please reply!~ Take care.

  2. I have been a frequent visitor of this blog for some time now, so I thought it would be a good idea to leave you with my thanks.

    Jim Mirkalami

  3. Hi

    I came across your post in a Google Search because I had not realised that Pages do not get permalinks unless .htaccess is writable. I can fix that for new Pages but is there a procedure or script for re-writing the permalinks for Pages after they have been created.

    I probably have misunderstood a lot along the way of my thinking above but will be grateful for advice and pointers.


  4. Hi John, there are several WordPress Redirection plugins available. Basically, they’ll inform incoming visitors (and search engine bots) with code 301 and the new location of the page. So you won’t lost visitors (and search engine rank) because of this.
    Be aware though that each plugins are different. You’ll need to evaluate each carefully to find the one that fully suited for your needs.
    Hope this helps.

  5. I have a similar issue that I am trying to deal with. Does anyone know of the best wordpress plugin to deal with this situation?

  6. So king guy only has a PR of 2 and he’s doing that well? Wow, let me know what his site is about, maybe I need to change my blog from being about credit cards to whatever he is doing! Well heck, with the economy in the crapper and banks going bankrupt I should be changing anyway :p

  7. I have the same issue that I am trying to deal with. Does anyone know of the best wordpress plugin to deal with this problem?

  8. Great how to post. I’ve had the same issue myself on some sites and it was a daunting task to consider before I set out. Optimization had the same affect while there were problems with the static pages. Thanks again!

  9. Interesting. There are some good ideass presented here. I need to do spend some time reading more about these topics.

  10. I can appreciate all of the hard work that you must have went through in preparation for all of the information that you relayed to all of us above. thanks

  11. I am having the same problem and this issue that I am trying to deal with. Does anyone know of the best wordpress plugin to deal with this problem?
    Great job, most people would only recommend a more expensive hosting plan

  12. I know what you mean about the credit card sites…
    I think it’s time to change alright!

  13. Varieties of plugins are available in wordpress for redirection purposes. But its your duty to find out the plugin that will be of best use for your needs.

  14. Great information. I’ve ran into that same problem on our site on a couple of occasions. Our IT staff needs to regroup and gain a laser focus on an overloaded website. It can be a really hairy situation.

  15. You are really a excellent webmaster. The web site
    loading pace is incredible. It seems that you are doing any unique trick.
    Also, the contents are masterpiece. you have performed a magnificent process in this matter!
    Similar here: ecommerce and also here:
    Sklep online

Leave a Reply

Your email address will not be published. Required fields are marked *