Loading video...

Video Failed to Load

Go Home

Redis in 60 Second 👇 What is Redis ? Redis = REmote DIctionary Server An in-memory data store used mainly as: - Cache - Session store - Message broker - Real-time data store It’s insanely fast because data lives in RAM, not on disk. 🟢 Why Redis exists Typical...

22,326 views • 7 months ago •via X (Twitter)

21 Comments

Rahul's profile picture
Rahul7 months ago

Redis is fast until you have cache invalidation problems. Then it's a minefield. The real complexity isn't using Redis, it's deciding what belongs in-memory versus persistent storage. Most teams cache too aggressively and end up with stale data issues that are harder to debug than the original latency problem they tried to solve.

Nandkishor's profile picture
Nandkishor7 months ago

@genwinRahul Good Point Rahul

Jaydeep's profile picture
Jaydeep7 months ago

Well explained Redis has been a gamechanger in terms of writing software. Cache invalidating remains one of the big challenges but the pros outweigh the cons

Nandkishor's profile picture
Nandkishor7 months ago

Thanks. Yes Redis is the game-changer how smartly he is storing data in ram instead of disc so it can provide data back to the user instantly.

immoral cat's profile picture
immoral cat7 months ago

what u say if the redis down, the db also down due to cant handle real traffic?

Anupam's profile picture
Anupam7 months ago

Great explanation. Just revised the whole thing.

Nandkishor's profile picture
Nandkishor7 months ago

@Gooner__14 Thanks brother

Tech Fusionist | Kushal Gangil's profile picture
Tech Fusionist | Kushal Gangil7 months ago

Very well explained 🙌

Dipesh's profile picture
Dipesh7 months ago

I never knew that why redis is called redis. Now I know. REmote DIctionary Server

Nandkishor's profile picture
Nandkishor7 months ago

Perfect !

Anas's profile picture
Anas7 months ago

Well explained

Asaf | AI Search for SaaS's profile picture
Asaf | AI Search for SaaS7 months ago

The in-memory aspect definitely makes it a top choice for reducing latency.

A's profile picture
A7 months ago

Redis is a fast in memory data store used for caching sessions and real time applications.

Nandkishor's profile picture
Nandkishor7 months ago

Thanks for adding Redis is save a lot of time and execute request quickly

Divyansh's profile picture
Divyansh7 months ago

I just love these cat videos 🤣🤣. Great explanation btw

Nandkishor's profile picture
Nandkishor7 months ago

HaHa Thanks 😹

Navneet's profile picture
Navneet7 months ago

small thing but worth noting - Redis isn't *just* in RAM. AOF persistence can sync to disk every 1s for durability. we use this in prod and only risk losing max 1s of writes on node failure tradeoff: ~10% perf hit vs pure in-memory

Shefali's profile picture
Shefali7 months ago

Well explained!

Nandkishor's profile picture
Nandkishor7 months ago

Thanks Shefali.

Spidey's profile picture
Spidey7 months ago

Redis mainly get used in interview 🤣

Seriou's profile picture
Seriou7 months ago

good

Related Videos

Why is Redis Fast? Redis is fast for in-memory data storage. Its speed has made it popular for caching, session storage, and real-time analytics. But what gives Redis its blazing speed? Let's explore: RAM-Based Storage At its core, Redis primarily uses main memory for storing data. Accessing data from RAM is orders of magnitude faster than from disk. This is a major reason for Redis's speed. However, RAM is volatile. To persist data, Redis supports disk snapshots and append-only file logging. This combines RAM's performance with disk's permanence. There is a tradeoff though - recovery from disk is slow. If a Redis instance fails, restarting from disk can be slow compared to failing over to a replica instance fully in memory. So while Redis offers durability via disk, it comes at the cost of slower recovery. A better solution is Redis replication. With a synchronized replica kept in memory, failover is instant with no rehydration. This maintains speed and near-instant recovery. IO Multiplexing & Single-threaded Read/Write Redis uses an event-driven, single-threaded model for its core operations. A main event loop handles all client requests and data operations sequentially. This single-threaded execution avoids context switching and synchronization overhead typical of multi-threaded systems. Redis uses non-blocking I/O to handle multiple connections asynchronously. This allows it to support many client connections with very low overhead, Redis does leverage threading in certain areas: - Background tasks like taking snapshots. - I/O threads are used for certain operations. - Modules can use threads. - Since Redis 6.0, it supports multi-threaded I/O for network communication, improving performance on multi-core systems. Redis also uses pipelining for high throughput. Clients pipeline commands without waiting for each response. This allows more efficient network round trips, boosting overall performance. Efficient Data Structures Redis supports various optimized data structures, from linked lists, zip lists, and skip lists to sets, hashes, and sorted sets, among others. Each is carefully designed for specific use cases for quick and efficient data access. Over to you: With Redis now supporting some multi-threading, how should we configure it to fully utilize all the CPU cores of modern hardware when deploying in production? – Subscribe to our weekly newsletter to get a Free System Design PDF (158 pages):

Sahn Lam

46,910 views • 2 years ago

Redis built a cache that cuts LLM costs by 90%! Production LLM apps do not receive completely new questions every time. A customer-support assistant might receive all three of these: - "Can I get a refund after buying the monthly plan?" - "Is the monthly subscription refundable?" - "Can I cancel the plan and get my money back?" The wording is different, but the underlying question and its answer remain the same. Yet LLM apps process every version as a new request. They assemble the prompt, send it to the model, and generate an answer that may have already been generated. Prefix caching reduces part of these repeated calls. When requests begin with the same system prompt or context, the model can reuse the KV states already computed for that shared prefix. But the request still hits the LLM. The new tokens must be processed, and the complete answer must still be decoded. So even with a prefix-cache hit, there's another generation call involved. To solve this, instead of only caching computation inside the model, the application can cache the generated response outside it. When another question arrives, the system embeds it and compares it with previously answered questions. If it finds a sufficiently close match, it returns the stored response without invoking the LLM again. A cache hit removes the input tokens, output tokens, and decoding time associated with another LLM call. In practice, it is important to decide which questions can safely share an answer since a production setup needs well-tuned similarity thresholds, expiration policies, data isolation, and monitoring for incorrect matches. If you want to use this in practice, Redis already implements it as a managed service called Redis LangCache. Under the hood, it generates embeddings, searches previous responses, and returns a matching answer before another model call occurs. Redis also handles access scopes, custom filtering, TTL and eviction controls, and cache monitoring through Redis Cloud. I built an interface to compare it against direct LLM inference. The video below shows this in action, and I worked with Redis on this post to put this together. For the paraphrased question in my run, direct inference took 2.232 seconds and consumed 514 input tokens plus 250 output tokens. Redis returned the earlier response in 0.37 seconds with zero LLM input or output tokens. That was roughly 6x faster in this run. Redis reports API cost savings of up to 90% and cache-hit responses up to 15x faster. The actual result depends on how much safe repetition exists in the workload. You can try Redis LangCache here: If you want to dive deeper, I have already written a detailed breakdown of KV, prefix, prompt, and semantic caching in the article quoted below. This demo builds on the final technique and shows it running in practice. Read it below.

Avi Chawla

165,267 views • 9 days ago

JWT in 60 Seconds 👇 What is JWT ? JWT = JSON Web Token A compact, URL-safe token used for: - Authentication - Authorization - Secure API communication - Identity sharing between services It is digitally signed, so it can be verified and trusted. 🟢 Why JWT exists Typical flow without JWT: User → Application → Database (Session Store) - Server stores sessions - Requires memory/storage - Hard to scale in microservices - More infrastructure complexity - Needs sticky sessions behind Load Balancer - This doesn’t scale well in distributed systems. 🟢 JWT comes into the picture - JWT is stateless authentication. New flow: User → Application → JWT → Client → API - No session stored on server - Token carries user identity & claims - Server only verifies signature - Perfect for scalable systems. 🟢 Complete JWT request flow 1️⃣ User logs in with credentials 2️⃣ Server validates user 3️⃣ Server generates JWT (Header + Payload + Signature) 4️⃣ Client stores JWT (usually in browser/app) 5️⃣ Client sends JWT in Authorization header 6️⃣ Server verifies signature 7️⃣ If valid → Access granted No database lookup for session needed. 🟢 Where JWT is used in real systems? - REST APIs - Microservices authentication - OAuth2 / SSO - API Gateways - Kubernetes dashboards - CI/CD tools - Mobile & SPA applications - Almost every modern cloud-native app uses JWT. 🟢 JWT in DevOps & System Design : As a DevOps engineer, JWT knowledge is used in: - Designing stateless applications - Scaling apps behind Load Balancers - Implementing API security - Working with IAM & OAuth providers - Securing microservices communication - Reducing session storage dependency Stateless auth = Better scalability + Simpler infrastructure Thanks for reading. Happy Learning !

Nandkishor

27,917 views • 6 months ago

Start building for an agent-first world. If you have a product, you need to start offering skills for Claude, Codex, Cursor, and any other agents. Your skills should specify: • How to navigate and use your product • Best practices the agent must follow • Detailed instructions on how to accomplish things • Anti-patterns to avoid Redis is one of the most popular in-memory data stores in the world, and they just released their agent skills. It takes one second to install, and it will turn your agent into a Senior Redis Engineer: $ npx skills add redis/agent-skills In the attached video, I show you how to install it as a plugin in Claude Code and some of its benefits. This is the easiest way to "teach" models what they don't know and keep their knowledge up to date. If you ask me, skills is literally one of the most brilliant ideas that Anthropic has put out there. If you use Redis, their skill is a must-have. If you don't, this skill will show you how to build and structure yours. Here is what their skill teaches your agent: 1. Current patterns for common use cases: caching, rate limiting, session management, vector search, semantic caching, pub/sub, streams. 2. Which data structure to use and when: hashes vs. JSON vs. sorted sets vs. vector sets. 3. Anti-patterns to avoid: no KEYS in loops, no unbounded key growth, no large values that amplify every operation. 4. Production-aware defaults: connection pooling, pipelining, cluster compatibility, error handling that doesn't silently swallow failures.

Santiago

37,546 views • 6 months ago

Claude Code is now scary good at full-stack! I asked it to build a real-time weather intelligence dashboard with an interactive 3D globe and a forecasting layer that predicts weather 3 days ahead. It came back with a spinning globe that has a day/night cycle using NASA satellite imagery, city lights on the dark side, weather icons that switch between sun and moon based on local time, and a time travel slider that scrubs through 10 days of data. Claude Code built the whole thing in a single session, including the backend, database, data pipeline, and frontend. For the database, I needed something fast for time-series workloads since the app ingests hourly weather readings across many cities and serves time-range queries on every slider interaction. I used Tiger Cloud by Tiger Data - Creators of TimescaleDB, which gives you managed TimescaleDB on the Postgres you already know. Claude Code connected to it through the Tiger CLI MCP server and set up the entire backend directly: - Provisioned the database service - Created hypertables for time-partitioned weather storage - Set up continuous aggregates for pre-computed rollups - Built the data ingestion pipeline and the full NextJS + ThreeJS frontend The time travel slider queries thousands of rows on every position change. On a regular Postgres table, this would require manual partitioning and index tuning to stay fast as data grows. TimescaleDB partitions the data by timestamp automatically, so each query only hits the relevant time chunk. Continuous aggregates serve the trend charts and forecast layer from pre-computed rollups instead of rescanning raw data on every request. The video below shows the final build in action, and I worked with the Tiger Data team to put this together. Tiger CLI is open-source (Apache 2.0) and works with Claude Code, Cursor, Codex, Gemini CLI, and VS Code. To try this yourself: → Sign up for Tiger Cloud (I have shared the link in the replies). It gives you $1,000 free credits (no card needed) → Install Tiger CLI: curl -fsSL https(:)//cli(.)tigerdata(.)com | sh → Run tiger mcp install claude-code → Give Claude Code a prompt and let it build Find the sign-up link in the replies.

Avi Chawla

14,838 views • 3 months ago

Oracle just told every AI company on earth the same thing. Your models are worthless. Not the technology, talent or the billions spent training them. But the data they were trained on. Larry Ellison, the man who built Oracle into the backbone of global enterprise just dropped a bombshell. He said ChatGPT, Gemini, Grok, and Llama, all of them are training on the exact same data.​ The entire public internet, every Wikipedia page, Reddit thread and every news article. That means they're all converging essentially becoming the same product with different logos.​ Ellison's word for it is commodities. But here's where it gets dangerous. He says the real gold isn't public data, It's private data.​ The medical records in hospital systems, the financial data in bank vaults. The supply chain secrets of every Fortune 500 and guess where most of that data already lives. Not Google, Amazon or Microsoft but inside Oracle.​ Oracle databases hold most of the world's high value private enterprise data. So Oracle just launched something called AI Database 26ai.​ It lets the top AI models, ChatGPT, Gemini, Grok, Llama reason directly over a company's private data, without that data ever leaving the vault.​ They're using a technique called RAG, Retrieval Augmented Generation. The AI doesn't train on your data, it searches it in real time.​ Think about what that means. A bank could ask AI to analyze every loan it's ever made without exposing a single customer record. A hospital could have AI diagnose patients using its full medical history without violating HIPAA.​ A defense contractor could let AI reason across classified operations without data leaving a secure environment.​ Ellison is betting this is bigger than the training market. Bigger than the GPU boom. Bigger than the data center buildout.​ He called it the largest and fastest growing market in history.​ The numbers back the ambition. Oracle's remaining performance obligations just hit $523 billion. That's contracted revenue not yet delivered and $300 billion of it comes from OpenAI alone.​ Cloud revenue hit $8 billion in a single quarter, OCI grew 66 percent and GPU revenue surged 177 percent.​ But here's the part nobody's talking about. If private data becomes the real AI moat, then whoever controls the database controls the future of AI.​ And that's a level of power that should make everyone uncomfortable.

StockMarket.News

1,696,825 views • 6 months ago

Announcing a new Coursera course: Retrieval Augmented Generation (RAG) You'll learn to build high performance, production-ready RAG systems in this hands-on, in-depth course created by and taught by , experienced AI and ML engineer, researcher, and educator. RAG is a critical component today of many LLM-based applications in customer support, internal company Q&A systems, even many of the leading chatbots that use web search to answer your questions. This course teaches you in-depth how to make RAG work well. LLMs can produce generic or outdated responses, especially when asked specialized questions not covered in its training data. RAG is the most widely used technique for addressing this. It brings in data from new data sources, such as internal documents or recent news, to give the LLM the relevant context to private, recent, or specialized information. This lets it generate more grounded and accurate responses. In this course, you’ll learn to design and implement every part of a RAG system, from retrievers to vector databases to generation to evals. You’ll learn about the fundamental principles behind RAG and how to optimize it at both the component and whole-system levels. As AI evolves, RAG is evolving too. New models can handle longer context windows, reason more effectively, and can be parts of complex agentic workflows. One exciting growth area is Agentic RAG, in which an AI agent at runtime (rather than it being hardcoded at development time) autonomously decides what data to retrieve, and when/how to go deeper. Even with this evolution, access to high-quality data at runtime is essential, which is why RAG is a key part of so many applications. You'll learn via hands-on experiences to: - Build a RAG system with retrieval and prompt augmentation - Compare retrieval methods like BM25, semantic search, and Reciprocal Rank Fusion - Chunk, index, and retrieve documents using a Weaviate vector database and a news dataset - Develop a chatbot, using open-source LLMs hosted by Together AI, for a fictional store that answers product and FAQ questions - Use evals to drive improving reliability, and incorporate multi-modal data RAG is an important foundational technique. Become good at it through this course! Please sign up here:

Andrew Ng

124,656 views • 1 year ago

Understanding the BitTorrent Swarm — A Broader Look With Real Data Dynamics BitTorrent isn’t just a file-sharing protocol; it’s one of the most efficient large-scale distribution systems ever designed. At its core lies a simple but powerful principle: when users contribute bandwidth, the entire network accelerates. This is the swarm and its efficiency can be explained through clear data patterns and network behavior. 🔹 The Swarm Model: How Participation Becomes Performance In a traditional client-server setup, bandwidth is fixed. If 10,000 users try to download a 1 GB file from one server with 1 Gbps bandwidth: ➠ Maximum theoretical throughput per user: 0.1 Mbps ➠ Average download time: 2–3 hours ➠ Server overload: very likely BitTorrent rewrites this logic. When 10,000 users join a swarm and each contributes only 50–200 Kbps of upload bandwidth, the network’s total available throughput multiplies thousands of times. This is why, in real swarm studies: ➠ Larger swarms consistently show 30–400% faster download speeds ➠ Popular torrents reach equilibrium within minutes, not hours ➠ Throughput per user remains stable even under heavy demand BitTorrent’s efficiency grows with usage — something centralized systems struggle with. 🔹 Why More Peers = More Speed (Backed by Data Behavior) BitTorrent breaks files into hundreds or thousands of small pieces. Each piece circulates among peers using a strategy called rarest-first ensuring no piece becomes a bottleneck. Here’s what the data shows: 1. Bandwidth multiplication effect If each peer contributes: ➠ 100 peers × 100 Kbps upload = 10 Mbps swarm capacity ➠ 5,000 peers × 150 Kbps upload = 750 Mbps swarm capacity ➠ 20,000 peers × 200 Kbps upload = 4 Gbps swarm capacity This turning point when collective bandwidth surpasses any server is why torrents of large files often download faster than centralized sources. 2. Availability resilience Even if 90% of peers leave, as long as one full copy exists across the swarm’s collective pieces, the file is recoverable without interruption. 3. Load balancing automatically occurs BitTorrent’s choking/unchoking algorithm ensures: ➠ High-bandwidth peers exchange more data ➠ Low-bandwidth peers still participate ➠ No single peer becomes a bottleneck The data flow adapts in real time based on peer performance. 🔹 The Swarm’s Global Impact: Why It Still Matters BitTorrent traffic routinely accounts for: ➠ 10–20% of global internet upload traffic (varies by region) ➠ Multiple petabytes of data exchanged daily ➠ Millions of active swarms at any given time The model works because it scales with demand: ➠ More users → more bandwidth. ➠ More bandwidth → faster delivery. ➠ Faster delivery → stronger swarm health. This “self-reinforcing cycle” is a core reason decentralized systems from Web3 storage to blockchain data sync borrow heavily from BitTorrent’s architecture. 🔹 The Big Picture The BitTorrent swarm illustrates an important truth about decentralized networks: Efficiency doesn’t come from the center it comes from participation. When thousands of people contribute small amounts of bandwidth, the result is a global system capable of speeds that outperform traditional content delivery models. This is not just technology; it’s cooperative acceleration at internet scale. In One Line Files move faster when everyone contributes and BitTorrent proves it with real data. H.E. Justin Sun 👨‍🚀 🌞 BitTorrent #TRONEcoStar #BitTorrent #SwarmNetwork #DataAnalysis #DecentralizedSystems #P2P

catalina ossa

50,874 views • 10 months ago

The Machine That Learns The Law Behind The Data A very very interesting US Patent US10963540B2 - Physics Informed Learning Machine describes a learning system that does not begin with data alone. It begins with a physical model, usually written as a differential equation (or PDE) dx/dt = f(x,t) A normal Machine Learning model sees scattered data and tries to fit it. A physics-informed learning machine starts with a law. Then it treats the data as evidence that updates what the model believes about the physical system. For this application, I use the patent idea on NASA C-MAPSS Turbofan engine data. The machine watches multivariate telemetry from a degrading engine and infers a hidden health state that is not measured directly. From that posterior belief, it estimates the engine’s remaining useful life. In the main 3D scene, the engine lifetime is turned into a tunnel. The spiral ribbons are real sensor channels evolving over cycle-time. The glowing core is the inferred health state. The surrounding cloud is uncertainty. The orange wall ahead is the predicted failure horizon. So the big picture is: sensor evidence comes in, posterior belief tightens, and the machine moves from uncertainty toward a concrete failure prediction. The inset posteriors make that explicit. The health posterior shows where the model believes the hidden engine condition sits at the current moment, and how sharply it believes it. The RUL posterior shows the same idea for remaining life... early on it is broad, later it shifts left and narrows as the machine becomes more certain about how close failure is. This idea is not limited to engines. The same idea can apply to data centers, CPUs, GPUs, cooling systems, power grids, robotics, batteries, and any machine that produces telemetry while obeying physical constraints. In an age where machine learning runs on massive hardware infrastructure, this kind of model matters: it can turn noisy sensor streams into early warnings before expensive systems fail.

Mathelirium

17,843 views • 4 months ago

I built an app in Softr for the HVAC industry to solve some crucial problems. The problem is that those in the HVAC industry and similar industries like construction, plumbing, and electrical do not have one source of truth where: 1. Their clients can request for thier services. 2. Clients can be onboarded after they make a payment. 3. They store the information and bio data of their technicians. 4. They assign tasks to their technicians. 5. Technicians can track onsite jobs with pictures in real time of when working. 6. Clients see the progress of their projects. 7. Invoices and quotations from paid clients can be tracked. 8. Technicians borrow assets from the company, and they can be tracked. 9. There is a database where every individual, from technicians to admin and clients, are all stored. 10. Login details from every individual are secured and they can only see things that are their business without seeing that of another person, be ita technician or a client. These and many more are what people in these industries face as a challenge. I came up with a solution that addresses all these problems. I built a workflow that also auto-populated the users table in the database with technicians and clients when the records are filled in the technician and client tables, respectively. There is also a workflow that sends an email to the admin when a client makes a request from the portal. Taking advantage of the database, workflow, and portal gave a full-blown application for the HVAC industry. If you are in the construction, plumbing, electrical, or HVAC industry and you need a similar build, reach out, and I will be more than happy to replicate this for you or something similar in Softr.

Ada || Airtable, Zapier & Make.com

28,671 views • 9 months ago

Programmable Bandwidth is crypto’s next meta. Gm rent your spare Wi-Fi to AI. AI needs more data. AGI is coming. Are you ready? Bandwidth = how much data your connection moves per second. Residential IP = your home’s street address on the internet, trusted as human traffic that doesn’t get blocked. Together, Bandwidth + Residential IP = clean, high-trust traffic that data buyers and AI teams actually want. The community becomes the network. LLMs eat data. The more and the higher quality, the smarter they get. Owning the data pipeline = owning the power. Proof it’s valuable: big platforms license conversational & user-generated data for serious money. Many 8-figure+ deals are public, many more done under the table. Proprietary datasets are the real edge in this AI world. Why residential IPs matter: datacenter IPs get blocked by anti-scraping shields. Residential IP networks are resilient. Grass showed the playbook: idle bandwidth can pay twice 1️⃣ Web data collection via your node 2️⃣ Renting those nodes to GPU grids for training Data + compute = compounding revenue. Hub ( takes it further: aggregate community bandwidth → build a Residential IP Supernetwork → sell real-time data APIs to enterprises (from Meta to Web2 startups). The value loop: Community miners → Bandwidth pool → Enterprise feeds → Revenue → Rewards. If revenue outpaces incentives, everyone wins. Balancing it won’t be easy, time will tell. For miners: run on the network, earn points (likely $HUB at mainnet). Early participation can matter. Why DePIN? Community-run networks scale faster, are harder to censor, and more resilient than centralized systems. We are long programmable bandwidth thesis. In an agent-driven world, whoever controls the live data feed mints the money. DYOR. Register NOW

Q42

39,768 views • 1 year ago

This is a standard practice for almost all Tier-1 banking applications in Nigeria, and for some fintech applications I’ve previously performed pentests on. Client-side encryption isn’t a total waste, or a waste of compute, as some people have claimed, but rather a measure to protect against API tampering or API request/response manipulation between the client and the server when implemented properly. Even with HTTPS, attackers can capture a decrypted version of web or mobile API data in transit because the browser and the server establish a level of trust during the TLS handshake. Attackers can leverage this trust to capture & proxy already-decrypted traffic, tamper with it, and then forward it to the server. This allows them to override what the user interface or client is originally supposed to send and replace it with data of their choosing. That is why validation needs to be performed on both the client and the server side. To wrap up, encrypting API requests and responses makes it significantly harder for attackers to tamper with data, even if they capture the traffic, unless they have access to the encryption details (algorithm, encryption mode, key size, secret key, and initialization vector), assuming asymmetric encryption is used. In the demo below, you can see how I discovered additional parameters (balance, is_admin) in the API response, captured the registration API request, despite it being sent over HTTPS from the interface, added the discovered parameters, and successfully inflated my balance to 50 billion and also escalated my privileges to admin, and ultimately deleted the accounts of two live users/customers. In the second slide, I captured an API traffic of a bank app, and you can see how difficult the payloads are to read.

Ghost St Badmus

217,804 views • 9 months ago

Researchers made LLM inference 14x faster and 90% cheaper. The video below depicts the speed up in action. Providers discount cached input tokens by as much as 90% because a cache hit skips prefill compute entirely. For stable system prompts and tool definitions, hit rates of 60 to 85% are achievable, which makes it the highest-leverage inference optimization. But the cost saving only works when the cached text is an exact, byte-for-byte prefix of the new request. If you change one character anywhere before it, the entire cached region is missed. Three common request patterns produce full cache misses: - A query that needs documents A and B together can't reuse B's standalone cache, because those KV entries were computed without A in front of them. - The same three documents retrieved in a different order produce a full cache miss, even though nothing about the documents changed. - In multi-turn conversations, every new turn invalidates whatever was cached beyond the stable prefix. Alibaba's production data did a study on this and found that just 10% of cached KV blocks serve 77% of all cache hits. So most of what gets cached sits in storage and is never used a single time. And the root cause is that KV entries are position-dependent. Each token's KV encodes attention to everything before it, so a cached block is only valid in the exact context it was computed in. There's a second, less discussed problem as well. Cache management runs inside the inference engine's process. Moving KV tensors between GPU, CPU, and disk competes with inference for the same resources. This is why Google's TurboQuant compresses KV caches to 3 bits with no accuracy loss and still causes a 20%+ slowdown when it runs in-process. Fixing both problems means restructuring where caching lives. Cache management moves into its own process, the engine only exchanges block IDs over shared GPU memory, and heavy data movement runs across GPU, CPU, disk, and remote storage in parallel. Non-prefix reuse gets handled by selectively recomputing only the small set of tokens that attend across document boundaries. LMCache is the open-source project (10k+ stars) that implements this exact architecture, and it plugs into vLLM, SGLang, and TensorRT-LLM. The selective recomputation part is implemented in its CacheBlend technique, which makes cached docs in any order and combination, with 2-4x faster multi-document processing. On H200s running Qwen3-235B with 50 concurrent users, LMCache's multiprocess mode delivers 14x faster time-to-first-token and 4x faster decoding compared to in-process caching. GitHub repo: (don't forget to star 🌟) My co-founder wrote a full breakdown of KV cache management. It covers the disaggregated architecture behind the 14x speed up, how CacheBlend preserves generation quality while skipping recomputation, and how to turn every document in a knowledge base into a reusable cached asset. Read it below.

Avi Chawla

30,692 views • 2 months ago