Handling large amounts of website traffic.
Tags: devops, retail, webtraffic, watercooler
Published: 2021-03-09 21:02:45

### Made the Headlines

Earlier this year Playstation 5 hit the UK market, with many retailers struggling to supply the popular demand. Majority of these retailers websites couldn't handle the stress put on their servers, with avid gamers flocking in their hundreds of thousands the sites simply crashed, and not just the PlayStation pages, no the entire site preventing the average shopper from even making any early Black Friday purchases.

PC World admitted they'd had customer accidentally purchasing PlayStation 5 consoles before the nationwide scheduled release, and had to even cancel their orders saying a refund would be with them within 5 days, but this wasn't done until much later on in the day.

#### Possible Causes?

There are numerous reasons for this, and in my opinion, they could be:

- Poor quality servers
- Poor load balancing
- Automated "bots" hammering the site
- Poor site queue management
- Poor stock management and updates.

### Servers and Load Balancing

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ixm9j8pwqjvrokq97gvu.png)

Load balancing is the process of redirecting/splitting multiple requests to the same domain across multiple servers, using a middle-ware load balance server.

In this analogy :

- Cars = users making requests
- Parking GateKeeper = load balance server
- Parking Attendant = website servers
- Parking bay= content

You drive your car to an event and get the to the gate. A parking steward will then stand in your way preventing you from getting in. They will then direct you where there are free spaces. You go off to the left, then the next car is told to go to the right, and the next forward. You've all gone in different directions, then the parking attendants show you a parking bay.

There you have it you all entered the same gate, the job of getting you to your bay has been delegated and shared out, thus speeding up the process and alleviating the stress on one person of doing all the work.

Without load balancing, you all queue up to get into the event, and 1 by 1 you enter the gate. The one poor parking attendant (server) working on his own has to show all those cars where to park (handle website requests). That's going to lead to backed up queues, put a lot of stress on the poor worker (server) and eventually the parking attendant is going to crash and burnout (server crashes).

This is why load balancing is so important, and it needs to be implemented well to handle huge amounts of traffic like launch day sales.

### Attack of the Clones

This traffic isn't always just avid gamers or family trying to get their loved ones the latest games console or piece of tech. No there are the dreaded "bots".
To bypass all restraints and sitting in lengthy queues, some have turned to computer software to buy tech online. The right bot can be bought off the internet for as little as £20.

For those unfamiliar, shopping bot apps are essentially automated e-commerce services that help customers buy exclusive items without having to wait by their screens. They can then can be programmed with a name, address and bank details, so that as soon as that much-anticipated drop is announced, fans can hit go and the program will head to the retailers' systems, often bypassing their security, and buy those sought products.

While they’ve been around for a couple of years, their influence on the e-commerce industry is being felt more and more each day. These can be in the form of a website or an app you can install on your phone for a fee. Common sites include ESnipe (an bid on your behalf eBay site), and the infamous SupBot (for IOS) which was removed from the AppStore last year.

There are other selfish bots created by people for their gain; ones that scour the world wide web buying stock in large volumes. By being automated they can find products quicker, fill in delivery forms and payment details much quicker than the average human, pipping them to the post. They then go on to sell these products at a premium price elsewhere.

### "Take a ticket and get in the queue"

When the Playstation was released this week some big companies like Currys PC World, and GAME Digital, initiated a queuing system, in which when you accessed the site you were placed in a queue, and after some time could then access any part of the site.

In my opinion, this way of doing things is flawed. It makes the whole site inaccessible to the general public just wanting to buy any none launch products.
How would I solve this problem? Well, firstly companies know about launch titles and products for months and months on end so they should be more prepared for these launch day / pre-ordering days. It's not the first time they've done this, it's not some new phenomenon.

For me, the queuing, pre-ordering and marketing process is the biggest problem. You go online, and sites shove a big banner in your face saying "Sign up now for updates on when stock is arriving, and get in the queue first". Thing is these emails never arrive, or they arrive after the queue has opened, deeming them obsolete.

Misinformation is the other key problem. Informing customers of launch times, and then selling the product before this causes nothing but angst and annoyance amongst customers.

PC World stated that they were launching the PS5 at 9 am on Thursday, yet people were able to buy the product at 5 am causing huge problems in the stock control system, meaning they had to tweet that the sale was firstly delayed, and then cancelled completely.

Game had issues also; they tweeted stating that their stock was delayed, and they were going live later that day (but weren't saying when). The dedicated customers waited and waited to refresh their browsers until they became available. Game then tweeted saying their stock was now available at 12:40; like others, I joined the queue and waited agonisingly. However I learnt reading other tweets others had been in "newly created queue" 40mins before that tweet going out, so had already got the head start. My late joining meant I was #69,554 in the queue. With no idea of what stock was left and whether I should bother continuing to wait, I persisted. It took over 2 hours to receive an update on the page to say "The stock has now gone, no more items will be sold today".

### My Solution

Separate the product being launched, or on offer onto another server of its own, or as said before several servers (and load-balanced).
Redirect all traffic associated with the product to the new server, isolating it away from other main servers for the rest of the site.
The queuing system:

Customers sign up for interest in the product these people receive an email 30mins before the "general public" to access the queuing system.

To prevent _"bots"_ from exploiting this process, you must choose a shipping address from an address lookup tool, once this address has been chosen it cannot be chosen again; must answer a Recaptcha question, and take a selfie with either your laptop or smartphone to prove you're a human. Excessive? potentially however it would solve so many problems.

When they access the link they are placed within a queue. And it works on a first come first serve basis. There is a strict lock on the access to the product page, and nobody can access until a certain time. The site is off-limits and unavailable to anyone other than via the queue, and the queue is the only way in which you can access, and this is controlled and drip-fed on a 1 in 1 out basis (feeding 'x' amount of users initially).

You have 10 minutes to complete your order and pay for the item. This prevents "Hoarder bots" hoarding stock for large periods - these are bots that purposely keep adding the product to the basket and not completing. Many companies employ a stock system in which when the item is added to the basket it reserves this item from the stock management for some time. A hoarder bot will never allow the item to be returned by continually re-adding the product once the allotted time has passed.

If you exit the site or leave the queue you are moved to the back of the queue and will not get another chance to get back until it's your turn and you are fed into the site, this will also prevent bots from just smashing the site.
Potentially displaying remaining stock on the queuing page, so that the stragglers in the queue know if its worth waiting or not.

### Closing Statement

There we have it sites need to have better control of how and more importantly who accesses their sites and can purchase stock.

I feel that the government and trading standards need to introduce some legislation or tighter restrictions on reselling of pre-ordered and newly bought products for a premium price. I've seen so many re-listed Playstation 5's on eBay and other selling sites in the last 2 days, with an average, upsell price of 95%.
Either way, retailers need to be more accountable for their poor stock control, taking payments for the stock they don't have (Currys PC World) and having to refund customers (who have then missed out on purchasing elsewhere); be accountable for preventing bots.

Other sites such as eBay should be forced to disallow users from selling certain products above a certain price also. This is no different than re-selling concert tickets, and they've measures into place to help prevent this, why can't it be applied to the e-commerce industries.