Note: articles are for educational purposes and are not professional security advice — consult an expert for your specific needs.

Redis compression: LogicMonitor's 85% reduction

In short

LogicMonitor reduced a Redis model from approximately 80,000 bytes to 11,383 bytes using float16 arrays, Blosc with ZLib and Base64 encoding. Compression runs in the application, not through a Redis server setting; validate recovered values and Get and Set performance under load, since final float16 accuracy is not quantified.

Summary written with AI from this article, and checked against it.

Numerical blocks compress into a smaller stack beside a database, showing Redis storage savings and processing costs

LogicMonitor cut Redis model storage by 85% using float16 arrays, Blosc compression and Base64 encoding. Redis compression happens in the application, not through a Redis server setting. I think the useful part is the comparison behind that result: how the encoded arrays stack up against LZ4 and decimal rounding, and whether the saved storage is worth the precision and processing costs.

If your service caches large numerical models as JSON, that comparison is relevant to your own storage decisions. In LogicMonitor's engineering write-up, a stateless anomaly-detection microservice needed to share training data across pods through centralized Redis clusters. As its numerical lists grew, so did the storage demand. Compressing those lists raised a separate question: how much processing would the application spend encoding and decoding each value?

Why LZ4 stopped delivering enough reduction

LZ4 worked well for Redis compression on the original model because there was redundancy to compress. LogicMonitor reports that lossless compression took that model from approximately 39,739 bytes to 16,208 bytes, a saving it describes as 60%. Much of the benefit came from repeated structure in the model's keys and values.

Then the workload changed. Longer floating-point lists more than doubled the model's size, but those lists had less statistical redundancy for the compressor to use. LogicMonitor also traced some of the stored string size to the long decimal representations associated with Python's default double-precision values.

The team was no longer just choosing a compressor. It also needed to examine the numbers being passed into that compressor. Rounding every float to four decimal places produced roughly the same storage saving as a more complicated rounding scheme that varied with magnitude. That gave the team a simpler representation to compare, rather than another compressor setting to adjust.

I'd treat this as a NoSQL data-modeling decision, not a Redis configuration change. The application has to produce the representation Redis stores, and it has to be able to consume that representation when the data comes back.

Redis compression at a glance: These percentages are not additive; Keep an uncompressed reference and record its size; Evaluate LZ4 and decimal rounding separately; Stored size is not the only measurement in this comparison

Redis compression results need separate baselines

LogicMonitor reports results for different model sizes. LZ4 used a smaller model, so its percentage saving is not directly comparable to the later results.

StrategyStarting sizeReported resultReported saving
LZ4 on the original modelApproximately 39,739 bytes16,208 bytes60%
Round all floats to four decimal placesApproximately 80,000 bytesApproximately 36,000 bytes55%
Magnitude-dependent roundingApproximately 80,000 bytesApproximately 35,000 bytes56%
float16 arrays, Blosc with ZLib, then encodingApproximately 80,000 bytes11,383 bytes85%

These percentages are not additive. LZ4 was tested on the earlier, smaller model. The later results describe the larger numerical workload, not successive reductions of that original payload. Reading the table as a sequence of savings against an unchanged model would give the wrong comparison.

For rounding, the team chose the uniform four-decimal rule over the magnitude-dependent rule. Their storage savings were similar, while the simpler rule avoided the additional complexity and reduced precision of magnitude-dependent rounding. The team also checked the effect on its algorithm and found it insignificant. Rounding was not the final choice, though: the later encoded-array approach produced a substantially smaller stored model.

Benchmark your Redis model before changing its format

The target for your evaluation is a useful comparison on your own model, not a reproduction of LogicMonitor's percentage. Its write-up describes the transformations, but it does not supply client calls or compressor APIs.

  1. Record the existing model and transaction behaviour. Keep an uncompressed reference and record its size. Measure the elapsed time for Redis Get and Set, along with the application's Redis compression and decompression work. LogicMonitor compared transactions with and without prior compression. It also warns that the extra processing can increase latency and reduce throughput during peak load, so stored size is not the only measurement in this comparison.

    Test every alternative against the same captured model and access pattern. Without that consistency, a change in the data could pass for an improvement in compression effectiveness, even though the comparison itself had changed.

  2. Evaluate LZ4 and decimal rounding separately before combining changes. LZ4 is the lossless-compression candidate; rounding tests whether the algorithm can accept fewer decimal digits. A smaller JSON value answers the storage question, but it does not establish that the analytical result is acceptable.

    This valid JSON fragment isolates a training-data field using numerical examples from LogicMonitor's discussion for the rounding comparison.

    {
      "algorithm-1-training-data": {
        "training-data-value": [12.43, 0.4312444]
      }
    }

    Compare the original with this four-decimal fixture, which uses the same training-data field.

    {
      "algorithm-1-training-data": {
        "training-data-value": [12.43, 0.4312]
      }
    }

    Run both the original and the rounded data through your algorithm, then decide whether the difference is acceptable. LogicMonitor validated rounding against its own algorithm. That result does not automatically validate rounding for yours.

  3. Evaluate the encoded-array representation before converting the NumPy arrays into lists. LogicMonitor first converted those arrays to float16, then compressed them with Blosc using its internal ZLib codec, and then applied Base64 encoding. It decoded the encoded result as UTF-8 text before putting it into JSON.

    Keep the order of those operations explicit in the evaluation. The reported saving came from changing the numeric representation as well as compressing it. It was not a storage improvement attributable to Base64 alone.

  4. Validate retrieval and operation under load before settling on a format. Check that the stored data can be recovered, then test the recovered values with the algorithm. LogicMonitor recommends error checking, backups and regular validation of compressed data. It also recommends monitoring performance as data volume and access patterns change, rather than relying only on the initial comparison.

    If the processing cost becomes the constraint, LogicMonitor suggests a lightweight compressor such as LZ4 as one alternative. Another is selective compression: compress only certain data types, or data that is accessed less frequently.

The 85% result leaves precision and peak-load questions

The write-up establishes the storage saving, but it does not give a numerical latency benchmark. LogicMonitor says compressed transactions showed substantial elapsed-time improvements. It does not publish the measurements needed to estimate an equivalent improvement for another service, so the storage figure cannot answer that performance question for you.

My main reservation is the accuracy evidence for the final representation. The article explicitly reports that decimal rounding had an insignificant effect on its algorithm, but it does not quantify accuracy for the final float16 pipeline. Those are different numerical representations. A successful rounding test should not take the place of validating the values recovered from the float16 pipeline.

Redis compression also gives the application another operational failure path. LogicMonitor warns that an altered bit could leave a compressed block unreadable, and that managing compressed data can become more complicated as a database grows. Its recommendations include error-detecting compression, backups and retrieval testing, as well as distributing load through Redis clustering.

That puts processing capacity beside stored bytes in the decision. An application whose memory use is acceptable but whose spare processing capacity is limited may make a different choice from an application dominated by large numerical payloads. The same storage saving does not settle both cases.

Choose the representation your model can tolerate

I'd start with LZ4 if preserving the existing numerical values is the priority. Rounding and float16 belong in the comparison only with an explicit accuracy check. For a workload resembling LogicMonitor's large training arrays, the encoded-array route deserves testing: it produced the smallest reported result, even though that result does not answer every deployment question.

Before choosing that route, run the captured model through it and test the recovered values with your algorithm. Measure the Get and Set path under load, and check that the application can reliably recover the stored representation.

FAQ

Frequently asked questions

Why did LogicMonitor initially choose LZ4?

LogicMonitor credits LZ4's speed and ease of integration with its existing codebase. It was the team's initial lossless-compression choice.

What metadata accompanied the training arrays?

The simplified model included model and configuration versions and a last timestamp for each resource. Each algorithm's training section also contained its own version, training values, training timestamps and parameters.

How does the write-up explain Blosc's compression performance?

LogicMonitor says Blosc can use multithreading and divides data into smaller blocks for compression. Its chosen configuration used Blosc's internal ZLib codec.

Source

  1. Write-upRedis compression strategies: How we achieved 85% data reduction · logicmonitor.com

How this article was made: drafted with AI from the source above and fact-checked against it, then reviewed by Vishal on . How we write and check articles.

Vishal

About the author

· Software & security engineer

GitHub · LinkedIn · X

Vishal writes Trickyworld's tutorials and interview-preparation guides on programming, databases, cyber security and AI. Vishal has been shipping production software long enough to have firm opinions about Python, PHP, Node.js, and JavaScript, and to have been wrong about each of them at least once. The work has run the whole stack: Drupal and Laravel applications, React front ends, MySQL and MongoDB underneath, Redis and Memcached for the things that had to be fast, Apache Solr for the things that had to be findable. That last part turned out to matter more than anyone expected. Tune a Solr index for a season, then watch a language model confidently retrieve the wrong document, and you recognise an old problem wearing new clothes. Most of what is hard about AI systems is not the model. It is retrieval, caching, latency budgets, and deciding what the system does when the answer comes back wrong — which is work he has been doing since well before anyone called it AI engineering. He plays a lot of games, which is less a hobby disclosure than an admission of where a good share of his engineering instinct came from. Real-time systems with a frame budget. State that has to stay coherent while a player does something no designer anticipated. The permanent question of what happens when the frame cannot finish in time. Those habits carry over more directly than they have any right to. He has written several books on programming, all built on the same conviction: most technical writing is unclear because the author never decided what to leave out. More from Vishal → · Editorial policy

#performance optimization#Redis#Caching#NoSQL#Python#monitoring

More on NoSQL Databases.

NoSQL Databases

Scalability and High Availability in NoSQL

Explore how NoSQL databases handle scalability and maintain high availability. This comprehensive guide dives into key concepts like horizontal scaling, sharding, load balancing, replication, failover, and consistency. Understand how popular NoSQL databases like Cassandra, MongoDB, and Redis implement these principles.

2 min read

Latest articles

$ subscribe --weekly

Get the next tutorial in your inbox.

Programming, security and AI — the practical bits, no spam. Unsubscribe any time.