Recently I was trying to track down why a Drupal site that I wrote had such slow loading times on the homepage. The issue wasn't due to the page needing to download a lot of items, I had already looked into that. It seemed that the server was very slow to serve up the page. At first I wrote it off to being a massive site with hundreds of thousands of images and too many contrib modules, however other sites on the same server were performing fine and the server had actually been scaled up multiple times due to it needing more storage space (Yes, S3, I love it and would have used it except that at the time I did not foresee storage as being an issue and now it wouldn't be cost effective to spend a ton of time re-writing code to use S3) since on Rackspace if you want more storage you have to upgrade to the next server size.

So we were on a massive server, other sites worked fine, and it wasn't due to large page elements downloading. I was stumped until I looked at the front page using Drupal for Firebug. It was showing hundreds if not thousands of nodes being loaded every time the front page was accessed. I searched, and grep-ed, all through my code trying to figure out what had gone wrong and caused all these extra nodes (that were unused) to load, but couldn't find the cause. I was especially surprised to see nodes that were created from form submissions (Programmatically, not through the UI) being loaded as well.

After searching for a while I finally found out what was happening. When creating new content types I had completely ignored the "Promote to Front Page" checkbox because all the data on the site was displayed through views. I never filtered based on "Promote to Front Page" because I felt that even in a situation where I would want a to promote content I would rather write my own implementation with more extendibility than a single checkbox that is limited in what it can do. And so I ignored it thinking "What could possibly go wrong?".

Let me tell you what could go wrong, on every single home page visit EVERY node that was marked as "Promote to Front Page" was loaded by Drupal, even if it wasn't ever used. The reason this was so hard to catch was it didn't "break" the site instantly. Instead, over time, as the site grew, and more and more nodes were "Promoted", the front page would slow down more and more. I personally think that "Promote to Front Page" is a stupid feature only to be used by people who use Drupal "out-of-the-box" with little to no configuration. It is for this reason that I wrote a tiny (As in less that 5 lines of code) module that disables the promote "feature".

All the module does is hook into either hook_nodeapi (D6) or hook_node_presave (D7) and then set the "promote" property on the $node to 0. I know it is super simple to do but I went ahead and packaged up a D6 and D7 version so that it would be easy to turn on/off. Don't forget that using the module alone does not fix the whole problem. You also need to run "Update node Set promote=0" against your database so that you clear out any nodes that already have promote set to 1 (Obviously don't run that SQL query if you actually use "Promote to Front Page" on your Drupal site, Does anyone?). I hope that Demote helps speed up your site.

Download Demote for Drupal 6

Download Demote for Drupal 7

Update: I have updated both the modules so that the checkbox is also removed from the create content form. This way it won't even show the checkbox and if you create nodes programmatically then it will also catch it in the hook_nodeapi/hook_node_presave hooks