Can-you-really-trust-Shopify-with-the-high-traffic-of-the-Black-Friday-Cyber-Monday-for-your-ecommerce-store

Can you really trust Shopify with the high traffic of the Black Friday & Cyber Monday for your e-commerce store?

Posted on July 29, 2020 by Abhishek Ranjan

 

Jonathan Woodall, who has been an online retailer for over 12 years now and have used the services of Amazon, eBay & Shopify says “I’ve never seen even once Shopify slowing down at my store or anyone else’s because of a spike in the website traffic on a sale day like the Black Friday or the Cyber Monday.”

Michael Parker, who is the marketing strategist for LuminAID.com says “ Shopify’s ability to handle increased traffic was the exact reason why we moved to Shopify from our old platform.”

To be precise, Shopify handles an average of over 40 million monthly website traffic which is enough to engulf the largest of the e-commerce networks if they do not have got an excellent server setup with fail-safes in place. They did not stop here but for ensuring a zero downtime for their store owners even during the sudden traffic spikes, Shopify has come up with an active approach for detecting and overcoming issues even before they arise. This has been one of the key reasons why Shopify enjoys the trust of over 1 million global merchants today who proudly sell all kinds of products and services.

These include tangible products like T-shirts, Denims, Custom Mobile Cases, Food ingredients, Restaurant Meals, Artwork, Cosmetics, etc. to nontangible products like Services (appointments), Memberships, Consultations, Digital products, Event support, Experiences, Classes, lessons, and workshops, Rentals, Installations (and quotes), Donations, Event tickets, and Digital gift cards.

Today, Shopify’s total platform sale to date from all stores around the world has crossed the $100 Billion mark and there is no stopping for them. On Black Friday and the following Cyber Monday week of 2018 alone the total products sold on the platform accounted for more than a whopping $1.5 Billion. It was also during this period when the Shopify networks have to handle peak orders at the rate of 10,978 per minute and peak sales of $8,70,000 per minute which is a staggering amount of traffic.

Furthermore, Shopify boasts of having a long list of clients which includes FMCG giants like Unilever, Nestle, Pepsi, Red Bull, and Budweiser, Media & Publishing Moguls like The Economist and Penguin Books, and world’s largest electric automaker – Tesla Motors. While helping aspiring entrepreneurs to launch their stores, Shopify also holds some of the world’s largest sales for the Super Bowl, Kylie Cosmetics, and celebrities like Justin Bieber and Kanye West. These “flash sales” are tricky from an engineering point of view because of their unpredictably large volumes of traffic.

So how Shopify handle the high traffic?

Frankly speaking, just thinking about the traffic which comes in for these flash sales can send cold shivering down the spine to any e-commerce store owner. For example – Kylie Jenner, who is the founder and owner of the Kylie Cosmetics, has over 24 million followers on Instagram and they go crazy during these flash sales.

Shopify’s ability to handle large chunks of website traffic has to do with the fact that the company has invested heavily in making its server grid able enough to handle the influx of sales that happen around the Cyber Monday and the Black Friday – the biggest shopping weekends of the year. They do it using a global network of top-notch, blazing-fast servers combined with a world-class Content Delivery Network (CDN) to make sure their sites stay up and running even during major traffic spikes. As a result, the Shopify server is well-equipped to respond to a variety of different occurrences that might drive heavy traffic to an online store.

Is Shopify Full-Proof to Any Downtime?

Like any website or web-based service, Shopify runs on web servers — which are basically fancy computers. And just like any computer, all servers can go down from time to time for any number of reasons.

Servers also aren’t the only “link” in the chain that powers a particular website or web service.

Web servers are typically housed in data centers, which, in turn, rely on electricity, data lines, and other utilities and services to stay up and running and connected to the web.

Shopify, like most tech companies, has engineered a highly robust server setup with built-in fail-safes and redundancies — but as with anything complex, there’s always the chance for glitches that lead to downtime.

But how long are these downtimes for Shopify?

Let’s see what Jonathan Woodall has got to say on this;

I’ve had occasional problems with Shopify.

The rate at which they occur strikes me, as a former systems administrator moved into online retail, as being consistent with an enterprise that tries never hard to avoid single points of failure and engineer scalable, reliable systems.

The ‘store employee’ end of my shop has been down, slow, or malfunctioning for maybe a total of 4 working hours in the last couple of years.

The customer-facing part of the website, including checkout, has been down, slow, or malfunctioning for a grand total of maybe 60 minutes in the last couple of years.

You really can’t ask for better than that.”

Are Traffic & Downtime the Only Things you should be Concerned About?

If you’re going to build an e-commerce store you have got to be on the lookout for the best in every aspect. And another crucial factor for ensuring peace of mind to the store owners is

Customer Service & Technical Support.

Your online store will be completely digital, and if you’re new to the scene, it’s relieving to have real live humans who can answer your questions.  Customer service at Shopify is available through all of the usual channels. You can contact Shopify support 24/7 by email, Twitter, live chat, and phone. There are separate phone numbers for customers in different parts of the world. They provide informed and friendly support though at peak times you will be required to be patient.

There are various other Shopify’s extensive resources available for locating the information you need on your own like their Online Academy, Forums, Blogs, ChangeLogs, Shopify Experts, and a Youtube Channel.

As you can see they are quite rich in resources when it comes to helping you in times of distress!

So whether you are a celebrity entrepreneur selling their merchandise or you are an artist looking to take your art global, if you are selling products online, you need to ensure that your site stays up and running no matter how many visitors flock to your website. Going with a second-tier e-commerce platform might save a few bucks in upfront costs, but it will be far more costly in the long run. A platform like Shopify guarantees that you make the most out of store visitors and will help you turn the heavy traffic into heavy revenues.

We at Spaising Technologies, are a Shopify Partner and integrations specialist, specializing in developing Shopify integrations that connect your Shopify storefront with all the necessary third-party systems and applications which are required to keep your store up and running. From ERP and CRM systems to payment gateways, marketplaces, shipment providers, and other third-party applications, we offer the best-in-class custom Shopify integrations for a seamless e-commerce experience for the owners.

concurrency-handling-using-php-mysql

Concurrency Handling using PHP-MySQL

Concurrency Handling using PHP-MySQL

Posted on October 10, 2017

 

In this blog we will take an online shopping as an example to analyse the concurrency issues and its possible solutions. You guys can refer the following database tables for the given examples:

Database Design:

Table 1: product

`product` (`productId` int(11) NOT NULL AUTO_INCREMENT,`productName` varchar(50) NOT NULL,`productDescription` text NOT NULL,`productSalePrice` double NOT NULL,`productCategoryId` int(11) NOT NULL,`productPicture` text NOT NULL,`productDateTime` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,`productQuantity` int(11) NOT NULL,PRIMARY KEY (`productId`)) ENGINE=InnoDB

Table 2: productcategories

`productcategories` (`categoryId` int(11) NOT NULL AUTO_INCREMENT,`categoryName` varchar(50) NOT NULL,`categoryDescription` text NOT NULL,PRIMARY KEY (`categoryId`)) ENGINE=InnoDB

Table 3: customer

`customer` (`id` int(11) NOT NULL AUTO_INCREMENT,`name` varchar(50) NOT NULL,`password` text NOT NULL,`phoneNumber` varchar(20) NOT NULL,`email` varchar(50) NOT NULL,`shippingAddress` text NOT NULL,`shippingPostcode` varchar(20) NOT NULL,`billingAddress` text NOT NULL,`billingPostcode` varchar(20) NOT NULL,`isLogged` enum(‘y’,’n’) NOT NULL DEFAULT ‘n’,PRIMARY KEY (`id`)) ENGINE=InnoDB

Table 4: orderdetails

`orderdetails` (`orderId` int(11) NOT NULL AUTO_INCREMENT,`productId` int(11) NOT NULL,`productName` varchar(20) NOT NULL,`productPrice` float NOT NULL,`productQuantity` int(11) NOT NULL,`customerName` varchar(25) NOT NULL,PRIMARY KEY (`orderId`)) ENGINE=InnoDB

 

Let’s go through various examples and its possible solutions:

Example 1:

Consider that customer has added the product to his/her shopping cart and has clicked the ‘Buy’ button and at the same time owner changes the product details like ID, name, price etc.  from the database.

Solutions:

To handle this problem there can be three possible solutions:

  1. When a user is logged-in, the shopping cart should get stored in the database in shopping cart table in order to link shopping basket products with the database product details table. Using referential integrity, whenever any changes are done in actual product details table, it should automatically change the product details in the shopping cart table and should prompt the customer that “product details are changed do you want to continue” using AJAX. But this process can irritate customers.
  1. Another way of doing it is that the shopping cart should not refer the actual product table. Once the products are added to the shopping basket, the shopping cart table can be used as the final table to purchase the products even if the product details get changed in actual product table.
  1. Another neat and clean way of doing it is that whenever owner edits any product details, instead of changing the same product id he/she should add the new product id of the changed product so that old product details will remain same and changes will be considered as new product itself. This way, it will not affect the customers purchase and they will be able to buy the same product which was added to the shopping basket.

One of the problems of storing the shopping cart in the database is related to the real time data required for multiple customers logged in at the same time. If a customer adds a product to the shopping cart but doesn’t buy the product, then the product is still stored in the basket and it may happen that due to limited quantity available, other users have to wait for the same product to buy. Session variable automatically get expired as soon as customers logged out or browser is closed. To handle this, similar method can be used to clear the shopping basket table in the database. A database trigger can be written which will check that at what time the product was added and if the time elapsed is more than a pre-defined time, it should automatically expire the customer ‘s shopping basket. At the same time, it should inform the user that time has elapsed due to which the basket is expired. Trigger should run automatically after few intervals.

 

Example 2:

Consider example when two owners are trying to change the details of the products at the same time.

Solutions:

It can be implemented by locking the table or row of the table. Myisam table supports only table level locking while InnoDb supports row level locking. I personally prefer using InnoDB over Myisam as it has better features related to ACID properties, that we can discuss in some other post.

In this case optimistic lock can be used when first owner makes and commit the changes and when second owner tries to commit his/her changes, he/she will get the conflicts and will come to know that somebody else has made the changes in that version and second owner can update his changes using updated version.

Another way of handling the above case is to add two fields to the product table:

LAST_LEASE_TIME: Time of the last lease

LAST_LEASE_USER: User that leased the record for the last time.

When a user tries to edit the record, application will first check that the record is not leased, or that the lease has expired (i.e. the lease is not older that the specified lease time) or the owner is the one that has granted the lease.

Web application will periodically renew the lease, for example with an AJAX call. When the user ends editing the record, it explicitly expire the lease. This way it will not allow another owner to edit the same product. This is similar to pessimistic locking.

 

Example 3:

If only one quantity is left of a particular product and at the same time multiple users are trying to buy the same product, there is a probability that the time difference may be less than even few milliseconds for two different users.

Improvements:

This can be improved by using the pessimistic lock in the above scenario. In this case first customer will lock the product so that nobody else will be able to access it and after buying the product the lock will get removed. The reason of using the pessimistic lock instead of optimistic lock is that the chance of conflict between concurrent sessions is high where one of the customers will get dissatisfied after going through the long process of adding the product to the shopping cart. To avoid this, pessimistic lock is better option in order to avoid the conflicts. The disadvantage of this may be in cases where a customer has locked it and is not buying the product. In this case after few minutes locks should get released. Still, always using the pessimistic lock is not the good option as it is a long transaction and long transactions are never a good option but in this case it can be considered by checking the availability of product quantity. If product quantity left is one then pessimistic lock could be used and if product quantity is greater than 1 then no locking is required.

 

Example 4:

Suppose a product is left having one quantity only and this product is added by multiple users to their basket, but till now nobody has bought the product. Now one of the customers buys it and when other customers try to buy it, they will not be able to buy it. This will irritate them as they have gone through the long process of buying it. It is the next stage of example 3.

Solutions:

If the above situation occurs, the website should simply displays the error message but it can be improved by removing the item from ‘Available Stock’ of product table and put it in a ‘Pending Sale’ state along with a timestamp and session ID. Implement the session state so there is a timeout. Periodically check ‘Pending Sales” for items that have significantly exceeded the timeout and return them to ‘Available Stock’. When completing a transaction, application can check ‘Pending Sales’ for an item with a matching product and session ID. This should find the product. If for some reason it cannot be found, application will need to report it internally to a ‘Support’ person for resolution. To make it more user friendly it should be informed to the customer that “Few minutes left to buy this product” using AJAX.

 

Example 5:

Consider if monthly report has to be prepared by owners of the company. To do that Mr. ABC tries to retrieve the number of products that are present under ‘Samsung’ (contains 4 products) and ‘iPhone’ (contains 6 products) categories. First he retrieved the information from ‘Samsung’ category and got 4 products. In the mean time he went busy in doing other stuffs and at the same time Mr XYZ added the new products in both the categories. Due to the changes made by MR. XYZ, now ‘Samsung’ category has 6 products and ‘iPhone’ category has 8 products. Mr. ABC came back and retrieved the number of products from iPhone category and got 8 products so now according to Mr. ABC total count of both the categories is 4+8 = 12 products which is actually not correct. Either he should get 10 products or 14 products, but 12 products count is not correct.

Solutions:

This scenario can be handled by using the optimistic lock. In this case, both the users will work on different versions so that the proper information and database integrity is maintained.

 

Through this blog we have tried to show my own version of understanding the concurrency issues and its solutions using above examples that how differently we can manage it either by table/row level locking or by session ids or by different time stamps. There could or there are different other solutions are available using which system can be improved. Concurrency is one of the most hot topic of web based applications which always comes with its different concerns and solutions.

10-usability-heuristics-for-user-interface-design

10 Usability Heuristics for User Interface Design

10 Usability Heuristics for User Interface Design

Posted on June 13, 2017 by Spaising

 

1. Visibility of system status
The system should always keep users informed about what is going on, through appropriate feedback within reasonable time.

2. Match between system and the real world
The system should speak the users’ language, with words, phrases and concepts familiar to the user, rather than system-oriented terms. Follow real-world conventions, making information appear in a natural and logical order.

3. User control and freedom
Users often choose system functions by mistake and will need a clearly marked “emergency exit” to leave the unwanted state without having to go through an extended dialogue. Support undo and redo.

4. Consistency and standards
Users should not have to wonder whether different words, situations, or actions mean the same thing. Follow platform conventions.

5. Error prevention
Even better than good error messages is a careful design which prevents a problem from occurring in the first place. Either eliminate error-prone conditions or check for them and present users with a confirmation option before they commit to the action.

6. Recognition rather than recall
Minimize the user’s memory load by making objects, actions, and options visible. The user should not have to remember information from one part of the dialogue to another. Instructions for use of the system should be visible or easily retrievable whenever appropriate.

7. Flexibility and efficiency of use
Accelerators — unseen by the novice user — may often speed up the interaction for the expert user such that the system can cater to both inexperienced and experienced users. Allow users to tailor frequent actions.

8. Aesthetic and minimalist design
Dialogues should not contain information which is irrelevant or rarely needed. Every extra unit of information in a dialogue competes with the relevant units of information and diminishes their relative visibility.

9. Help users recognize, diagnose, and recover from errors
Error messages should be expressed in plain language (no codes), precisely indicate the problem, and constructively suggest a solution.

10. Help and documentation
Even though it is better if the system can be used without documentation, it may be necessary to provide help and documentation. Any such information should be easy to search, focused on the user’s task, list concrete steps to be carried out, and not be too large.