CASE STUDY

E-Commerce

Lush is building global inventory management with CockroachDB

Global cosmetics manufacturer and retailer Lush operates 900+ stores across 47 countries and processes 165k transactions daily

  • 47 countries of operation

  • 6 years of using CockroachDB

  • 71+ engineers across departments

  • 900+ retail stores

About Lush

Lush Fresh Handmade Cosmetics is a global inventor, manufacturer and retailer of fresh handmade cosmetics founded in 1995 in Poole, Dorset and has grown to operate in 47 countries with over 900 stores. Their UK stores alone process 165,000 financial transactions daily.

Originally, Lush’s database architecture was made up of MySQL instances in 20 of the countries in which Lush operates. While this architecture was an integral part of the company as it grew globally, it created a lot of operational complexity. In particular, the disparate MySQL instances could not talk to each other, which made it difficult to optimize inventory or evaluate the company’s performance on a global scale.

Lush’s challenges & requirements

Efficiently managing inventory across 900+ stores across 47 countries is no small task. With dozens of MySQL instances spread out all over the globe, Lush was unable to see real-time analytics on their inventory, limiting their ability to rapidly adjust strategy. Lush promises to deliver the freshest products from source to skin, so the lack of visibility into the quantity and age of each product made it hard to avoid overstocking or understocking.

Closely related to the inventory challenge is the difficulty of evaluating the business on a global scale. There was no easy way to immediately access the performance of Lush’s products across the globe. If their data was located in the same system, it would be much easier to interrogate that data. 

Adding further challenge, is the emergence of data protection laws and data localization regulations. As an international retailer that does business all over the globe, Lush is required to domicile some user data in particular countries. This is the cost of doing business on a global scale, and it has been incredibly tricky to accomplish. 

Lush wanted to simplify and modernize their data architecture in order to make it easier to analyze the company’s global performance, comply with local data regulations, and reduce operational complexity. Their requirements included:

  • High availability
  • Cloud-neutral
  • Easy management of global user data
  • Standard SQL and simple insertion and extraction of data
  • A managed offering

Lush first turned to Google Cloud Spanner in their early efforts to modernize their database. They quickly ran into a couple of problems:

  1. Cloud lock-in: Using Spanner locked Lush into the Google Cloud ecosystem. Even tasks like exporting data to CSV required use of Google products like exports to buckets.

  2. Blackbox nature: The lack of visibility into Spanner made it difficult for the engineering team to troubleshoot. Lush scaled to 10 nodes without issue, but they had to make that decision blind. Whereas with CockroachDB, they’re starting with 3 nodes and they can see everything that’s happening.

  3. Custom programming language: Spanner speaks a custom query language, rather than the standard SQL. This would require Lush’s engineering team, already versed in SQL, to learn a new programming language in order to program against Spanner.

Lush ultimately determined that Spanner was not the right solution and began evaluating alternatives. Their research led them to CockroachDB.

Building on CockroachDB

Lush began evaluating CockroachDB in 2017, and out of the box, CockroachDB met their most pressing requirements. To start, CockroachDB is a source-available database with 100% visibility into the code. It uses standard SQL, making it easy for the Lush team to get up and running quickly. 

Lush also had exceptionally high availability requirements. As a global retailer that processes 165,000 financial transactions per day, it was critical that their database be ultra-resilient and not have issues with outages or downtime. CockroachDB delivers zero RPO (recovery point objective) and an average of 4.5 second RTO (recovery time objective), ensuring that data is never lost and applications are highly available.

With CockroachDB, Lush can pick and choose where data is stored, satisfying both data sovereignty concerns and the need to have a global view of data. This is really powerful for their team because it allows us to be smarter about how we handle stock which is a very large data set.

Finally, Lush was seeking a managed database so that their engineering team could focus on application development, not on maintaining third-party software. When they began their evaluation in 2017, the managed version of CockroachDB was in development, and Lush became a design partner as the offering was brought to market.

Optimizing global inventory management

Lush plans to use CockroachDB for many different use cases, including as the system of record for all orders. The rollout will begin with all stores in the UK, of which there are over 100, and will expand to include all 900+ global stores. 

Lush will also be deploying CockroachDB as their inventory management database. This would give Lush a real-time view of global inventory, allowing them to see how much product they have in a particular store, in a particular country, and in the entire world – something they haven’t had visibility into before. Increased visibility into their inventory enables Lush to optimize the strategy with which they stock their stores. It allows them to avoid ever being understocked and to proactively take advantage of trends they see in particular regions. 

At the same time, Lush can partition data to a particular region without losing the ability to access and analyze that data. What became particularly attractive to Lush is that they can configure their database before they decide where they need to partition. They can then retroactively pin user data at the row level in regions where data domiciling is required. This has been particularly powerful for them because it allows them to be smarter in how they handle stock and inventory globally.

Bonus: Operational management relief

Reducing operational complexity is addition by subtraction. With CockroachDB, Lush no longer manages dozens of MySQL shards. CockroachDB’s ability to auto-rebalance, auto-recover from failures, and scale without manually sharding data relieves Lush’s engineering team of huge management overhead.

Additionally, since Lush operates the managed version of CockroachDB on Google Cloud, they are able to reduce their operational management even further. This allows their developers to focus completely on application development without worrying about the underlying issues that surround distributed systems of any kind.

What’s next for Lush

Having a truly global database means that Lush is unlocking previously impossible use cases, while also discovering new use cases they hadn’t thought about before, simply because their mindset was tethered to localized data stores.

Lush will continue to deploy and scale CockroachDB as their inventory management database as well as their transaction database for all the retail locations in the UK, with plans to expand into every country in which they have stores.

Ready to get started?