Jump to content

Load Balancing Processwire Help


cosmicsafari
 Share

Recommended Posts

Hi all,

I have been asked by a client whether we can setup load balancing for their existing Processwire site.

From my investigations on Google and within these forums, it definitely seems possible but as a newbie with a basic understanding of the subject im a bit lost.

Does anyone know of any existing tutorials for settings up load balancing with PW?

What items would need to be changed on their current stand alone install, is there a list of best practices worth consulting etc?

As I understand it we would need to have some sort of copying mechanism (rsync script most likely) in order to make sure any uploaded assets are shared between the main server and the fallback ones, other than that im not sure what else would need to be ammended.

Any thoughts/help would be greatly appreciated.

Link to comment
Share on other sites

I'd look into AWS ELB: https://aws.amazon.com/de/elasticloadbalancing/

@ryan has set up his Villas site with some sort of load balancing (or whatever you would call it exactly):

Quote

this site involves 1 PW installation for managing the inventory, and another PW installation for presenting it, and they use web services to chat back and forth all day.

Maybe he would be willing to share some more in-depth technical details...

Link to comment
Share on other sites

There are three things to consider for load balancing: You need a central database, central file management (if people do upload things) and central session management (as the default also uses the filesystem). Each can be solved in various ways and depends mostly on your project's constraints.

Database
Probably as simple as running the db on it's own external server.

File Management
- Cloud storage (S3 or equivalent; minio for self hosted S3)
- rsync (this is at best eventually consistent as you need to wait for the sync)
- mount network share (I've not tried this and read a lot of bad things, but it might work)

Session Management
- Use the central db for session (SessionHandlerDB; might be slow)
- Use a central redis server (can be done directly in php)

  • Like 2
Link to comment
Share on other sites

1 hour ago, LostKobrakai said:

There are three things to consider for load balancing: You need a central database, central file management (if people do upload things) and central session management (as the default also uses the filesystem). Each can be solved in various ways and depends mostly on your project's constraints.

Database
Probably as simple as running the db on it's own external server.

File Management
- Cloud storage (S3 or equivalent; minio for self hosted S3)
- rsync (this is at best eventually consistent as you need to wait for the sync)
- mount network share (I've not tried this and read a lot of bad things, but it might work)

Session Management
- Use the central db for session (SessionHandlerDB; might be slow)
- Use a central redis server (can be done directly in php)

Thanks for the replies folks.

Given the above response does the following hypothetical setup sound reasonable.

  • Primary DB with mirrors hosted on Azure
  • Rsync contents of Assets/Files folder between primary server and mirrors
  • Enable database driven sessions, that way we don't need to copy Assets/Sessions between the servers

Obviously thats very vague in the details but as a general proposal is there anything glaring wrong with this approach?

Link to comment
Share on other sites

I've tried some experiments with Processwire on Heroku (with multiple Dynos).

It worked - I used

  • For Sessions: Heroku Redis + https://modules.processwire.com/modules/session-handler-redis/ + https://elements.heroku.com/addons/heroku-redis
  • For Uploads: Amazon S3 + https://modules.processwire.com/modules/amazon-s3-cloudfront/
  • For the DB: https://devcenter.heroku.com/articles/jawsdb-maria
  • Like 2
  • Thanks 1
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...