Case study · Inventory sync · Shopify ingestion

A larger database didn’t fix inventory sync

How Rakt Innovations resolved Shopify sync bottlenecks, cut its database bill by about 50%, and created headroom for new clients.

The business problem

Rakt Innovations syncs inventory data across multiple sources for its clients. Shopify sync repeatedly drove database CPU to 100%, causing delays, errors, and reduced functionality. The database instance had been increased to three times its original size, but the interruptions continued.

The system combined Python, Django, Redis Queues, PostgreSQL, and Kubernetes. Its workload included user requests, third-party webhooks, and queued jobs. Activity varied by day and hour, with additional bursts during customer onboarding.

Workload context

User requestsShopify sync / source integrationsQueued jobs · Redis / RQ
Python / Django applicationBusiness workflows and database access
PostgreSQLObserved symptom: CPU spikes at 100%
Sources of application work, simplified from the original account. This diagram shows workload flow, not deployment topology.

The engagement

I spent the first week stabilizing the system, locating hotspots, and extending monitoring. In the second week, I worked on throughput and database resource use. An additional day went into a roadmap for architecture and codebase improvements.

How I approached the investigation

Connect database pressure to application activity

The CPU spikes gave the investigation a starting point. The technical account describes examining active operations, table access patterns, index usage, and query statistics to connect database pressure to application activity.

Examine the business workflow behind the query

A slow query can reflect how the application uses data. The technical account explains how to trace queries back to ORM code, look for repeated work within a workflow, and check whether storage design fits the read and write patterns.

Compare measurements after each change

The approach was to make changes incrementally and compare metrics after deployment. Measurements needed to cover recurring jobs and workload peaks, rather than only a quiet period.

What I changed

1. Removed repeated read work across workers

The application issued thousands of redundant read requests through multiple workers. I changed how those reads were sequenced. After this change, fewer than half of the original read requests were needed.

2. Added missing indexes on the busiest paths

The investigation identified missing indexes for frequently used access paths. I added indexes for those paths so the database could serve the relevant queries more efficiently.

3. Removed redundant indexes

I removed redundant indexes as well as adding the missing ones.

The results below describe the combined engagement. There is no separate measured contribution for each change.

Reported results

MeasureReported outcome
Application throughputIncreased 10×
Database instance sizeReturned to the original size, one-third of the expanded instance
Database billObserved reduction of about 50%
Growth capacityHeadroom to onboard new clients
Database CPUBelow 20%, including peak hours
Further workAn architecture and codebase improvement roadmap

The technical results are reported in my July 2024 project account. The database-bill reduction was observed after the changes. It is an approximate figure for the database bill, not total infrastructure costs. The figures describe this engagement and its workload, not a benchmark for other systems.

Measurement context

The throughput comparison is with the application before optimization. The account describes a two-week engagement, but does not publish absolute request rates or the exact measurement period. It should not be read as a reproducible load-test benchmark.

The CPU observation includes peak hours. Instance size and billing are different measures: the instance returned to one-third of its expanded size, while the observed database bill fell by about half. The client is Rakt Innovations. The feedback below is an excerpt supplied for publication.

Client feedback

Client feedback · Excerpt

“His short, mid, and long-term plans have significantly enhanced our database performance by identifying and fixing bottlenecks. Dmitry's expertise and dedication have made a noticeable impact on our system's efficiency.”

Tanishq ChaudharyRakt Innovations

Business impact

The team could return to the original database instance size and pay about half the database bill. Removing redundant read work and correcting indexes also created headroom to onboard new clients.

Why this matters for an audit

The production symptoms guided the measurements and immediate changes. Once that work was done, the roadmap addressed longer-term architecture and codebase improvements.

An audit provides the assessment and priorities for your team. This historical engagement also included implementation; its full scope is not a promise about every audit.

Read the original technical account, published 28 July 2024.

Explore the Data Platform Audit.

Start with a conversation

What’s slowing
your team down?

Let’s talk about your data challenges.

Book a free call

Calls and written deliverables are in English.