Citilink
cover

Increasing
the product
catalog’s availability
and reliability

Citilink is one of Russia’s top online discount stores. Its extensive network of outlets and depots offers a wide variety of products. In 2020, Citilink’s sales amounted to 132.7 billion rubles, which makes it the third-largest company in Russia.

Scroll

Objective

In 2010, Citilink’s data on inventory items, including stock status and prices, was stored in a relational database. This database was accessed through a monolithic service based on the Symfony PHP framework. Year after year, the load was increasing, and the relational database could no longer handle it.

For a long time, Citilink has been using a cache system, which reduced write and read load on the database. However, that system was becoming increasingly complicated. Caches had to be invalidated to guarantee data integrity in case of a reboot. At some point, the cache size reached 100 GB. Now it was more viable to put data in an in-memory database than to cache it.

Four main factors can explain the rapid increase in data and the complexity of architecture planning:

  1. Assortment expansion: There is a 50–100% annual increase in data.
  2. Continuous price updates: Every day, 20 million product prices are updated. They are automatically recalculated at least once a day for inventories in every region.
  3. Continuous inventory data updates and requests: Citilink distributes goods through different channels such as the company website, terminals in retail stores, the contact center, and marketplaces.
  4. Increase in website traffic: 30–50% annually. The system must be able to handle a load of 2 million writes per minute.

Requirements

High availability even if a data center is lost

Ability to handle a load of 2 million writes per minute and up to 40,000 reads per minute

Low instance start overhead---one developer can deploy a new instance in one minute

Easy scaling and containerization

Solution

Solution

Data
access scheme

Solution

Solution

icon

The developers tested many DBMSs. Some of them didn’t support ACID, and others had a complex, entangled architecture. In 2018, the Citilink team piloted Tarantool in the master-master replication mode. After that, the team attempted to implement Tarantool as a monolithic replacement for the DBMS in use. However, tests showed that Tarantool isn’t too efficient when used as a monolithic solution in a data-intensive system. Therefore, the development chose the following approach:

Solution

icon

  1. Create a custom DBaaS based on Tarantool to deploy new database instances more quickly.
  2. Start using Tarantool in 2019 as a database for all new projects.
  3. Launch monolith decomposition, separating microservices and transferring data from the relational database to Tarantool instances.

Tarantool, as used in Citilink, is characterized by master-master replication. This is a fairly rare Tarantool replication mechanism. However, it has two key advantages:

Data
access scheme

Solution

icon

High availability in case of server shutdown or data center failure. Citilink stores its data in two data centers. Each one of them has a number of servers where databases are running. Every server can host several Tarantool instances, depending on the amount of data in those instances. In case a data center goes down, each database instance in it has a replica in the other data center.

Blue-green deployment. Master-master replication in Tarantool allows quickly and easily building a system to seamlessly transfer application or service traffic from the old version to the new one.

Key takeaway: The solution can process a load of up to 2 million writes per minute and allows continuously keeping the product catalog up-to-date.

icon icon icon
Scroll

Results

3 s

The catalog is fully updated in 3 seconds instead of 10–30 minutes

< 30 ms

Data is provided in less than 30 milliseconds

70

70 database instances for the most data-intensive services

No cache

No caching, simpler code, more relevant data

1 min

DBaaS allows achieving a time to market of one minute instead of two weeks

10×

Increased availability

Get a consultation

Order a demo

Thank you for your request

Tarantool experts will
contact you shortly