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.

Show comments

Submit an answer

This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

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.

This question was answered by @jasonruyle:

That is a lot of concurrent users, but you may need to look into locking your database writes. That would solve your transactions issues, but this will cause additional demand on your database. Make sure to allocate enough memory for your database, make sure everything else is cached on the site.

I run a site that has handled around 1500 concurrent users over a few hours, it had a proxy server in front, web server and database server. It would have run faster if the database server was on the same server as the web server.

You could also look into Redis to help speed things up. I would look at speeding up your site and solving your overselling issue before you jump to more servers.

View the original comment