<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Benedetto Proietti on Medium]]></title>
        <description><![CDATA[Stories by Benedetto Proietti on Medium]]></description>
        <link>https://medium.com/@benedetto73?source=rss-f220062e1806------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*rXNN7OkERmQglw5164G-zg.jpeg</url>
            <title>Stories by Benedetto Proietti on Medium</title>
            <link>https://medium.com/@benedetto73?source=rss-f220062e1806------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Fri, 04 Dec 2026 14:55:36 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@benedetto73/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[How to Build a Vector Database Using Amazon S3 Vectors]]></title>
            <link>https://medium.com/@benedetto73/how-to-build-a-vector-database-using-amazon-s3-vectors-be68298b12f4?source=rss-f220062e1806------2</link>
            <guid isPermaLink="false">https://medium.com/p/be68298b12f4</guid>
            <category><![CDATA[vector-database]]></category>
            <category><![CDATA[vector-search]]></category>
            <category><![CDATA[aws-s3]]></category>
            <category><![CDATA[ai]]></category>
            <dc:creator><![CDATA[Benedetto Proietti]]></dc:creator>
            <pubDate>Wed, 30 Jul 2025 08:46:36 GMT</pubDate>
            <atom:updated>2025-07-30T08:46:36.554Z</atom:updated>
            <content:encoded><![CDATA[<p><em>And Say Goodbye to Expensive SaaS Pricing</em></p><p>Here’s an estimated price comparison for storing 1 billion and 10 billion vectors using the most common SaaS vector databases. These numbers are pulled directly from each provider’s pricing calculator.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/549/0*vz2LhwcJBZ7rNZB9.png" /></figure><h3>Why Are Vector Databases So Expensive?</h3><p>I’ve covered this before in two articles — <a href="https://medium.com/@benedetto73/desire-for-structure-read-sql-9464766ec509">Desire for Structure (read: “SQL”)</a> and <a href="https://medium.com/@benedetto73/beyond-the-art-of-database-indexing-436b14dcf987">(Beyond) The Art of Database Indexing</a>. Traditional indexing starts to fall apart at scale — what we used to call “Big Data.”</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/400/0*DZqM6TXdGFdXG1qo.png" /></figure><p>Want the short version?</p><blockquote>Vector databases are expensive because they rely on powerful, always-on hardware. They keep in-memory indexes fresh and caches hot — and that costs money.</blockquote><h3>Old Tricks, New Vector World</h3><p>For tabular or log data, we decoupled compute and storage a long time ago: store data cheaply in S3 or MinIO, and spin up compute (like Spark or Presto) only when needed.</p><p>Amazon has now extended this model to vector embeddings with Amazon S3 Vectors. [Quick dive <a href="https://medium.com/@benedetto73/s3-vectors-changing-how-we-think-about-vector-embeddings-b04f8af2e3cd">here</a>.]</p><p>S3 Vectors lets you store huge volumes of vector data at low cost and run similarity searches in under a second — ideal for batch workloads and analytics.</p><p><em>Can we ditch expensive Vector DBs now?</em></p><p>Not quite. S3 Vectors doesn’t offer the low latency needed for real-time use cases — like fraud detection, recommendation engines, or chatbots that require sub-100 ms responses.</p><p>Instead, think of S3 Vectors as the durable, budget-friendly foundation. You’ll still need a lightweight layer on top to meet real-time latency requirements.</p><h3>Level 1: Download and Run</h3><p>Let’s start simple: use open-source software out of the box, no code changes, just run it.</p><p>We lower similarity search latency by using a classic Computer Science technique — indexes — and storing data in RAM (which is fast but expensive).</p><h3>Product Quantization (PQ): Fast, Memory-Efficient Search</h3><p>Performing exact distance calculations (cosine, Euclidean) on billions of 768-dimensional vectors is too slow and compute-heavy.</p><p>Product Quantization (PQ) helps by compressing vectors into compact forms. This makes searches 10–100× faster — with minimal accuracy loss.</p><h3>How PQ Works</h3><p>PQ splits each high-dimensional vector into smaller chunks (e.g., groups of 8 dimensions), then maps each chunk to the closest centroid in a precomputed codebook. Only the centroid IDs are stored.</p><p>At query time, instead of comparing against billions of raw vectors, the system compares to ~256 centroids per chunk — massively reducing compute time.</p><p>For most NLP workloads, PQ delivers excellent recall while cutting memory and compute costs.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/400/0*UiVt8DSF97kpXEv-.png" /></figure><h3>Tool Selection</h3><p><strong>FAISS</strong> — originally developed by Facebook AI Research — is the go-to library for efficient similarity search and clustering of dense vectors. It’s widely adopted for high-performance vector indexing at scale. But I recommend <a href="https://github.com/JaneaSystems/jecq">JECQ</a>, a drop-in replacement with 6× lower memory usage.</p><p><em>Disclaimer: I created JECQ. That said, it works well. But use FAISS if you prefer.</em></p><h3>In-Memory Cache</h3><p>You can cache a subset of raw vectors in RAM using tools like Redis or Valkey, depending on your licensing needs.</p><p>For 10 billion vectors (~30TB in S3), storing just 1% in RAM (about 300GB) can make a big difference. Pricey, but manageable.</p><h3>Level 1 Architecture</h3><p>Let’s walk through the architecture:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/400/0*9lDFjnmj2wcZLrLq.png" /></figure><ul><li>A router service handles incoming similarity search requests. It’s stateless and can scale horizontally.</li><li>Each node loads a copy of the JECQ (or FAISS) index in memory.</li><li>The router uses JECQ to find candidate vector IDs.</li><li>It then checks Redis for raw vectors:</li><li><strong>Cache hit:</strong> Redis returns vectors. Router re-ranks and returns results.</li><li><strong>Cache miss:</strong> Router pulls vectors from S3, re-ranks, and returns results.</li></ul><h3>Level 2: Teaser</h3><p>Level 1 works fine for datasets up to ~1 billion vectors or demo workloads. But if you want 10–100 ms P95 latency at multi-billion scale, you’ll need more:</p><ul><li><strong>Local raw vectors on NVMe:</strong> A middle layer (5–10% of raw size, ~1.5TB) between RAM and S3 to avoid frequent S3 fetches.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/400/0*81WMMCric400VT8U.png" /></figure><ul><li><strong>Hierarchical data layers:</strong> JECQ + Redis/NVMe integration enables local posting list retrieval, turning 100 ms S3 reads into 2–5 ms NVMe reads.</li><li><strong>Index sharding:</strong> Splits PQ clusters across nodes and avoids duplicating 100GB+ compressed data per node.</li><li><strong>Advanced cache management:</strong> Store frequent queries, support MFU/LFU/LRU caching strategies, and pre-load data based on user behavior.</li><li><strong>Aggressive S3 Vectors indexing:</strong> Each query hits just one index. A single S3 bucket can hold 10K indexes, each with ≤50M vectors. Smart indexing helps reduce latency significantly.</li></ul><p>All of this requires solid engineering chops — but it’s necessary if you want to build a cost-effective vector database with 10–100 ms latency on top of S3 Vectors.</p><p><em>Stay tuned for Level 2.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=be68298b12f4" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[S3 Vectors: Changing How We Think About Vector Embeddings]]></title>
            <link>https://medium.com/@benedetto73/s3-vectors-changing-how-we-think-about-vector-embeddings-b04f8af2e3cd?source=rss-f220062e1806------2</link>
            <guid isPermaLink="false">https://medium.com/p/b04f8af2e3cd</guid>
            <category><![CDATA[aws-s3]]></category>
            <category><![CDATA[vector-database]]></category>
            <category><![CDATA[amazon-s3]]></category>
            <category><![CDATA[llm]]></category>
            <category><![CDATA[aws]]></category>
            <dc:creator><![CDATA[Benedetto Proietti]]></dc:creator>
            <pubDate>Wed, 16 Jul 2025 16:15:18 GMT</pubDate>
            <atom:updated>2025-07-16T16:15:18.873Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/633/1*VDnjEbW5_ODXF1a5cMX93Q.png" /></figure><p>Inserting and maintaining data in a relational database is expensive. Every write must update one or more indexes ( data structures such as B-trees) that accelerate reads at the cost of extra CPU, memory, and I/O. On a single node, tables start to struggle once they pass a few terabytes. Distributed SQL and NoSQL systems push that limit, but the fundamental write amplification costs remain.</p><h3>Object Storage</h3><p>To escape those costs, teams began landing raw data in cloud object stores like Amazon S3 . Instead of hot indexes, query engines (Spark, Athena, Trino) rely on partition pruning and lightweight statistics. The led to dramatically lower storage bills and petabyte scale datasets on commodity hardware.</p><h3>Vector Embeddings</h3><p>AI and LLM workloads now emit vector embeddings — hundreds or thousands of dimensions per record. Answering “ Which vectors are nearest to this one?” in real time is tricky:</p><ul><li>High-dimensional data breaks classic data structures.</li><li>We lean on approximate nearest neighbor (ANN) algorithms such as HNSW or IVFPQ .</li><li>Queries often combine a distance threshold with metadata filters.</li><li>Recall, precision, and latency form a three-way tradeoff.</li></ul><h3>Amazon S3 Vector: A Game-Changer</h3><ul><li>Stores vectors of fixed dimensionality, compressed on write. Not possible with traditional S3.</li><li>Supports ANN search with simultaneous filters on metadata. Immensely faster than S3.</li><li>Delivers sub-second latency: great for batch, a bit slow for interactive UX.</li></ul><h3>Closing the Latency Gap with In-Memory Caching</h3><p>Janea Systems’ background is deeply rooted in working with in-memory , low-latency caches. Our track record includes:</p><ul><li>We are the creators of the official Redis for Windows, trusted by developers for its performance and reliability.</li><li>We are active contributors to , a rapidly evolving open-source fork of Redis, pushing the boundaries of in-memory data stores.</li></ul><p>Given the inherent characteristics of S3 Vectors, including powerful storage and batch processing, but with room for improvement in interactive scenarios, the next logical step is to strategically implement a high-performance cache on top of S3 Vectors.</p><h3>The Future</h3><p>We are excited about the possibilities Amazon S3 Vectors unlocks. The upcoming articles will cover how to effectively integrate Redis, Valkey, or Memurai with the S3 Vector service to achieve optimal performance for your AI/LLM workloads. Also, we will explore the new AWS service and its implications for modern data architectures in detail. Stay tuned!</p><p><em>Originally published at </em><a href="https://www.linkedin.com/pulse/s3-vectors-changing-how-we-think-vector-embeddings-benedetto-proietti-c3q9f/"><em>https://www.linkedin.com</em></a><em>.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b04f8af2e3cd" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[JECQ: Smart, Open-Source Compression for FAISS Users-6x Compression Ratio, 85% Accuracy]]></title>
            <link>https://medium.com/@benedetto73/jecq-smart-open-source-compression-for-faiss-users-6x-compression-ratio-85-accuracy-f938e1d30a35?source=rss-f220062e1806------2</link>
            <guid isPermaLink="false">https://medium.com/p/f938e1d30a35</guid>
            <category><![CDATA[vector-database]]></category>
            <category><![CDATA[embeddings-search]]></category>
            <category><![CDATA[llm]]></category>
            <category><![CDATA[embedding]]></category>
            <dc:creator><![CDATA[Benedetto Proietti]]></dc:creator>
            <pubDate>Wed, 09 Jul 2025 12:20:49 GMT</pubDate>
            <atom:updated>2025-07-14T13:43:58.620Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1000/1*Nu2gBfIrOwIahshKKUQuow.png" /></figure><p>Hi everyone — I’m Benedetto Proietti, Head of Architecture at Janea Systems. I spend most of my time working on performance-critical systems and solving interesting problems at the intersection of machine learning, distributed systems, and open-source technologies. This post is about a recent project I ideated and directed: <a href="https://github.com/JaneaSystems/jecq">JECQ</a>, an innovative, open-source, compression solution built specifically for FAISS users. I’ll walk you through the thinking behind it, how it works, and how it can help reduce memory usage without compromising too much on accuracy.</p><p>Ever wonder how it takes just milliseconds to search something on Google, despite hundreds of billions of webpages in existence? The answer is Google’s index. By the company’s own admission, that index weighs in at over 100,000,000 gigabytes. That’s roughly 95 petabytes.</p><p>Now, imagine if you could shrink that index by a factor of six.</p><p>That’s exactly what Janea Systems did for vector embeddings-the index of artificial intelligence.</p><p>Read on to learn what vector embeddings are, why compressing them matters, how it’s been done until now, and how Janea Systems’ solution pushes it to a whole new level.</p><h3>The Data Explosion: From Social Media to Large Language Models</h3><p>The arrival of Facebook in 2004 marked the beginning of the social media era. Today, Facebook has over 3 billion monthly active users worldwide. In 2016, TikTok introduced the world to short-form video, and now has more than a billion monthly users.</p><p>And in 2023, ChatGPT came along.</p><p>Every one of these inventions led to an explosion of data being generated and processed online. With Facebook, it was posts and photos. TikTok flooded the web with billions of 30-second dance videos.</p><p>When data starts flowing by the millions, companies look for ways to cut storage costs with compression. Facebook compresses the photos we upload to it. TikTok does the same with videos.</p><p>What about large language models? Is there anything to compress there?</p><p>The answer is yes: vector embeddings.</p><h3>Vector Embeddings: The Language of Modern AI</h3><p>Think of vector embeddings as the DNA of meaning inside a language model. When you type something like “Hi, how are you?”, the model converts that phrase into embeddings-a set of vectors that capture how it relates to other phrases. These embeddings help the model process the input and figure out how likely different words are to come next. This allows the model to know the right response to “Hi, how are you?” is “I’m good, and you?” instead of “That’s not something you’d ask a cucumber”.</p><p>The principle behind vector embeddings also underpins a process called “similarity search.” Here, embeddings represent larger units of meaning-like entire documents-powering use cases like retrieval-augmented generation (RAG), recommendation engines, and more.</p><p>It should be pretty clear by now that vector embeddings are central not just to how generative AI works, but to a wide range of AI applications across industries.</p><h3>The Hidden Costs of High-Dimensional Data: Why Vector Compression is Crucial</h3><p>The problem is that vector embeddings take up space. And the faster and more accurate we want an AI system to be, the more vector embeddings it needs — and the more space to store them. But this isn’t just a storage cost problem: the bigger embeddings are, the more bandwidth in the PCI bus and in the memory bus they use. It’s also an issue for things like edge AI devices — edge devices don’t have constant internet access, so their AI models need to run efficiently with the limited space they’ve got onboard.</p><p>That’s why it makes sense to look for ways to push compression even further — despite the fact that embeddings are already being compressed today. Squeezing even another 10% out of the footprint can mean real savings, and a much better user experience for IoT devices running generative AI.</p><p>At Janea Systems, we saw this opportunity and built an advanced C++ library based on FAISS.</p><p>FAISS-short for Facebook AI Similarity Search-is Meta’s open-source library for fast vector similarity search, offering an 8.5x speedup over earlier solutions. Our library takes it further by optimizing the storage and retrieval of large-scale vector embeddings in FAISS-cutting storage costs and boosting AI performance on IoT and edge devices.</p><h3>The Industry Standard: A Look at Product Quantization (PQ)</h3><p>Vector embeddings are stored in a specialized data structure called a vector index. The index lets AI systems quickly find and retrieve the closest vectors to any input (e.g. user questions) and match it with accurate output.</p><p>A major constraint for vector indexes is space. The more vectors you store-and the higher their dimensionality-the more memory or disk you need. This isn’t just a storage problem; it affects whether the index fits in RAM, whether queries run fast, and whether the system can operate on edge devices.</p><p>Then there’s the question of accuracy. If you store vectors without compression, you get the most accurate results possible. But the process is slow, resource-intensive, and often impractical at scale. The alternative is to apply compression, which saves space and speeds things up, but sacrifices accuracy.</p><p>The most common way to manage this trade-off is a method called Product Quantization (PQ) (Fig. 1).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/1*D2uHF3HOE6SLcW-BHJe2kg.png" /><figcaption>Fig. 1: PQ’s uniform compression across subspaces</figcaption></figure><p>PQ works by splitting each vector into equal-sized subspaces. It’s efficient, hardware-friendly, and the standard in vector search systems like FAISS.</p><p>But because each subspace in PQ is equal, it’s like compressing every video frame in the same way and to the same size-whether it’s entirely black or full of detail. This approach keeps things simple and efficient but misses the opportunity to increase compression on a case-by-case basis.</p><p>At Janea, we realized that vector dimensions vary in value-much like video frames vary in resolution and detail. This means we can adjust the aggressiveness of compression (or, more precisely, quantization) based on how relevant each dimension is, without affecting overall accuracy.</p><h3>Solution: JECQ — Intelligent, Dimension-Aware Compression for FAISS</h3><p>To strike the right balance between memory efficiency and accuracy, engineers at Janea Systems have developed JECQ, a novel, open-source compression algorithm available on GitHub that varies compression by the statistical relevance of each dimension.</p><p>In this approach, the distances between quantized values become irregular, reflecting each dimension’s complexity.</p><h3>How does JECQ work?</h3><p>The algorithm starts by determining the isotropy of each dimension based on the eigenvalues of the covariance matrix. In the future, the analysis will also cover sparsity and information density. <br> The algorithm then classifies each dimension into one of three categories: low relevance, medium relevance, and high relevance.<br> Dimensions with low relevance are discarded, with very little loss in accuracy.</p><p>Medium-relevance dimensions are quantized using just one bit, again with minimal impact on accuracy.<br> High-relevance dimensions undergo the standard product quantization.<br> Compressed vectors are stored in a custom, compact format accessible via a lightweight API.</p><p>The solution is compatible with existing vector databases and ANN frameworks, including FAISS.</p><h3>What are the benefits and best use cases for JECQ?</h3><p>Early tests show memory footprint reduced by 6x, keeping 84.6% accuracy compared to non-compressed vector candidates. Figure 2 compares the memory footprint of an index before quantization, with product quantization (PQ), and with JECQ.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/1*DURof9dt1XFpRKVQk-UKbw.png" /><figcaption>Fig. 2: Memory footprint before quantization, with PQ, and with JECQ</figcaption></figure><p>We expect this will lower cloud and on-prem storage costs for enterprise AI search, enhance Edge AI performance by fitting more embeddings per device for RAG or semantic search, and reduce the storage footprint of historical embeddings.</p><h3>What Are JECQ’s License and Features?</h3><p>JECQ is out on <a href="https://github.com/JaneaSystems/jecq">GitHub</a>, available under the MIT license. It ships with an optimizer that takes a representative data sample or user-provided data and generates an optimized parameter set. Users can then fine-tune this by adjusting the objective function to balance their preferred accuracy-performance trade-off.</p><p>We’re planning to share more tools, experiments, and lessons learned from our work in open-source, AI infrastructure, and performance engineering. If this kind of stuff interests you, stay tuned — more to come soon.</p><p><em>Originally published at </em><a href="https://dev.to/janeasystems/jecq-smart-open-source-compression-for-faiss-users-6x-compression-ratio-85-accuracy-5a5n"><em>https://dev.to</em></a><em> on July 9, 2025.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f938e1d30a35" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Porting Redis to z/OS]]></title>
            <link>https://medium.com/@benedetto73/porting-redis-to-z-os-fb64441c90b3?source=rss-f220062e1806------2</link>
            <guid isPermaLink="false">https://medium.com/p/fb64441c90b3</guid>
            <category><![CDATA[mainframe-modernization]]></category>
            <category><![CDATA[ibm]]></category>
            <category><![CDATA[mainframe]]></category>
            <category><![CDATA[redis]]></category>
            <dc:creator><![CDATA[Benedetto Proietti]]></dc:creator>
            <pubDate>Mon, 05 May 2025 15:13:33 GMT</pubDate>
            <atom:updated>2025-05-05T15:13:33.017Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*KlUtVAiV2Ld_4KGF" /></figure><p>“Wait… Redis? On z/OS?” If that was your reaction, you’re not alone.</p><p>But before you scroll somewhere else, please note the policy that my client has:</p><blockquote>No X86 in the building.</blockquote><p>Oh boy. OK, I said. I don’t even want to know why.</p><h3>Introduction</h3><p>At first glance, porting an in-memory, high-performance caching system like Redis to a mainframe OS might seem like forcing a round peg into a square hole. Redis is known for its lightweight footprint, lightning-fast response times, and deep integration with modern stacks — Node.js, Python, containerized microservices. Meanwhile, z/OS is a platform synonymous with decades-old batch processing, COBOL applications, and regulated enterprise workloads.</p><p>But scratch the surface, and the ask isn’t so weird after all. In fact, it’s a compelling idea — especially for organizations modernizing their mainframe infrastructure or building hybrid systems. Redis on z/OS isn’t just a science experiment. It could be a way to bring familiar, modern tooling closer to where the data lives, reduce operational complexity, and even bridge generational skill gaps.</p><p>In this blog series, we’ll explore what it would take to port Redis to z/OS. We’ll dive into the gritty systems-level challenges, architectural differences, and the potential ROI. But first, let’s unpack why this effort matters in the first place.</p><h3>1. “A Weird Ask?” Not Really</h3><p>Running Redis natively on z/OS may seem counterintuitive — until you consider what modern mainframe workloads actually look like.</p><h3>Blending the Old and New</h3><p>Today’s enterprises don’t treat mainframes as isolated silos anymore. They’re deeply embedded into hybrid architectures where z/OS systems coexist with cloud-native microservices, distributed databases, and REST APIs. In this context, Redis becomes a natural fit: an ultra-fast, lightweight cache or message broker to serve the needs of web apps, fraud detection engines, or data pipelines — all of which may already interface with the mainframe.</p><p>By running Redis natively on z/OS, you can bring these capabilities closer to the data without the overhead of off-platform integration. It reduces latency, simplifies security policies, and avoids network chokepoints.</p><h3>Developer Experience</h3><p>Let’s not underestimate the power of developer happiness. Many modern devs — especially those new to z/OS — are far more comfortable using tools like Redis, Git, or Node.js than navigating ISPF panels or writing JCL. Native Redis support (or any open-source tooling) makes the mainframe more welcoming and productive for hybrid teams.</p><h3>Precedents Already Exist</h3><p>This isn’t uncharted territory. HostBridge Technology has already introduced Redis for z/OS in 2015. HostBridge has been acquired by Broadcom in 2022 and that version of Redis is no longer available. I tried to reach out to Broadcom but got no reply so far.</p><p>IBM has also published Redis container builds for z/Linux systems. But it is not proper z/OS and doesn’t fit my client’s requirements.</p><p>Next, let’s talk about what makes this port hard — and why that’s part of the fun.</p><h3>2. The Technical Gauntlet: Challenges in Porting Redis to z/OS</h3><p>Redis itself is highly portable, written in ANSI C with relatively few hard dependencies, but it’s grounded in real use cases, real precedents, and real technical potential.</p><p>Porting Redis to z/OS presents a unique mix of low-level and architectural challenges that range from string encodings to process model mismatches. Here’s what’s on the table:</p><h3>2.1 Memory Management</h3><p>Redis is built for environments where memory allocation is fast, predictable, and cheap — typically Linux systems using malloc, mmap(), or custom allocators. z/OS, on the other hand, introduces different virtual memory models and storage management policies, especially when running under the Language Environment (LE).</p><p>You’ll need to revalidate all assumptions about address spaces, heap behavior, and possibly even consider segment boundaries. Memory pooling techniques may need to be re-implemented to avoid fragmentation or allocation failures.</p><h3>2.2 The fork() Problem</h3><p>One of Redis’s core features is its snapshotting mechanism for persistence, which relies on the fork() system call. This creates a copy-on-write clone of the process to safely write an RDB file without blocking the main thread. But fork() on z/OS USS is either limited or costly — and in many contexts, discouraged altogether.</p><p>A workaround may involve replacing fork() with a cooperative threading or multi-process model that emulates snapshot behavior, possibly leveraging z/OS’s own background job handling capabilities.</p><p>Janea has extensive understanding and experience on the “fork problem” since we tackled and solved this for Memurai on Windows many years ago.</p><h3>2.3 ASCII vs EBCDIC</h3><p>Redis, like most open-source software, assumes the world speaks ASCII. But z/OS natively uses EBCDIC. That breaks everything from command parsing (“SET mykey myvalue”) to AOF and RDB file encoding. Even subtle issues — like comparing byte arrays — can lead to disastrous bugs.</p><p>Every point where a string is stored, parsed, serialized, or compared needs to be reviewed. You’ll likely need transparent translation layers or enforce ASCII zones within memory.</p><h3>2.4 File I/O and Filesystem Semantics</h3><p>Redis reads and writes to the file system using familiar POSIX interfaces and expects a Linux-style path structure (/var/lib/redis). z/OS USS supports POSIX, but under the hood, it behaves differently — especially when it comes to file locking, permissions, and sync guarantees (fsync).</p><p>Persistent storage layers in Redis may need to be refactored to respect USS quirks or replaced entirely with dataset-based I/O if working outside USS.</p><p>Again, Janea can leverage its experience with porting Redis to Windows on this issue as well.</p><h3>2.5 Networking Stack Differences</h3><p>Redis is a networked server at heart, relying on low-latency TCP sockets. While z/OS USS does support BSD-like sockets, differences still exist — like how TCP options are handled, or how socket readiness is polled (select, poll, or epoll).</p><p>Testing is essential here. Behavior that’s reliable on Linux may degrade or fail silently under z/OS without tight validation.</p><p>Another plus for Janea and its experience with porting Redis to Windows.</p><h3>2.6 Build Toolchain and Dependencies</h3><p>Redis builds cleanly on Linux with make and gcc, but on z/OS, you’re looking at XL C/C++, Open XL, or even cross-compilation from a Linux host.</p><p>Makefiles might assume GNU extensions, certain flags, or linker behaviors not present on z/OS. Some dependencies Redis uses (e.g., jemalloc) may not even be compiled without modifications.</p><h3>2.7 Endianness</h3><p>IBM Z is big-endian. Redis assumes little-endian in many of its internal data formats, especially for RDB and protocol serialization. Without explicit endian handling, Redis on z/OS would generate data incompatible with Redis on every other platform.</p><p>This isn’t just a performance footnote — it’s a compatibility landmine.</p><h3>2.8 Debugging and Observability</h3><p>On Linux, Redis developers use gdb, strace, /proc, and a range of lightweight tools for diagnostics. On z/OS, you enter a different world: LE stack traces, SMF records, and USS logs.</p><p>Understanding how to trace a malloc corruption or a deadlocked socket without familiar tools is half the battle. Even logging assumptions (stdout, stderr) might need redirection or patching.</p><h3>Deep Dive: Memory Management on z/OS vs Redis Expectations</h3><p>Memory management is one of the least visible yet most critical areas of Redis’s performance. Redis thrives on predictable low-latency memory access patterns — it allocates, reallocates, and frees memory frequently, especially when dealing with variable-size data structures like hashes, lists, and sorted sets.</p><p>On Linux, Redis typically relies on malloc() (often from jemalloc), which in turn leverages the virtual memory system through brk() or mmap() behind the scenes. This model assumes:</p><ul><li>Contiguous, flat memory address space.</li><li>Fast memory allocation and deallocation.</li><li>Lazy memory commitment and overcommit behavior.</li></ul><p>Redis also benefits from memory overcommit settings and COW (copy-on-write) behaviors during fork(), which aren’t guaranteed on z/OS.</p><h3>z/OS Realities</h3><p>z/OS introduces different assumptions:</p><ul><li>Memory is divided into 24-bit, 31-bit, and 64-bit addressable regions.</li><li>The Language Environment (LE) manages heap and stack via runtime options that govern size, reuse, and growth policies.</li><li>Memory allocation APIs like __malloc31() and __heap_alloc() may be necessary depending on the addressing mode.</li><li>mmap() may not behave like Linux, limiting use of memory-mapped files for performance optimization.</li></ul><h3>Redis-Specific Considerations</h3><p>jemalloc Portability: jemalloc may require significant changes to build and function correctly on z/OS. Alternative strategies include:</p><ul><li>Using the system allocator.</li><li>Porting a simpler custom allocator.</li><li>Refactoring Redis’s internal usage of jemalloc interfaces.</li><li>Memory Fragmentation: z/OS environments — especially long-running tasks — may be more susceptible to heap fragmentation. Redis’s active memory churn (especially for small strings and key metadata) could trigger fragmentation more quickly than expected.</li><li>Concurrency and Memory Races: Threaded memory access in Redis extensions or modules must be revisited under LE’s constraints. Synchronization primitives must align with z/OS threading models.</li><li>Addressing Modes: If the Redis port is limited to 31-bit addressing (for compatibility), the memory ceiling (~2 GB usable) could throttle performance in large datasets. Native 64-bit support would be preferable but adds porting complexity.</li></ul><h3>Tuning and Tooling on z/OS</h3><ul><li>Use LE heap reporting tools (HEAPCHK, RPTSTG) to detect leaks, fragmentation, and unusual allocation patterns.</li><li>Set LE runtime options (HEAP, STACK, ALL31, ANYHEAP) to fit Redis’s workload profile.</li><li>Avoid implicit assumptions about lazy memory availability — explicitly test allocation failures and handle out-of-memory cases.</li></ul><h3>Summary</h3><p>To make Redis run well on z/OS, memory assumptions must be challenged and re-engineered:</p><ul><li>Use z/OS-native allocators or simplify jemalloc.</li><li>Validate every pointer size, offset, and arithmetic operation.</li><li>Monitor memory actively in production.</li></ul><p>If done right, Redis can still be fast and efficient — even in an environment with a completely different philosophy around memory.</p><h3>Deep Dive: Fork() and Snapshotting — A Structural Mismatch</h3><p>One of the hardest problems in porting Redis to z/OS lies in how Redis handles persistence. More specifically: its reliance on fork() to create background snapshots.</p><p>On Linux and other Unix-like systems, fork() is a well-understood primitive. It creates a copy-on-write duplicate of the current process. Redis uses this to write RDB snapshots or rewrite the AOF file without pausing command processing. It’s elegant, efficient — and tightly coupled to how Unix handles memory.</p><h3>Why This Breaks on z/OS</h3><p>z/OS UNIX System Services (USS) <em>does</em> support fork(), but not always in the way Redis expects:</p><ul><li>The implementation is heavier and slower.</li><li>Copy-on-write may not be available or efficient.</li><li>Forking a memory-heavy process like Redis could lead to performance degradation or memory contention.</li><li>z/OS might not guarantee the same memory isolation characteristics expected by Redis’s snapshotting logic.</li></ul><p>In short, even if fork() compiles and runs, the runtime characteristics are very different. Redis’s assumption of cheap, fast background snapshots doesn’t hold.</p><h3>Redis Alternatives to Fork()</h3><p>The Redis community has explored alternatives to fork() for years — especially for environments like embedded systems and Windows:</p><ul><li>rdbSaveRio() with threads: Using threads instead of forking a child process, this approach requires a carefully synchronized copy of the dataset.</li><li>Replica-based durability: Offloading persistence to a secondary Redis replica can eliminate snapshot pressure on the main instance.</li><li>Append-only file with minimal fsync: Using AOF for durability with less emphasis on snapshotting. This trades snapshot complexity for I/O tuning.</li></ul><h3>What You’d Need to Do on z/OS</h3><ol><li>Intercept and replace all fork() calls: Modify the Redis source to use a background thread or external helper process instead.</li><li>Create a shadow copy mechanism: Implement a mechanism to safely duplicate the dataset in memory before serialization. This could involve memory-mapped segments, shared memory, or serialized object trees.</li><li>Redesign signal handling: Redis relies on POSIX signals for child process communication. This would need to be restructured around threads or IPC mechanisms.</li><li>Integrate with z/OS services: Use native z/OS facilities for background job scheduling or offload snapshotting to a detached batch process.</li></ol><h3>Considerations and Risks</h3><ul><li>Concurrency bugs: Threads share memory. Without a true memory fork, Redis must ensure no writes occur during snapshot serialization.</li><li>Performance regressions: Thread-based snapshotting may increase GC pauses or latency under load.</li><li>Compatibility with upstream Redis: Forkless Redis variants diverge from the mainstream Redis design, increasing long-term maintenance effort.</li></ul><h3>Inspiration from Memurai, an enterprise-grade Windows Port of Redis</h3><p>As briefly said above, Janea Systems has solved this problem with Memurai. And although Memurai is closed source, Janea Systems can surely leverage its knowledge should it attempt to port Redis to z/OS.</p><h3>Summary</h3><p>fork() is central to Redis’s persistence model, but it’s not sacred. With careful engineering, we can replace it on z/OS with a thread-based or helper-process model. This will require deep changes to Redis internals, but could ultimately yield a Redis that’s more portable, scalable, and cloud-friendly.</p><h3>3. Redis on z/OS: Hypothetical ROI</h3><p>Porting Redis to z/OS is not a weekend hack. It’s a systems-level project with serious complexity. So why would anyone take it on?</p><h3>Strategic Value</h3><ul><li>Data locality: Redis brings computation closer to where the core transactional data lives — on the mainframe. That can reduce latency dramatically and improve response times for applications like fraud detection, authentication, and pricing engines.</li><li>Architecture simplification: Keeping Redis on-platform avoids the need to manage redundant, off-platform Redis clusters, which introduces security, compliance, and operational overhead.</li><li>Consolidation: Hosting Redis alongside CICS, IMS, and DB2 enables tighter integration and reduces the need for intermediate messaging systems or ETL pipelines.</li><li>Innovation catalyst: Native Redis enables new application patterns on z/OS — API caching, event buffering, ML inference prep — all without moving data off the mainframe.</li></ul><h3>Use Case Scenarios</h3><p>ScenarioRedis on z/OS AdvantageFraud detectionCache user behavior data next to CICS transaction state for real-time scoring.Session stateStore session tokens and user profiles for secure APIs or login flows.Hybrid cloud syncUse Redis as a lightweight message or state buffer between z/OS and cloud-based systems.Response cachingCache expensive or high-volume DB2 queries locally, reducing CPU and I/O load.In-memory analyticsPre-aggregate data for batch reports or ad-hoc dashboards without impacting OLTP systems.</p><h3>Developer and Team Productivity</h3><ul><li>Lower learning curve: Developers familiar with Redis can apply their skills directly, without learning legacy caching systems.</li><li>Tooling compatibility: Integrate Redis with modern DevOps pipelines, observability platforms, and CI/CD flows.</li><li>Reusable code: Many open-source libraries and services already support Redis out of the box. This reduces custom development.</li></ul><h3>Talent Strategy and Platform Modernization</h3><ul><li>Attract and retain engineers: Making z/OS friendlier to modern devs helps solve the aging workforce problem.</li><li>Upskill existing teams: Exposing Redis to COBOL or PL/I developers enables hybrid patterns where legacy and modern tools coexist.</li><li>Future-proof investments: Shows commitment to evolving z/OS into a modern, open platform instead of a closed, legacy silo.</li></ul><h3>Cost Efficiency Hypotheses</h3><ul><li>Reduced network I/O: Avoid sending repetitive queries over TCP/IP or MQ middleware.</li><li>Lower MIPS consumption: By caching high-cost computation results, Redis can help offload frequent lookups.</li><li>Streamlined architecture: Fewer moving parts means fewer licenses, integration bugs, and maintenance hours.</li><li>Elastic resource usage: Redis can be sized appropriately per LPAR or WLM policy, aligning with chargeback models.</li></ul><h3>Summary</h3><p>While speculative, the ROI of Redis on z/OS could be significant across operational efficiency, developer productivity, and long-term platform strategy. It’s not just about porting a database. It’s about unlocking new patterns of performance, scale, and modernization — right where the enterprise’s most critical data already lives.</p><h3>Conclusion: From Curious Idea to Practical Engineering</h3><p>Porting Redis to z/OS is not for the faint of heart — but it’s far from impossible. If anything, it’s the kind of challenge that z/OS engineers were born to tackle: one that blends systems thinking, cross-platform understanding, and a bold vision for modernization.</p><p>We’ve laid out the rationale, dissected the technical hurdles, and explored the possible upside. From memory models to fork workarounds, from encoding mismatches to ROI scenarios — this journey is both technical and strategic.</p><p>Yes, Redis on z/OS would be a significant engineering lift. But it would also be a statement: that mainframes can evolve, integrate, and innovate right alongside modern distributed systems. It’s about redefining what belongs on z/OS — not by lowering standards, but by raising the ceiling of what’s possible.</p><p>This blog isn’t a blueprint. It’s an invitation. To experiment. To collaborate. To prototype. To question assumptions. Because great ideas often start as weird ones.</p><h3>👇 What You Can Do Next:</h3><ul><li>Engineers: Try compiling a minimal Redis build in USS. See where it breaks.</li><li>Architects: Consider use cases where Redis could reduce coupling or latency.</li><li>Teams: Reach out to colleagues in both mainframe and cloud groups. Ask: “Where would Redis help us meet in the middle?”</li><li>Open source folks: Help sketch out patches. Explore what a forkless Redis mode might look like.</li></ul><p>Redis on z/OS may not be mainstream — but every good idea starts out that way.</p><p>Are you also interested in having Redis in z/OS?</p><p><a href="https://www.janeasystems.com/contact">Keep in touch</a>.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=fb64441c90b3" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Why Executives Should Care About Geospatial Data]]></title>
            <link>https://medium.com/@benedetto73/why-executives-should-care-about-geospatial-data-e2ec8b8a2a65?source=rss-f220062e1806------2</link>
            <guid isPermaLink="false">https://medium.com/p/e2ec8b8a2a65</guid>
            <category><![CDATA[geospatial]]></category>
            <category><![CDATA[geohash]]></category>
            <category><![CDATA[database]]></category>
            <category><![CDATA[geospatial-data]]></category>
            <category><![CDATA[quadtree]]></category>
            <dc:creator><![CDATA[Benedetto Proietti]]></dc:creator>
            <pubDate>Thu, 13 Mar 2025 14:42:21 GMT</pubDate>
            <atom:updated>2025-03-13T14:42:21.400Z</atom:updated>
            <content:encoded><![CDATA[<h4>Unlocking Competitive Advantages Through Modern Spatial Databases</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Y1-c8FfrISKcnl_282QqfA.png" /></figure><h3><strong>Introduction</strong></h3><p>Geospatial data has become essential for modern businesses, driving efficiency in logistics, retail, finance, and urban planning. As mobile devices, IoT sensors, and real-time tracking generate vast amounts of location-based data, businesses must adapt to leverage its potential.</p><p>Unlike traditional data, geospatial information is <strong>relational and dynamic</strong>, requiring specialized indexing and processing. Many industries rely on it for:</p><ul><li><strong>Retail &amp; E-commerce</strong>: Delivery optimization and personalized customer experiences.</li><li><strong>Logistics &amp; Transportation</strong>: Route planning and fleet management.</li><li><strong>Finance &amp; Security</strong>: Fraud detection through geospatial anomaly analysis.</li><li><strong>Smart Cities &amp; Urban Planning</strong>: Infrastructure development and environmental monitoring.</li></ul><p>Executives must recognize when geospatial capabilities become critical to their technology stack. This article explores what makes geospatial data unique, when to prioritize it, and how modern databases handle location-based information efficiently.</p><p><strong>What Makes Geospatial Data Unique?</strong></p><p>If you were expecting first to read about the technical complexities of points, lines, and polygons, well, I want to prioritize talking about what I consider a real (and often neglected) aspect.</p><h3>1️⃣ The Dynamic Nature of Geospatial Data</h3><p>Unlike static business records, geospatial data is constantly <strong>changing and evolving</strong>:</p><ul><li><strong>Real-time Movement</strong>: Vehicles, people, and shipments move dynamically, requiring databases to update positions frequently.</li><li><strong>Changing Boundaries</strong>: Administrative boundaries, roads, and zoning laws can shift over time, affecting spatial queries.</li><li><strong>Context Awareness</strong>: Some geospatial queries are <strong>context-dependent</strong>, meaning the same query might return different results based on external factors like traffic, weather, or time of day.</li></ul><p>These unique characteristics of geospatial data <strong>demand specialized database architectures</strong> capable of handling <strong>spatial indexing, real-time updates, and multidimensional relationships</strong> efficiently.</p><h3>2️⃣ Geospatial Data is More Than Just Coordinates</h3><p>At its core, geospatial data consists of <strong>latitude and longitude points</strong>, but it is much richer than simple Cartesian coordinates. Real-world applications often involve:</p><ul><li><strong>Points</strong> (specific locations, such as a store or a Wi-Fi access point)</li><li><strong>Lines</strong> (road networks, pipelines, or flight paths)</li><li><strong>Polygons</strong> (city boundaries, zip codes, and regions affected by a weather event)</li><li><strong>Time-dependent Data</strong> (tracking movement over time, such as vehicle GPS data or migrating wildlife)</li></ul><p>These elements introduce <strong>spatial relationships</strong>, such as <strong>distance, adjacency, containment, and overlap</strong>, which are crucial for applications like route planning, proximity searches, and environmental monitoring.</p><h3>3️⃣ Traditional Databases Struggle with Geospatial Data</h3><p>Traditional relational databases (RDBMS) were designed to work with structured data in tables, where queries involve <strong>simple key-value lookups</strong> or <strong>aggregations</strong>. However, geospatial data requires:</p><ul><li><strong>Complex Spatial Queries</strong>: Instead of simple comparisons (e.g., WHERE city=&#39;New York&#39;), geospatial queries ask questions like:</li><li>“What are the <strong>nearest</strong> gas stations to my location?”</li><li>“Which delivery zones <strong>overlap</strong> with this zip code?”</li><li>“What customers are <strong><em>currently</em></strong> within a <strong>5-mile radius</strong> of this point?”</li><li><strong>Massive Data Sets</strong>: Maps, satellite imagery, GPS logs, and sensor data generate large volumes of information that require efficient storage and retrieval.</li><li><strong>Real-time Processing</strong>: Many applications (e.g., ride-sharing, traffic monitoring) require <strong>instant geospatial lookups</strong>, which traditional databases are not optimized for.</li></ul><h3>4️⃣ The Need for Specialized Indexing</h3><p>To efficiently handle geospatial queries, databases use specialized indexing techniques that differ from traditional B-tree or hash-based indexes:</p><ul><li><strong>R-Trees</strong>: Hierarchical tree structures optimized for bounding-box searches, used in PostGIS and spatial databases.</li><li><strong>QuadTrees</strong>: Recursive division of space into quadrants, commonly used for geospatial partitioning.</li><li><strong>Geohash</strong>: A string-based encoding of latitude/longitude data that allows fast spatial queries with a compact representation, often used in in-memory databases like Redis.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Exsr9OduDJ07JtDizrssyQ.png" /></figure><p>Without these <strong>geospatial-aware indexes</strong>, even simple queries — like finding the nearest store — would require scanning millions of records, making them computationally expensive and slow.</p><h3>Conclusions</h3><p>Understanding these complexities is crucial for executives deciding <strong>when and how</strong> to invest in geospatial technology. The next section will delve into specific business cases where companies should prioritize geospatial data integration and the impact it can have on decision-making and operations.</p><blockquote>If you’d like to explore how your organization can effectively leverage geospatial data or if you have questions about implementing specialized geospatial technologies, feel free to contact me. I’m here to help you navigate these complexities and uncover new opportunities for your business.</blockquote><p>PS: Check out my podcast “<a href="https://www.youtube.com/@proiex">PROIEX — Tech Experiences</a>”!<br>We recently had an <a href="https://youtu.be/URum9X9YVjk?si=tb_t8pFeq0Rp2Gml">episode on Geospatial</a> with Robert Cheetham.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e2ec8b8a2a65" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[(Beyond) The Art of Database Indexing]]></title>
            <link>https://medium.com/@benedetto73/beyond-the-art-of-database-indexing-436b14dcf987?source=rss-f220062e1806------2</link>
            <guid isPermaLink="false">https://medium.com/p/436b14dcf987</guid>
            <category><![CDATA[big-data]]></category>
            <category><![CDATA[redis]]></category>
            <category><![CDATA[technology]]></category>
            <category><![CDATA[database]]></category>
            <category><![CDATA[software-engineering]]></category>
            <dc:creator><![CDATA[Benedetto Proietti]]></dc:creator>
            <pubDate>Tue, 11 Mar 2025 16:59:57 GMT</pubDate>
            <atom:updated>2025-03-11T16:59:57.199Z</atom:updated>
            <content:encoded><![CDATA[<p>and Why Indexes Alone Won’t Save You</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*NzyAbY9tLAHSpoNmq8TSxg.png" /></figure><h3>Executive Summary</h3><p>Modern databases handle vast amounts of data — often spanning tens of terabytes or even petabytes — and relying solely on indexing is insufficient for optimal performance. Misunderstanding this can lead to degraded performance, increased operational costs, and poor user experience. This article highlights why indexing alone isn’t the solution and provides practical alternatives and strategies for scalable, efficient data management.</p><h3>Why Indexes Alone Are Insufficient</h3><p>Indexes improve read performance but introduce overhead during writes, slowing transactional operations. Businesses frequently face performance degradation due to excessive indexing, resulting in increased operational costs and diminished customer satisfaction.</p><h3>Technical Basics</h3><p>Data resides in three main storage systems, each with distinct performance characteristics:</p><ul><li><strong>RAM (volatile memory)</strong>: Extremely fast, ideal for real-time data processing.</li><li><strong>NVMe Drives/SSDs</strong>: Faster, persistent storage with moderate costs.</li><li><strong>Rotating hard drives</strong>: Cost-effective but significantly slower.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Zq2htD5uuPq2QYbpTvqISw.png" /></figure><blockquote>The efficiency of your software solution (SQL, NoSQL, or caching systems) significantly depends on your choice of storage and how effectively the software manages data contention.</blockquote><h3>When Indexing Hurts More Than It Helps</h3><ul><li><strong>High-write Workloads</strong>: Frequent data updates make indexing costly and inefficient.</li><li><strong>Analytics Queries</strong>: Full-table scans on specialized storage can be more efficient than indexed lookups.</li><li><strong>Complex Joins and Aggregations</strong>: Excessive indexing increases complexity and resource use, potentially harming performance.</li></ul><h3>Strategic Alternatives to Optimize Performance</h3><h4>1️⃣ Separate Analytics from OLTP Systems</h4><p>Operational (OLTP) and analytical workloads should never compete for resources within the same database. Operational queries demand instant responses, while analytics queries, analyzing large historical data sets, consume extensive resources.</p><p><strong>Actionable Step:</strong> Evaluate your database architecture to segregate operational databases from analytical workloads.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*2KjEug05oPQ-Td9Sd6rVkA.png" /></figure><h3>2️⃣ Separate Read and Write Operations</h3><p>Using database read replicas improves scalability and resource efficiency by minimizing bottlenecks. However, it can introduce slight latency or data staleness.</p><p><strong>Actionable Step:</strong> Consider implementing read replicas to reduce load on your primary database, but assess potential data staleness impacts.</p><p><strong>Possible Challenge!</strong> Creating replicas introduces latencies to allow writes to replicate. Or some staleness in the data. Which can be ok in most (not all) scenarios. Choose wisely!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*8egHlkdxSKf-OLlKwfdzgg.png" /></figure><h3>3️⃣ Implement Caching with Redis, Valkey, or Memurai</h3><p>Caching frequently accessed data significantly enhances application responsiveness by reducing database queries. This results in lower latency, reduced database loads, and improved scalability. The first cache that found tremendous popularity was Redis (for Linux). Then its unwise licensing choices lead the recent groth of Valkey, a fully open-source alternative to Redis. For Windows, there’s Memurai: a fully supported and enterprise-ready partner of Redis.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1022/1*OxgH4aIc-ZKNyKdA6xQUNw.png" /><figcaption>Popular caches summary</figcaption></figure><p><strong>Actionable Step: </strong>Consider adding code (for Reads) that access cache first, and only on a cache-miss access the DB.</p><h3>4️⃣ Shard Data to Distribute Load</h3><p>Sharding partitions data across multiple databases, distributing load and preventing bottlenecks. While traditional databases (RDBMS) require manual sharding efforts, solutions like Valkey offer built-in sharding capabilities, simplifying scaling.</p><p><strong>Actionable Step:</strong> Consider sharding if your current database struggles with heavy loads or data volumes exceeding manageable thresholds.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*MsvtMlJCuhGwm5nDmswJog.png" /></figure><h3>6️⃣ Leverage Data Lakes for Historical Data</h3><p>Storing historical data in data lakes optimizes analytics, lowers storage costs, and maintains regulatory compliance without taxing operational databases.</p><p><strong>Actionable Step:</strong> Implement clear data-retention policies and regularly move older, less frequently accessed data to data lakes to enhance database performance.</p><h3>7️⃣ Summary</h3><p>Providing generic advice is inherently challenging. Please consider the recommendations in this table as guidelines rather than absolute rules.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/854/1*B6z88zWr6rLBSzlT48GUMw.png" /></figure><h3>Conclusion</h3><p>Indexes alone cannot support modern database demands at large scale. Strategic decisions regarding database infrastructure directly influence your organization’s agility, costs, customer satisfaction, and competitive positioning. Making informed choices <strong><em>now</em></strong> prevents costly performance degradation later.</p><blockquote>Are you dealing with SQL scalability headaches?<br>If your data is growing and <strong>you’re unsure how to scale without breaking the bank</strong>, let’s talk. <strong>I help teams with architecture and modernization strategies</strong> — reach out if you need a second opinion.</blockquote><p>PS: Check out my informal podcast “<a href="https://www.youtube.com/@proiex">PROIEX — Tech Experiences</a>”!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=436b14dcf987" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Desire for Structure (read “SQL”)]]></title>
            <link>https://medium.com/@benedetto73/desire-for-structure-read-sql-9464766ec509?source=rss-f220062e1806------2</link>
            <guid isPermaLink="false">https://medium.com/p/9464766ec509</guid>
            <category><![CDATA[database]]></category>
            <category><![CDATA[sql-vs-nosql]]></category>
            <category><![CDATA[big-data]]></category>
            <category><![CDATA[scalability]]></category>
            <category><![CDATA[analytics]]></category>
            <dc:creator><![CDATA[Benedetto Proietti]]></dc:creator>
            <pubDate>Sun, 02 Mar 2025 16:04:06 GMT</pubDate>
            <atom:updated>2025-03-10T09:50:23.984Z</atom:updated>
            <content:encoded><![CDATA[<h4>Or obsession for control?</h4><blockquote>This Blog is written by someone that helps companies modernize and optimize data systems for performance, scalability, and cost efficiency as his day job.</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*68SCveI3ot_-zMEFUSp2MQ.png" /><figcaption>image is AI generated</figcaption></figure><p><strong>Let’s admit it: we love the idea of running SQL queries on ALL our data</strong>! Not just a preference — it feels like an obsession. No matter how old or how rarely accessed, we cling to the idea that everything must remain instantly queryable.</p><p>It feels so simple, until it’s not. And then bad things happen:</p><ul><li>The database grows <strong>too large</strong>, and queries slow down to death.</li><li>Indexes sizes explode, <strong>eating up CPU and memory</strong> just to keep up.</li><li>Schema changes become a nightmare, locking tables and <strong>causing downtime</strong>.</li><li>The cost of scaling up SQL infrastructure <strong>skyrockets</strong>.</li></ul><p>Suddenly, our beautiful, structured world starts crumbling under its own weight. What seemed like an easy decision — “let’s just store everything in SQL” — becomes a scaling bottleneck that forces us to rethink our approach.</p><p><strong>But why does this happen?</strong><br>Relational Databases are powerful because they provide structure, indexing, and queryability — elements that make it easy for users to analyze and manipulate data.</p><p>For engineers, analysts, and business users, SQL offers:</p><ul><li>A universal way to query data — The language is standardized and widely understood.</li><li>Ad-hoc queryability — You can ask complex questions without predefining reports.</li><li>Data consistency — Enforced schemas and constraints prevent data corruption.</li><li>Indexing for performance — The ability to speed up searches through optimized indexes.</li></ul><p>Because of these benefits, many organizations enforce SQL as the default, even when other approaches may be more suitable.</p><p>But what happens when this need for structure becomes a liability rather than an asset?</p><p>We will look a bit into the <em>problem space</em>, and then we will explore (not exhaustively!) the <em>solution space</em>.</p><h3>2. The Problem space: When Structure Becomes a Limitation</h3><h3>2.1. The cost of our need for Structure</h3><p>While SQL provides clarity, it also introduces constraints. Let’s look at the most important ones.</p><h3>Schema</h3><p>A schema demands data to be organized in a set of tables. And for each table it needs a set of columns (names and types) and primary key column. You can also introduce relationships between tables, but we are not going to talk about that here (that’s why, incidentally, they are called “relational databases”).</p><p>Schema changes are delicate operations. They must be deployed before application changes to ensure compatibility. But even when done correctly, they introduce risks — what if your production data has unexpected edge cases your test environment didn’t? What if rollback becomes a nightmare?</p><p>Oh wait! Do we push the DB schema changes first, or the application changes first? schema changes first of course! Then just pray that the application you are pushing has the exact same schema. Yes you tested in the test environment… which is always perfectly identical to the production environment… right?</p><p>Well… not always.</p><h3>Indices</h3><p>A dear friend of mine and accomplished engineer used to say that “writing Databases is the art of writing indices”.</p><p>What is an index? An index is a type of data structure that helps finding the data when you do a search.</p><p>You put the data into a table as it comes. Now you want to search for all the orders for Mr Smith. <em>If you indexed the LastName column</em>…. The index has an acceleration data structure (probably a kind of tree) where it quickly can find all the rows where the last name is equal to “Smith”.</p><p>Nice right? Yah.</p><p>You know what it takes? Let’s try to list of what it takes:</p><p>· Fast memory (RAM) where to keep the fast data structure.</p><p>· Time: it needs to lock the index while it is searching it, so that mutations on the index do not make it crash. Yes these locks can be avoided or reduced most of the times but… you get the gist. Let’s stop it here for now.</p><p>Now what happens if you need more data?</p><p>You need more memory? Sure but there’s a limit to physical memory on a single machine.</p><p>Let’s go distributed, let’s use a cluster. Now I ask you to do the mental exercise to imagine how to lock a distributed index data structure across a cluster of 4 nodes. Well… difficult but possible.</p><p>But what if your data is really, REALLY huge? You might need 400 nodes. Or 4,000. Or 40,000. It’s impossible. Why?</p><p>Because indexes improve query speed — but they also introduce <strong>contention</strong>. Updating an index requires locking portions of it, slowing down concurrent writes. In a <strong>single-node</strong> setup, this is manageable. But in a <strong>distributed database spanning hundreds of nodes</strong>, keeping indexes in sync becomes a nightmare. This is why most distributed databases avoid <strong>global indexes</strong> or use <strong>eventually consistent indexing approaches</strong>. Without careful design, a <strong>single overloaded index update</strong> can throttle an entire system, creating <strong>cascading slowdowns.</strong></p><p>And probably spending so much time and engineering effort in calibrating indexes does not align with your core business.</p><h3>Conclusions so far</h3><p>That’s why you need to give up and think about other ways of storing your data.</p><p>The first place you store the data “in general” should not go into a relational SQL database (RDBMs if we want to use a formal language). That might not be the case for specific cases, for example where credit cards or money is involved.</p><p>If you are convinced about that, please continue reading. Otherwise please stop reading. There is no value for you to continue.</p><h3>3. Exploring the solution space</h3><h3>3.1. Hot/Cold</h3><p>First of all, not all data needs to be hot. Or indexed.</p><p>In most of the use cases queries need last week’s data, or last month’s data. Why then are you keeping 3 years’ worth of data in expensive indexed RDBMs?</p><p>1 week out of 3 years is less than one percent of the entire data! (0.6% to be precise).<br> 1 month out of 3 years is about 2.5% of the entire data.</p><p>Maybe, it makes sense to place “hot” data in a fast (and costly) database (or even a cache), and the cold data in a cheaper (and slower) data storage. It will cost a bit in terms of latency to access such data but… you will save a ton on money.</p><p>So why do companies still keep years of data in <strong>expensive RDBMS instances</strong>? Often, it’s habit — ‘we might need it someday’ — or a lack of proper data lifecycle planning. But in reality, only a fraction of the data needs to remain hot.</p><h3>A real-world Example</h3><p>A real-world example of this concept is NYC Taxi ride data:</p><p>· Total Dataset: ~1.1 billion rides per year (~550GB of storage).</p><p>· Last 3 years of data: ~3.3 billion rides (~1.6 TB of storage).</p><p>· Last Month’s Data: ~70 million rides (~35GB of storage).</p><p>· Last Week’s Data: ~18 million rides (~9GB of storage).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/900/1*M0nHV0y8i8LSDWqRqWhReA.png" /></figure><h3>3.2. Columns</h3><p>I have often seen relational databases with hundreds — sometimes even thousands — of columns, storing an incredible amount of data. Yet, most of these columns are rarely queried. They can’t be discarded because they hold valuable information, but they still come at a cost.</p><p>Every column, whether used frequently or not, adds overhead in disk storage, CPU, and memory — even when it’s not indexed. And that brings us to another issue: we can’t index all hundreds of columns for obvious reasons. As a result, we end up in a paradoxical situation:</p><p>We pay for an expensive and often slow relational database system.</p><p>Yet, hundreds of columns remain unindexed, making queries inefficient.</p><p>This raises an important question: Are we truly benefiting from keeping all columns “hot” and queryable, or are we just paying for an illusion of accessibility?</p><h3>4. Big Data: an introduction</h3><p>The term Big Data is thrown around a lot, but how big is “big”?</p><p>Here’s my personal definition: Big Data is an amount of data that cannot fit in a small cluster — but it still needs to be queryable.</p><p>A modern approach to Big Data consists of several components, and the key principle is separating compute from storage.</p><h3>4.1. Storage: The Data Lake</h3><p>Big Data is typically stored in a distributed object storage system, which I loosely call a Data Lake.</p><p>Here’s my informal definition of a Data Lake:</p><p>- Virtually infinite capacity — There is no practical storage limit.</p><p>- Massively parallel — It can handle many simultaneous operations.</p><p>- High throughput — Huge input/output bandwidth.</p><p>- High latency — It is not optimized for low-latency access.</p><p>- Simple REST API — Accessible through standard cloud APIs.</p><h3>4.2. Compute: Processing Data from the Data Lake</h3><p>From the Data Lake, data branches into separate workflows:</p><p>- Analytics workloads → Data warehouses, batch processing, OLAP queries.</p><p>- Online applications → Real-time transactional workloads (OLTP), NoSQL solutions.</p><p>But before going further, let me clarify something crucial:</p><h3>4.3. Analytics &amp; Online Processing Should Be Completely Separate</h3><p>They should not share the same datastore, cluster, or even availability zone.</p><p>Why?</p><p>- Analytics deals with historical data — end-of-day sales reports, customer behavior insights, trend analysis, etc.</p><p>- Online processing serves live production workloads — API responses, real-time transactions, and user interactions.</p><p>Mixing the two is a huge risk. Allowing analytical queries to run on your live production system is an enterprise disaster waiting to happen. You risk:</p><p>❌ Slow application performance — Customers may experience delays.</p><p>❌ Production downtime — A heavy analytical query could lock tables or exhaust resources.</p><p>❌ Jeopardizing business operations — A reporting query should never interfere with live transactions.</p><p>🚨 DO NOT DO IT. Keep them separate.</p><p>Besides, each requires different technologies:</p><p>- Online processing → Needs an RDBMS (SQL or NoSQL). These systems are designed for transactional speed and reliability.</p><p>- Analytics → Requires Big Data tools to efficiently process vast datasets.</p><h3>4.4. Analytics Compute: Processing Big Data</h3><p>There are many ways to query and process Big Data. A full discussion would take an entire book, so here’s a short list of key technologies:</p><h3>Spark</h3><p>✅ The de facto distributed compute engine for Big Data.</p><p>✅ Has been around since 2014, gaining widespread adoption.</p><p>✅ Processes petabytes of data with relative ease.</p><p>⚠️ Not without its issues, but still one of the easiest ways to run large-scale distributed queries.</p><h3>Flink</h3><p>✅ A newer competitor to Spark, with fresher architecture.</p><p>✅ Focuses on real-time and batch processing.</p><p>⚠️ Similar trade-offs as Spark but gaining traction.</p><h3>AWS Athena</h3><p>✅ Serverless querying of S3 data.</p><p>✅ Pay-as-you-go pricing (great for occasional queries).</p><p>⚠️ Can become expensive at scale if queries are frequent.</p><h3>ClickHouse</h3><p>✅ The cool new kid in town — Incredibly fast analytics.</p><p>✅ Can store data internally or query data directly from S3.</p><p>✅ Supports indexes, making queries much faster than traditional Data Lakes.</p><p>✅ Available as fully managed or self-hosted.</p><p>🔥 An excellent choice for high-performance analytics.</p><h3>AWS Redshift (or another DataWarehouse)</h3><p>This is a crossover scenario. Redshift is a semi-managed RDBMS but with beefy architecture, a columnar approach (why is columnar better? That’s a question for another article) a lot of cache and a cluster architecture that makes it super-fast.</p><p>Redshift offers <strong>fast, scalable columnar storage</strong>, making it great for <strong>heavy analytical queries</strong>. But it comes at a cost — both financial and operational. While Redshift excels for structured reporting, it’s not ideal for <strong>ad-hoc exploratory analysis</strong>, where a more flexible solution like Athena or ClickHouse might be better.</p><h3>4.5. Final Thoughts on BigData</h3><p>Big Data requires rethinking storage and compute:</p><p>· Store everything in a Data Lake (cheap, scalable storage).</p><p>· Compute happens separately, using the right tool for the job.</p><p>· Never mix analytics with production systems — that’s asking for trouble.</p><p>Big Data isn’t about blindly throwing everything into SQL — it’s about choosing the right technologies for scale, cost, and performance.</p><p>The diagram (source: AWS documentation) depicts a serverless “datalake centric” analytics architecture</p><h3>5. Small Data: Flexibility &amp; Fewer Constraints</h3><p>When dealing with small datasets, storage flexibility is far greater than in the Big Data world.</p><p>Unlike Big Data, where storage and compute must be carefully architected, small data is forgiving.</p><p>You don’t have to worry about distributed storage, multi-cluster orchestration, or separating compute from storage.</p><p>Instead, you get to focus on what really matters: choosing the right tool for the job.</p><h3>5.1. Where Can You Store Small Data?</h3><p>With small datasets, you have many options:</p><p>· SQL databases — Classic, structured, reliable. Perfect for transactional workloads.</p><p>· NoSQL databases — Flexible, schema-free, and great for hierarchical or document-based data.</p><p>· Flat files (CSV, JSON, Parquet) — Easy to use, easy to share. Works great for logs, configs, and lightweight processing.</p><p>· In-memory databases (Redis, Memcached) — Blazing fast, ideal for caching and ephemeral data storage.</p><p>· Embedded databases (SQLite, DuckDB) — Self-contained, no external dependencies, excellent for local processing.</p><p>Each of these options has trade-offs, but the beauty of small data is that you don’t need a complex architecture.</p><p>You pick what works and move forward — no need for extensive capacity planning or complex scaling strategies.</p><h3>5.2. The Cost vs. Performance Trade-Off</h3><p>With small data, performance and cost concerns are less critical compared to Big Data.</p><p>· Scaling is rarely an issue — One machine, or a few, are usually enough.</p><p>· Disk and memory overhead is minimal — A few gigabytes of data can fit comfortably on SSDs or even in memory.</p><p>· Cold vs. hot data isn’t a problem — All data is small enough to be ‘hot’ by default.</p><p>But there’s still an important question to ask:</p><h3>5.3. Structure vs Flexibility</h3><p>With small datasets, the temptation is to throw everything into SQL, because it just works. But does it always make sense?</p><p>· If your data is deeply hierarchical (e.g., JSON, XML), would a document store be a better fit?</p><p>· If your access patterns are key-value based, why not use an in-memory store like Redis?</p><p>· If your data is static, would a simple CSV or JSON file suffice instead of a full-blown database?</p><p>SQL forces structure, which is great when you need consistency, transactions, and relational integrity.</p><p>But flexibility is often more important when dealing with small, isolated datasets that don’t require complex relationships.</p><h3>5.4. Over-engineering</h3><p>I’ve seen teams deploy <strong>Kafka clusters</strong> to process just <strong>a few thousand messages per day</strong> — a classic case of overengineering. Sometimes, a simple cron job writing to an SQLite database does the job just fine.</p><h3>5.5. Final Thoughts</h3><p>With Big Data, you need careful storage and compute separation just to make the system work.</p><p>With small data, you don’t. You have options, and you should take advantage of them.</p><p>· Don’t default to SQL just because it’s familiar.</p><p>· Think about your access patterns first.</p><p>· Pick the simplest tool that solves the problem.</p><p>After all, flexibility is the true advantage of small data. 🚀</p><h3>5.6. Big or Small Data</h3><p><strong>Many workloads labeled as ‘Big Data’ are simply poorly optimized small data.</strong><br> The industry loves the term, but not all <strong>“Big Data problems”</strong> are truly big. Sometimes, what appears to be a scaling issue is just <strong>a lack of proper indexing, partitioning, or query optimization</strong>.</p><ul><li>If your system <strong>struggles to process a few terabytes of structured data</strong>, you might not need <strong>Hadoop or Spark</strong> — you may just need <strong>better schema design and indexing</strong>.</li><li>If your pipeline <strong>relies on daily batch jobs to process logs</strong>, a simpler <strong>event-driven system with proper aggregation</strong> could be more efficient than a full-blown <strong>Big Data stack</strong>.<br> Before reaching for <strong>complex distributed computing tools</strong>, ask:</li></ul><p><em>Do I have a Big Data problem, or do I have a poorly optimized Small Data problem?</em></p><h3>5.7. Conclusion</h3><p>SQL databases are a great tool — but not the only tool. The human desire for structure often leads us to over-rely on relational databases, even when they introduce inefficiencies.</p><p>The best architecture balances structure with flexibility. Before defaulting to SQL, ask yourself:</p><ul><li>Does all this data need to be <strong>hot and indexed</strong>?</li><li>Is SQL the right tool, or am I <strong>forcing structure</strong> where it’s not needed?</li><li>Can I <strong>reduce costs and improve performance</strong> with a better data lifecycle strategy?</li></ul><p>Are you dealing with SQL scalability headaches?<br>If your data is growing and <strong>you’re unsure how to scale without breaking the bank</strong>, let’s talk. <strong>I help teams with architecture and modernization strategies</strong> — reach out if you need a second opinion.</p><p>PS: Feel free to also visit my informal podcast “<a href="https://www.youtube.com/@proiex">PROIEX — Tech Experiences</a>”.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=9464766ec509" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>