Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I want to start using multiple front-end Apache servers for my website.

At the moment I store various HTML files in a caching directory, e.g. "/htmlcache/homepage.html"

Obviously I don't want to re-cache these files on a per-server basis, I'd rather have one central store. How is this usually done?

The options as I see it are:

  • Database (MySQL) - extra load - should I be storing larrge .html files?
  • Memcache - should this be used for large .html files?
  • Some kind of accessible shared disk - no idea how this would work

Latency is key for me. The disk read opperation is working very nicely for me at the moment.

As an additional complication, I'll also need to keep my PHP session data in a central location too.

This thread: http://stackoverflow.com/questions/580671/configure-session-to-work-on-applications-that-are-deployed-over-multiple-server recommends using session_set_save_handler to store the session data in a shared database.

How are you overcoming this issue?

share|improve this question
    
Perhaps Varnish would suit your needs varnish-cache.org –  Michael Mior Jul 7 '11 at 15:15

1 Answer 1

memcached can store "large" HTML files (for suitably small values of large) - Varnish (as Michael Mior mentioned) or Squid are other options. Out of those three I would lean toward Varnish (Squid is overkill for most small environments, and I believe Varnish scales better through medium/large environments: Last time I checked Squid wasn't capable of distributed cacheing).
You will need to test any of these solutions before you deploy them, obviously.

Re: the PHP session part - session_mysql is one solution here. Writing your own custom session handler in PHP is another. I would suggest one of the PECL extensions personally as they tend to be marginally more efficient/faster than PHP code.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.