Hacker News new | ask | show | jobs
by woodhull 5493 days ago
It seems unlikely that rack-cache + memcached would actually offer similar performance to varnish. This seems like a pretty bad set of changes for apps that need to serve out lots of static content - think newspapers, blogs, etc.

Will the old configuration style for http caching continue to be supported indefinitely?

4 comments

In testing we've seen roughly similar performance with rack-cache + memcache to varnish for most situations.
I expect that someone will build a Varnish add on for Heroku. It even looks possible to run Varnish on a dyno, believe it or not.

I love Varnish, but it's completely inflexible in Heroku so it's always been a mixed blessing. Sticking Google Analytics on your page, for instance, creates cookies for users that mean they will no longer get cached content. It's something that I can work around with dedicated Varnish, but Heroku can't really fix for me.

That's not true. Google Analytics cookies are injected via JS. When heroku's Varnish is checking for a cached version of the page, it strips any cookie information given by the browser.

We've are running production apps with Varnish caching + Google Analytics without issue.

Set your cookies with JS or on uncached pages (such as POST logins) and you'll be fine.

It's possible that it strips the GA cookies (which is cool, I had no idea), but Varnish doesn't strip cookie information from the browser. If it did you wouldn't get any Rails sessions or anything.
It's not specific to GA cookies.

You can set cookies on uncached pages in ruby and read them without issue in JS on Varnish cached pages. The page will still be cached even if the user has a session cookie.

Basically: don't set or get cookies in ruby on cached pages and you'll be fine.

Where did you read about this new configuration?
http://devcenter.heroku.com/articles/http-routing#the_heroku...

"The new HTTP stack does not include Varnish (a reverse proxy cache) because it is not compatible with the advanced HTTP features described above. If you wish use HTTP caching headers, rack-cache and the memcache add-on offer features and performance comparable to Varnish, but with the additional benefit of giving you complete control over authentication and page expiration."

memcached also has a 1MB limit.

(Begs the question though: What are we doing serving pages >1MB?)