Managing Inventory Changes as Time-Series Data
Key point
Oliveyoung's Inventory Squad introduces how they use Redis Stream to efficiently manage inventory change history for large-scale SKUs.
Details
Oliveyoung manages over 10 million SKUs, and during the process of synchronizing large volumes of inventory data at certain intervals, they experienced a surge in Redis CPU load and API Latency.
Previously, they used the Redis Hash type to store only the latest inventory quantity, which meant that other systems had to query all the data to grasp the overall inventory, resulting in inefficiency. To improve this, they decided to record all inventory change events—sales, incoming stock, returns, etc.—using Redis Stream.
Redis Stream is optimized for append-only time-series data processing and offers the following benefits:
- Processing order guarantee: Ensures data ordering through a unique Entry ID (timestamp-sequenceNumber).
- Efficient range queries: Enables fast retrieval of change history within a specific time range via the XRANGE command.
- Infrastructure efficiency: Allows time-series data processing without any additional infrastructure.
During implementation, since permanent retention of the data was unnecessary, they improved management efficiency by including the date in the Stream Key and setting a TTL (Time To Live) to automatically clean up expired data.
This summary was generated automatically by AI. Check the original for the author's claims and context. Copyright belongs to the original author.
Our guide explains how the AI works. Report summary errors, attribution issues, or removal requests via Contact.