I recently inherited a small Linux-based load-balanced web server set up. Unfortunately, it was never completely brought on-line, so I am working on doing that.
The basic set up is:
- LVS-based load-balancer. Also acts as a simple NAT for the web servers.
- Two Apache/PHP5 web servers.
- MySQL database server.
The database server is inside the main company firewall while the other three are in the DMZ. Basic load balancing works, but I've had trouble persisting connections with LVS and since session storage for PHP5 is using local files, we lose sessions. I might be able to get LVS to persist sessions, but since connections are generally to large numbers of NATed clients behind the same firewall with sometimes lengthy delays between requests, I think it might be a losing proposition. I've decided to instead switch to memcached for session storage, as it will be quick to set up.
My question with this is where should the memcached service live? I cannot add another server so it has to live either with the load-balancer or the database server. At the moment, I'm leaning toward putting it with the database server, as it has no external connections, but I'm concerned the two might conflict to some extent. Is there a best-practice for this sort of situation? Or any other guidance?