Pressflow Question

Events happening in the community are now at Drupal community events on www.drupal.org.
kmoll's picture

Hi, I have drupal 6 site that has spikes in traffic usually on the weekends. We also use boost to increase performance. Not to long ago we started to have a problem where the sites main navigation started to disappear, sporadically. Now we use a bit of custom code to create and manipulate the main menu (primary-links) so it is easier for our users to change the menu as needed. So our menu gets created by sending the return data from menu_tree_all_data() for the primary links menu. That will go through and check to see if the values are stored in the cache and if not will make the database calls to grab the data then put it in cache for the next call.

What I was noticing is that periodically it would store an empty array in the cache. So the function would return no data to be themed and the navigation would disappear. What I figured happens is that at the same time the menu_tree_data_all() is being called, there is another thread clearing the items from the menu_router table and rebuilding it. Now normally the pages that are up on production are being serverd by boost, so everything is fine. But ocassionally when the stars align the boost cache clears and the page needs to be re-built and the menus are being rebuild, or a cache clear is being called results in that function returning nothing, storing an empty data in the cache and having the menu disappear, and worst off, having the page get cached by boost with out the main navigation in it.

This would happen with much more frequency on the weekends due to the higher traffic. I searched for issues like this and found some other problems that might be caused by similar circumstances, but there weren't a lot of concrete solutions. I discovered that the if statement to rebuild the menu data only checks for the existence of an outer container array ($data). The menu data is actually an array inside the array $data['tree']. So if an empty menu was cached, it will always return the empty array because $data exists, but it doesn't check to see if $data['tree'] exists. So in an effort to put a bandaid on the solution, I added that check to the conditional. I know, I know, I altered core and Kittens are dieing all over the place, but unfortunately, humans (me and my co-workers) die if our bosses see the site with out a main navigation, so I took the lessor of two evils.

I so I guess my topic for discussion would be a permanent solution. Since we are not ready to upgrade to Drupal 7, which fixes this solution, that doesn't seem to be an option. The fix that I put in seemed to solve the problem for now, although it is still technically possible for the same situation to occur, I close the window by making sure the menu data is rebuilt if the $data['tree'] array is empty. So I could leave that the way it is until we are ready for an upgrade to Drupal 7, or I can use Pressflow. I know most people that work on high traffic sites use Pressflow. I've heard everybody say it is a drop in replacement. I went through the menu.inc file in pressflow and it does make the changes that would eliminate this bug altogether. Now we are already using InnoDb tables, so we are able to support transactions. But we have a lot of custom functionality (a lot of which I haven't written myself), so we need to do a full code review/test of all that funcitionality with pressflow before we move to it, which I would really like to do. In the mean time, I am wondering if it would be a terrible idea to just use the menu.inc file from pressflow with the rest of core being standard drupal 6. I am going through it line by line and it seems like the changes they made to it are self contained and the calls and returned data are the same. I know this would normally not be a suggested way, but I need a solution now, and don't quite have the time it will take to test the entire site with Pressflow.

Any thoughts or suggestions on this would be greatly appreciated.

Comments

Version?

stewsnooze's picture

Are you upto date with Pressflow? A while back the semaphore table was added to Drupal/Pressflow that adds locking. I wonder whether you have that table and therefore a recent pressflow?

Full Fat Things ( http://fullfatthings.com ), my Drupal consultancy that makes sites fast.

We do have the semaphore

kmoll's picture

We do have the semaphore table in our installation of Drupal. But does that table only exist in pressflow and not orginal Drupal. I although I am new to working with this site, I know that we are not using pressflow. The semaphore table exists, but is empty.

High performance

Group notifications

This group offers an RSS feed. Or subscribe to these personalized, sitewide feeds: