Migrating to Drupal with lots of caching. Use Drupal 7, Pressflow 6, or Pressflow 7 ( exists?)?

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

Hello,

My company's site built in Symfony/PHP + MySQL has grown beyond my ability/resource to manage.

After the usual lots of homework, I've decided to migrate it to Drupal.

So far, much of my front-end load has been handled by a mix of Varnish cache, memcached & APC.

I see that something very similar can be handled with a Drupal module (Varnish) and the company=FourKitchen's variant/fork of Drupal, Pressflow.

I've read that Drupal 7 has now integrated a lot of what the Pressflow product offered in it's Version 6 product.

I can't find any information about a Pressflow 7 product, and have been told that MultiLayer proxying, which I guess is Drupal-speak for what I've been doing, is not available in Drupal 7.

So I have a few questions before I pull the trigger:

-- Is is true that Drupal 7 doesn't have the MultiLayer proxying?
-- Should I deploy the "old" Pressflow 6 product to make sure that works?
-- Should I instead hold-off until there is a Pressflow 7 product?
-- In any of these cases, is the Varnish module required? I see there's no version 7-compatible module, and little comment in its forum as to what's happening.
-- My sense from what I've learned reading here and elsewhere is that Drupal 7's community is enormous and well supported, even in this "High Performance" arena. The Pressflow products seem like they're 3rd party, rather niche, and not a lot of recent information is available. Is that the general feeling around here as well, or not?

Cheers,

Dave Generis

Comments

Hey Dave; Pressflow on D6 vs

soyarma's picture

Hey Dave;

Pressflow on D6 vs Native Drupal 7
The main thing that Pressflow did for Drupal was to get rid of the session cookie for anonymous users. As you know Varnish will not cache content with cookies, so Drupal 6 pages were not cachable with Varnish (and many other reverse proxies). Drupal 7 does not create session cookies for anonymous users right out of the box, so that hurdle is taken care of.

Additionally, Pressflow allowed you to set a minimum cache lifetime on Drupal's performance page. This has also been implemented natively in Drupal 7.

Lastly (other than general optimizations for the LAMP stack) Pressflow had a module called cookie_cache_bypass which would set a cookie on form submit so that the result pages (in case there were validation issues) would not be cached. The module is pretty simple and theoretically should work in D7 without modification (it is in the root modules folder in a pressflow installation).

Varnish Module
The varnish module is pretty darn handy for Drupal in that it allows you to clear the cache for a page whenever it is edited automatically. That means you don't have to go and purge a URL after it has been altered. It's not necessary for D7, but it makes an admin's life a bit easier.

General notes on choosing D6 or D7
Pressflow is actually very well supported. Essentially if something works on Drupal 6, it will work on Pressflow, just faster. It doesn't have a lot of specific support information because pretty much nothing goes wrong with a Pressflow install. If you see people talking about Project Mercury, they are actually talking about Pressflow, Varnish and APC and/or Memcache.

I would make your main D6 vs D7 choice less around Varnish and caching (since I think that D6 with Pressflow and D7 Native is a pretty even playing field) and more around support for contributed modules you may want. With Drupal 6 being out for 3 years, it has a very, very mature module base. Incompatibilities and caveats are few and pretty much everything is cross-compatible with everything-else (or it is well noted that it is not).

With D7 a lot of modules are pretty new and haven't had a lot of field time. The main modules (things like views) are very solid in D7, but it is a lot of the edge cases, such as the varnish module that either aren't ready for prime-time, or simply don't exist.

If I was concerned about all the bells and whistles being in place and tested good today, I would go with Drupal 6. If I were OK with figuring things out and possibly having to do some bug testing, then I'd go D7.

You may also want to consider working with a Drupal company of some sort like Acquia or one of it's partners (http://acquia.com/partners). Many offer consulting, hosting, and professional services to help you with evaluating your needs and making sure you pick the right modules/configuration right off the bat.

(Disclaimer: I am employed by Acquia)

Hi soyarma, On Sun, 06 Feb

DavidGen's picture

Hi soyarma,

On Sun, 06 Feb 2011 20:32 +0000, "soyarma" NO-REPLY@groups.drupal.org wrote:

Pressflow on D6 vs Native Drupal 7

The main thing that Pressflow did for Drupal ...

On Varnish-cache.org (http://www.varnish-cache.org/trac/wiki/VarnishAndDrupal) I found a reference to this page, https://wiki.fourkitchens.com/display/PF/Comparison+-+Pressflow+versus+D.... There it references "Multi-layer proxy support" which sounds like the right issue that I need. I'm not really sure what it does specifically yet. Might NOT be the same issue for all I know at the moment.

If I'm reading the chart correctly, "Multi-layer proxy support",

(i) does NOT exist in Drupal 6
(ii) DOES exist in Pressflow 6
(iii) DOES exist in Drupal.org on D6 (How is this different from Drupal 6? Is there another fork I've missed?)
(iv) does NOT exist in Drupal 7

It looks like something's broken with a patch that has yet to be tested @ http://drupal.org/node/621748. So i guess D7 is not an option for me?

And even on that chart there's not column for Pressflow 7, so I guess that's not an option either?

Do these Pressflow releases track the Drupal releases closely? Seems like D7 was released in early/middle January, and that lots of folks are taking the D7 plunge.

Varnish Module

Info about this seems to be scattered all over the place! I found this http://drupal.org/node/927860 which indicated that the Varnish Module does not exist for D7.

Looks like there's some patching work being done but still incomplete.

General notes on choosing D6 or D7

Pressflow is actually very well supported. Essentially if something works
on Drupal 6, it will work on Pressflow, just faster. It doesn't have a
lot of specific support information because pretty much nothing goes
wrong with a Pressflow install. If you see people talking about Project
Mercury, they are actually talking about Pressflow, Varnish and APC
and/or Memcache.

I found discussions about Mercury and 'Pantheon', which I think is the same product just rebranded?

A buddy pointed me to a Pantheon & Drupal 7 thread @ http://groups.drupal.org/node/117154#comment-380364 that says for D7 support in Pantheon "Expect an announcement around this sometime later in January." I haven't found anything about that yet.

I would make your main D6 vs D7 choice less
(snip)

My primary concerns are with getting on the wrong bandwagon, where wrong == poorly supported & missing the caching features. I've battled cache weirdness enough over these past years so that if I move to something, I really want to know it's gonna work and have others to talk to about it.

Also I'm reticent to inveset anything in deploying a D6 site if I can help it. Reading forums & mailing lists & luriking in #IRC it's pretty obvious where the dev/support focus is. That's D7.

When it comes to Pressflow, it's clear that a lot of folks have depended on it in the past. And I guess it's a good thing that a product (products?) like Mercury and Pantheon use it too. To be honest, I'm a bit spooked about the lack of info available about it. Could be my own problem just finding where the info is though. To further confuse, I did find this http://buytaert.net/varnish-using-drupal, where it says the Varnish site is using Pressflow. I have no idea which version of what they're using.

You may also want to consider working with a Drupal company of some sort
like Acquia or one of it's partners (http://acquia.com/partners). Many
offer consulting, hosting, and professional services to help you with
evaluating your needs and making sure you pick the right
modules/configuration right off the bat.

(Disclaimer: I am employed by Acquia)

I may eventually get there. Generally I prefer to try to get up to speed a bit myself first, before starting those discussions. Helps avoid my ingrained suspicion of "being sold whatever's on the vendor's shelves". :-)

Cheers,

Dave Generis

Cookie cache bypass for Drupal 7

mgifford's picture

Well, cookie_cache_bypass didn't exist before, but you were very right about how simple it is.

I've got this in a D7 site right now:

For the cookie_cache_bypass/cookie_cache_bypass.info

name = Cookie cache bypass
description = Sets a cookie on form submission directing a reverse proxy to temporarily not serve cached pages for
an anonymous user that just submitted content.
files[] = cookie_cache_bypass.module
core = "7.x"
project = "Pressflow"
package = "Pressflow"

Main module page cookie_cache_bypass/cookie_cache_bypass.module

<?php
/**
* Pressflow has a module called cookie_cache_bypass which sets a cookie on form submit
* so that the result pages (in case there were validation issues) would not be cached.
*/

function cookie_cache_bypass_form_alter(&$form, $form_state, $form_id) {
  $form['#submit'][] = 'cookie_cache_bypass_submit';
}

function cookie_cache_bypass_submit() {
  global $cookie_domain;
  $lifetime = variable_get('cache_lifetime', 300);
  setcookie('NO_CACHE', 'Y', $_SERVER['REQUEST_TIME'] + ($lifetime + 300), '/', $cookie_domain);
}

Coder seems to be happy with it (other than $cookie_domain's lack of a _, for a global, but that's a core issue).

I've got other issues for getting D7 set up, but at least this piece can be managed it seems.

I'm not sure however if it might just be best to run with cookie_cache_bypass_adv which already has a released version for D7.

I'm guessing it does more, but with more code.

ESI

Ravi.J's picture

Varnish modules works great for anonymous users, there will however still be issues around handling Authenticated users, and this is where ESI module steps in (http://www.drupal.org/project/esi), ESI allows for defining which contents youwould like cached for authenticated users. Drupal ESI module has full support for Blocks and panels. You will also benefit from granular control on how long a block can be cached etc.

Hi, ESI hardly seems like

DavidGen's picture

Hi,

ESI hardly seems like it's ready for production yet, http://groups.drupal.org/node/50093.

I think I'm going to need to first understand the 'old' pieces that are, or aren't, available to me. I simply don't have a clue whether this "ESI" module replaces Varnish module, adds to it, is in Drupal or Pressflow, or which version.

IS there a single place in the Drupal docs/wiki for example that clearly walks through the whole set of caching options & decisions? I'm sure it's partly just me, but this info is scattered all over the place! Tough to get a handle on.

Cheers,

Dave Generis

We are using it now

Ravi.J's picture

Hi DavidGen,

http://groups.drupal.org/node/50093 discussion is a bit old, ESI module is indeed ready and we are using it on one of our recent projects.

ESI is more of standard which is supported by Varnish. There's a great slideshow here which explains how ESI and Varnish work for Drupal http://www.slideshare.net/manarth/varnish-bof

-Ravi

Thanks for the SlideShare

DavidGen's picture

Thanks for the SlideShare link. It did answer the question of do I need BOTH the Varnish & ESI modules. From ~ slide #50, I guess I do.

Cheers,

Dave Generis

I don't think you're planning

soyarma's picture

I don't think you're planning to run a multi-layer reverse-proxy, just a single layer. Multi-layer would be if you were planning to do something like:

Web -> Varnish -> Nginx -> Webserver

The issue with ip_address() does seem to be legit for multi-layer, but the only thing that happens is that if you have more than one layer of reverse proxy, Drupal can't tell the source IP of the visitor.

As a sidenote, if you want to use a reverse proxy with Drupal 7, you need to make the changes to your settings.php as outlined here: http://blogs.osuosl.org/gchaix/2011/01/05/drupal-7-varnish/

Hi soyarma, I don't think

DavidGen's picture

Hi soyarma,

I don't think you're planning to run a multi-layer reverse-proxy, just a single layer. Multi-layer would be if you were planning to do something like:

Actually I hope to do something similar to what I have now, adapted for Drupal/Pressflow:

web -> nginx + ssl + NOcache + NOcompression -> varnish -> apache + NOssl + compression + Drupal/Pressflow (and all the right caching bits; TBD)

The issue with ip_address() does seem to be legit for multi-layer,

So I'm not sure with the above layout whether I do, or don't, run multi-layer reverse proxy as you outlined.

My bottom line is probably just: Can I do this ^^^ with D7 + Varnish, or do I need that MutliLayer/ip_address() solution for either D7 or the not-available Pressflow?

Cheers,

Dave Generis

I should mention, I intend to

soyarma's picture

I should mention, I intend to launch several sites on Drupal 7 behind both Varnish and Nginx in the next few weeks to months and don't expect to have any significant issues.

I just read that whole post

soyarma's picture

I just read that whole post about the ip_address() function and that is a Drupal 6 bug that was fixed in D6 last year. A post at the bottom of the thread confirms that the fix is in D7 as well.

So simply put, you can do what you plan to with Drupal 7. Be sure to make the changes to your settings.php to tell Drupal 7 it is behind a reverse proxy.

In addition I fully intend to do this with Drupal 7 as well and will be launching D7 sites behind multilayer proxies before March 1.

not fixed in d6 yet

mikeytown2's picture

That patch has not been applied to d6 yet. it is IN D7.

Hi soyarma, I note your

DavidGen's picture

Hi soyarma,

I note your intention to roll this out.

thread confirms that the fix is in D7 as well

I'll admit I read that thread differently; That thread was apparently started by David Strauss, a developer of Pressflow.

Msg #15 from "Dries" says "Committed to CVS HEAD for inclusion in Drupal 7."
Msg #24 from "dev001" asks "Did this patch make it into Drupal7 release? Or, n/a 'til next point release ... ?"
Msg #25 from "mikeytown2" says "This is in D7"

Which doesn't unequivocally address the question.

From those comments and also because this page, https://wiki.fourkitchens.com/display/PF/Comparison+-+Pressflow+versus+D..., created by David Strauss, shows it NOT in D7, I'm still unsure if it's "in" the currently available D7 release or not. Both pieces of info obviously can't be right.

I suppose I'll need to 1st find, then dig through some code to verify this one way or the other. Right now it just sounds like it will probably happen in some 'full' release, in some product, at some time.

Cheers,

Dave Generis

When in doubt look at the code

mikeytown2's picture

http://api.drupal.org/api/drupal/includes--bootstrap.inc/function/ip_add...
http://api.drupal.org/api/drupal/includes--bootstrap.inc/function/ip_add...

in the 7 version we get rid of all trusted ip's

<?php
// Eliminate all trusted IPs.
$untrusted = array_diff($forwarded, $reverse_proxy_addresses);
?>

In the 6 version we grab the last IP with out Eliminating the trusted IP's. With the patch that is IN d7 or applying the patch to d6 you can do this in your settings.php file

<?php
$conf
['reverse_proxy'] = TRUE;
$conf['reverse_proxy_addresses'] = array(
 
'127.0.0.1',
 
'10.2.1.144',
 
'10.1.0.227',
 
'10.1.0.228',
 
'10.1.0.211',
 
'10.1.0.212',
 
'10.1.0.213',
 
'10.1.0.214',
 
'10.1.0.215',
 
'10.1.0.216',
 
'10.1.0.217',
);
?>

We have load balancers, nginx, varnish and apache in the backend. TRUST me when I say it will work in D7. I'm using the patch from d7 in d6.

High performance

Group notifications

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

Hot content this week