Jump to content

Stock handling during high demand / peak hour


Recommended Posts

Hello PS community,

there will be lots of people waiting on my website for one particular item to become available.

 

Because of the high amount of simultaneous orders (approx. 2000 people ordering at the same time) other ecommerce solutions oversold my stock by a couple hundred items before this item became unavailable - so I had to refund hundreds of customers.

 

My questions are:

1. Is it possible to reduce stock amount as soon as checkout is complete - without payment confirmation since I use bank transfer only.

2. When people have an item inside their cart and during their checkout process the item becomes sold out - will they be prevented from completing the checkout to avoid overselling?

Link to comment
Share on other sites

Thank you very much DH42 - then PrestaShop is exactly what I was looking for  :)

 

Since my next question still fits the thread title:

Are there any recommended tutorials available here to integrate multiple databases / load balancing?

 

@Dh42

I've visited your website already and found lots of useful information.

My apologies if this question overlaps with what you offer as a paid premium service.

I just want to be able to do all the tweaking myself and willing to invest the time to achieve this.

Edited by GoodFellow (see edit history)
Link to comment
Share on other sites

There really aren't any that I know of. We did an article about how we set up a few AWS sites, I don't know if you have read it yet. One thing you have to realize is that when you start adding a load balancer and other instances, your costs rise significantly. I cannot think of one site we have done that used a load blanacer that was not paying less than $3k usd a month for hosting. 

 

The general rule we go by is to try to keep it on one frontend and one backend server as long as possible. But when you out grow that I would start looking at replication for the database first. PrestaShop supports slaves that you can use in your replication as well, there is a slaves file in the config directory of your shop. 

 

Do you have any specific questions about scaling across multiple instances? 

  • Like 1
Link to comment
Share on other sites

Do you have any specific questions about scaling across multiple instances? 

Thanks for asking - yes.

I only need a "beast"-setup for 1 day before I downscale again.

 

My demand is:

- approx. 2 - 3.000 people visiting my site at the same time during this peak hour - while continously refreshing the page (hitting page reload) until item becomes available

- then everyone storms to checkout to purchase item before it's sold out (this always messed up my database in the past)

- each customer receives a purchase confirmation email after checkout 

- after a couple hours the madness is over and I can return to a simple 1 GB / 1 CPU cloud server

 

My plan would be:

1x cloud server 64GB RAM / 20 CPUs  (just for this one day) and add database slaves as recommended

 

Do you think I'd be fine with this without generating database write errors?

Link to comment
Share on other sites

Yes, but people purchase this like any other regular item, e.g. a DVD.

Before that I used a dedicated server feat. 2x Intel Xeon 2,4GHz, 48 GB RAM, 12 cores (24 hyper threading) and people could navigate the page fine - just the order process generated lots of errors.

 

What would be your recommendation?

Link to comment
Share on other sites

it's just a simple show ticket, just like

add number of tickets to cart --> checkout --> confirmation email --> done

 

there are also no variations/categories/discounts - just this one ticket with one fixed price

tickets will then be send via traditional snail mail / registered letter

 

so basically it's like buying any other single physical item in the shop

Link to comment
Share on other sites

One of the first things I would recommend is setting up a landing page in static html, or with one simple php expression for every ticket release. Basically have the landing page a html page that tells about the event, funnel everyone to that. That is the page they will keep on refreshing. Then I would have a php expression that when the time is xx or after, a button would appear taking them to the actual product page. That way the brunt of the force on the site is on a static html page not eating up resources against the database and compiling files.

 

Then I would write a module that queries the stock and when it hits 0 start sending everyone back to a sold out html page. That way it will do the same with taking the force off the site and checkout. At the same time on the first run of the module I would empty every cart that has the product in it too, and redirect them to the sold out page as well.

 

As for what server size you would need, I have no clue. We do load testing to try to determine that, there really is no way to guess since every site uses a different amount of resources because of the modules / themes / and other settings. 

  • Like 1
Link to comment
Share on other sites

×
×
  • Create New...