Load Balancing & Cache Sync

Started by ziycon, September 24, 2015, 03:48:22 AM

Previous topic - Next topic

ziycon

I'm launching a new site soon which uses SMF and I will be running apache load balanced with two nodes at the start using apaches built in load balancer, I wondering if anyone has tip or recommendations relating to load balancing SMF over x nodes and how to keep the cache/attachments/avatar directories in sync?

The two examples for the files syncing/sharing I was looking at are below.

Infra.png uses a shared network location that will be mounted on both web servers which will handle packages/avatars/attachments/cache etc.

Infra2.png the files are actively synced between both web servers, rsync seems a bit slow so open to suggestions.

Joshua Dickerson

You wouldn't want to put the cache directory in there. I would mount a shared file resource. There is a post around from (I think) Vekseid that talks about putting files in memcached as well.

Is this just for availability or for scalability?
Come work with me at Promenade Group



Need help? See the wiki. Want to help SMF? See the wiki!

Did you know you can help develop SMF? See us on Github.

How have you bettered the world today?

ziycon

It's for availability initially, but down the round scalability will come into the mix.

Joshua Dickerson

Your DB needs a slave. If you virtualize it, it is much easier to spin up a new PHP instance if it goes down than a new database. If you're using something like RDS, it comes with built-in replication.
Come work with me at Promenade Group



Need help? See the wiki. Want to help SMF? See the wiki!

Did you know you can help develop SMF? See us on Github.

How have you bettered the world today?

青山 素子

If you want to get fancy, you could keep the entire SMF directory on a clustered filesystem. A bit less fancy, but still more than normal would be a distributed file system like GlusterFS. Using NFS can leave you with a single point of failure, which you may be okay with at this point. What you use depends on how paranoid you are and how much effort you want to put into your setup.

I'd personally run nginx on your load balancer. It's an easy setup for doing reverse proxy (we use that here at simplemachines.org), and it's very lightweight.

Other things you may want to do is set up nginx to serve theme and other static files to reduce load on the back-end application servers. You can easily set  this up in the server configuration, especially if you share a single SMF install directory across all your servers.
Motoko-chan
Director, Simple Machines

Note: Unless otherwise stated, my posts are not representative of any official position or opinion of Simple Machines.


Advertisement: