shop server scaling / customer peak / database replication
I have a small shop (PrestaShop) that only sells 1 item, a show ticket.
This show ticket becomes available after a countdown on my site.
3.000 people are waiting on my webshop to get a ticket and hit refresh button until item becomes available. Then everyone rushes to checkout simultaneously to make purchase. After half an hour it’s sold out and things go back to normal.
My current setup:
3.000 people order —> 48 GB web server (laggy) –> database (lots of write errors)
In this setup I gets lots of uncomplete & duplicate orders. Also I oversell my stock by a couple hundred items before shop displays “sold out”
My setup idea A:
3.000 people order –> 64GB / 20 CPUs web server –> 2x database (master 1 & master 2)
In this setup the shop server has more power and the database has a failsafe (second master). Priority is writing to database without errors (prevent order overload)
My setup idea B:
3.000 people order –> load balancer –> 2x shop server (each 32GB/12 CPU) –> 2x database (master 1 & master 2)
This setup also requires sticky sessions (afaik) and is probably not easy to achieve.
Honestly I have no idea what kind of setup can handle this peak load best.
By law I need SSL for collecting customer details - so this is a must.
I’m open to any suggestions (alternative setups) and/or links to any tutorials to set this up successfully.
These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.