BT

Your opinion matters! Please fill in the InfoQ Survey!

GoTo Copenhagen 2017: How Shopify Powers Online Commerce

| by Andrew Morgan Follow 0 Followers on Oct 30, 2017. Estimated reading time: 2 minutes |

A note to our readers: As per your request we have developed a set of features that allow you to reduce the noise, while not losing sight of anything that is important. Get email and web notifications by choosing the topics you are interested in.

Simon Eskildsen, senior product engineering lead at Shopify, gave an overview of how Shopify is architectured to support large sales at GoTo Copenhagen 2017. This included their OpenResty configured NGINX instances, shop and pod isolation architecture, failover strategies and more.

Shopify powers a huge amount of online commerce, supporting over 500K merchants, explains Eskildsen. One of their main requirements is to deliver flash sales for their customers, many of whom are only online shops. Whilst driving the sales traffic itself can be straightforward, the main challenge is creating an architecture that can cope with the spikes.

Eskildsen explained that one of Shopifys first optimisation challenges is at the DNS layer. Whilst it’s easy to optimise traffic at the DNS layer with a single domain, with multiple domains it’s not possible. This is the case with Shopify, where multiple customer domains all point to their IP. Instead, they made use of TCP/ICP anycast, a “gossip algorithm where each ISP is telling each of its neighboring ISP which IPs it knows how to route”. Essentially, this leads to traffic always picking the closest IP.

Shopify also makes heavy use of OpenResty, a tool which allows an NGINX load balancer to be scripted with Lua to do whatever is required. Eskildsen emphasized that in the case of Shopify, OpenResty has been extremely powerful, and believes in general that it is underused within the industry. He listed some of their modules as:

  • Rule banner: detects bots by looking at patterns such as irregular refreshes and suspicious IP addresses, and then bans them. The goal is to shut down secondary markets.
  • Edge cache: a caching optimisation which allows serving content from cache at the loadbalancer tier rather than the application tier.
  • Checkout throttle: throttles writes for some merchants in exceptional load circumstances by queuing them, preventing a shop from becoming a noisy neighbor to others on the same shard.

At the application or data tier, Eskildsen also introduced the concept of a pod, a fully isolated Shopify instance which can contain many shops. Interpod and intershop communication is not possible by design, as isolation between customers is key: “Shop isolation principle - all shops must be isolated from each other”.

Whilst each pod contains its own stateful services (such as databases), stateless services are shared. Eskildsen explains that the main reason for this is that auto-scaling introduces too much of a bottleneck; traffic spikes would come faster than new infrastructure can be provisioned.

Eskildsen also gave an overview of their pod load balancer, which balances shops between pods and makes sure that load is evenly distributed. To do this quickly and without loss of data consistency, they make use of the MySQL bin log to stream events of database modifications from the old to new instances. 

For cross-region migration, Shopify also has a component called pod mover, which moves pods between regions with minimum downtime. This is invoked if a region is not functioning, but Eskildsen explains that the end goal is to be able to issue a Slack command in order to trigger this type of a failover whenever they want.

The full talk is available to watch online, with a more detail exploration or the architecture.

Rate this Article

Adoption Stage
Style

Hello stranger!

You need to Register an InfoQ account or or login to post comments. But there's so much more behind being registered.

Get the most out of the InfoQ experience.

Tell us what you think

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Email me replies to any of my messages in this thread
Community comments

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Email me replies to any of my messages in this thread

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Email me replies to any of my messages in this thread

Discuss

Login to InfoQ to interact with what matters most to you.


Recover your password...

Follow

Follow your favorite topics and editors

Quick overview of most important highlights in the industry and on the site.

Like

More signal, less noise

Build your own feed by choosing topics you want to read about and editors you want to hear from.

Notifications

Stay up-to-date

Set up your notifications and don't miss out on content that matters to you

BT