Serving flat (Varnish) pages AND allowing anonymous users to comment on content

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

I know anonymous traffic scales way easier than authenticated traffic -- particularly with a reverse proxy, like Varnish. But I'm wondering if the benefits are negated if you allow anonymous users to comment on and/or rate content. Anyone know about that?

I'm working on a site that has a particular (one-day) traffic spike, and am devising the gameplan on which database-intensive features to throttle and/or temporarily disable.

Comments

It takes some custom coding

Jamie Holly's picture

It takes some custom coding and configuration to get it to work right. Basically you would want to handle everything via javascript, like remembering the users comment info and prefilling in that info. After that you would configure Varnish to ignore those cookies, and JS would fill in the values instead of Drupal.

For rating stuff, it depends on how you track that. If it's via IP address then you shouldn't have a problem as long as the rating callback isn't cached in Varnish. If you are using cookies, then yes Varnish will be ignored unless you come up with a similar work around like the comment one. That or you could get really fancy and use the ESI features of Varnish to handle the ratings stuff.


HollyIT - Grab the Netbeans Drupal Development Tool at GitHub.

Pressflow

joshk's picture

Pressflow contains a module to set a cookie after a comment is left that will keep an anonymous user from getting cached pages w/their comment.

The future here is active cache invalidation for reverse-proxies. That's what varnish.module will do, but we're not there yet. ;)

But basically, even if you let anons do these things (rate, comment) that doesn't mean the bulk of them will when you get a spike. Reverse-proxy will setill help you out a lot.

Varnish & ESI

clockworkrobot's picture

Working with a large, high-performance website for a client, we ran into just this sort of challenge. Where Varnish could effectively eliminate all the load from pages with no personalisation or UGC interation, the model broke down as soon as a user tweaked contrast settings, or used some of our taxonomic navigation.

We resorted to using the ESI functionality within Varnish to publish the content with a long lifetime to the cache, and then grab personalised items from Drupal with the ESI calls. If you can involve memory based object caching, like memcached, you'll be able to prevent direct Drupal calls for most unauthenticated users. It will require some custom coding, but its definitely worth the time.

High performance

Group notifications

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

Hot content this week