blog-banner

For high availability & low latency: Architect a globally distributed eCommerce system

Last edited on July 29, 2025

0 minute read

    eCommerce is a broad domain, but at a basic level it encompasses any business that primarily buys or sells goods or services over the internet. This includes all sorts of companies from classic retailers and marketplaces, to food delivery and online travel. 

    In this space, customer expectations are extremely high. They want a personalized experience, fast access/answers, and have zero tolerance for downtime. Not only do businesses have to accommodate a demanding customer, but they also have to figure out how to serve a geographically dispersed user base. 

    In this post, we will first examine all of the components that can make up an eCommerce system. Then we will take a look at some best practices to building a highly available, global eCommerce system without adding operational complexity. 

    eCommerce components: from customer-facing systems down to the supporting infrastructure Copy Icon

    A modern eCommerce system is a stack of interconnected layers, each with a critical role to play. Here’s an example of what this might look like in the context of a B2C company: 

    [image] eCommerce components

    At the very top, the customer-facing layer encompasses all the digital touchpoints such as websites, mobile applications, and content management systems that customers engage with every day. This is the place where customers expect to see personalized experiences and gain fast access. 

    Beneath this is where the core functional modules live and where essential business logic resides. This includes components like shopping carts and checkout, transaction processing, and catalog and merchandising. It’s important that this data is always correct which relies on a database with ACID guarantees

    Supporting these functions is the operational backbone, the engine room of the platform, which ensures everything runs smoothly for the top layer. This may include areas such as fulfillment and inventory, and customer relationship marketing. The database plays a vital role here, and ideally will provide the ability to scale services and deliver the resilience needed to guarantee zero downtime. 

    Finally, at the base of the stack, we have insights and infrastructure which include analytics and business intelligence. These services rely on fast access to data which can be enabled through capabilities such as changefeeds so that insights are continuously up to date. It also is where security is a core component of the infrastructure. 

    To support eCommerce services, your database must guarantee data correctness, resilience, and enable scale. And to support a global user base, a distributed database foundation is a must.

    Benefits of distributed eCommerce: global scale, no downtime, guaranteed consistencyCopy Icon

    Distributed eCommerce is a method used to architect systems in which the eCommerce application is stateless. This means that database nodes can easily be added or subtracted to adapt to fluctuations in workload volume. Scaling up or down to meet demand becomes straightforward with a distributed database like CockroachDB since individual instances can be easily added or removed without manual sharding. 

    CockroachDB distributes data automatically and evenly through load balancers and intelligent rebalancing. This is done within a single region architecture, or when spanning multiple regions in different geographic locations as illustrated below.

    [image] eCommerce scale

    CockroachDB also ensures data consistency regardless of how much you scale with support for ACID transactions. This capability is vital for the transactional data that supports applications such as shopping carts where no data loss or inconsistency can be tolerated. During a failure, true consistency is maintained even when running across multiple regions which prevents data from being compromised. 

    When it comes to other types of failures, or rather unplanned downtime, CockroachDB remains resilient thanks to its distributed nature and built-in fault tolerance. This includes all types of common scenarios such as node failures or disk failures, disk stalls, network partitions, region failures, cloud provider failures, etc.

    Downtime is not an issue for planned maintenance as well – CockroachDB allows you to conduct operations such as scaling up/down, schema changes, upgrades, cluster settings changes, primary key changes, backups, etc. all while the database is kept online.

    Control over global data: low latency access for customers and systemsCopy Icon

    When serving a widely distributed user base, there’s a huge benefit to scaling out across multiple regions. Not only does it aid with availability, but it can reduce latency for the customer when data is kept in certain locations via data domiciling. This capability also can help with meeting regulatory compliance such as the EU’s GDPR, California Consumer Privacy Act, or Digital Personal Data Protection Act in India, since you can control where data resides.  

    More specifically, CockroachDB enables you to control data locality at the table level, delivering granular control to match your use case requirements. Data can be read or written across all regions of your cluster, but tuned to meet the challenges you face at a table level. In fact, you can alter the locality of your data as your requirements evolve without taking the database or table offline as mentioned above. 

    Let’s take a look at what this might look like for an eCommerce application running across multiple regions:  

    [image] eCommerce schema

    Using CockroachDB’s table locality features, we can optimize access to the table’s data whether it's for an internal system or the end user. Here’s what the different labels mean: 

    • Regional Table: Data is kept in a primary region for best performance, but is still accessible from other regions with a small latency tradeoff. The inventory tables are regional so that it’s kept close to fulfillment centers.

    • Regional by Row: Rows are stored in the region closest to the customer who created them which is great for personalization and latency sensitive data. Several customer facing tables in the diagram have this label.

    • Global Table: Delivers fast, read access worldwide, but writes are less performant due to global consensus. The item table is labeled as global since items are being viewed often.

    With CockroachDB, you have powerful options for optimizing your data placement. Traditional relational databases struggle to accommodate this diversity of needs for eCommerce systems. 

    SummaryCopy Icon

    eCommerce systems are prevalent in our everyday world, and as consumers, we feel the pain when they aren’t working up to our expectations. The right foundation for an eCommerce system delivers always-on availability, guaranteed data consistency, and effortless scale. You should be able to achieve low latency where it matters most, ensure compliance with data residence rules, and deliver a performant eCommerce platform to users across the globe. 

    We recently covered this topic in a Use Case Cafe. You can watch the video and demo here:

    If you’d like to get in touch with a Cockroach Labs expert to see how we can help you with your eCommerce system, click here.


    Special thanks to Jason Haugland, Solutions Engineer at Cockroach Labs, for providing content for this post. 

    eCommerce
    Online Travel
    Retail