Posts

Showing posts with the label cache

Python code examples for implementing an ML ensemble using Redis

  Important Setup Note: RedisAI and RedisML are no longer actively maintained as of 2025/2026. Therefore, Pattern B has evolved into standard deployment patterns using lightweight modern tools (like ONNX Runtime or FastAPI workers coupled directly with Redis), ensuring your pipeline remains production-grade. Pattern A: Asynchronous Parallel Processing (Redis Streams) Best for: Heavy models (Deep Learning, large Random Forests) that need separate workers or hardware (GPUs) to compute in parallel without locking your main API. Architecture Flow [Client Request] │ ▼ ┌───────────┐ XADD ┌───────────────┐ │ FastAPI │ ────────────────>│ Redis Stream │──┐ (Model 1 Worker) │ Gateway │ │(ml:requests) │──┼─> [Model 2 Worker] └───────────┘ └───────────────┘──┘ (Model 3 Worker) │ │ │ (Polls responses via │ XADD │ ...

Dynamic Programming (DP) & GPUs KV Caching

Image
                                                 generated by Gemini AI Dynamic Programming (DP) is a powerful algorithmic paradigm used to solve complex problems by breaking them down into simpler sub-problems, solving each sub-problem just once, and storing their solutions—usually using memory-based structures like arrays or tables—to avoid redundant computations. It is highly effective for problems that exhibit two core properties: Overlapping Sub-problems: The problem can be broken down into sub-problems which are reused multiple times. Optimal Substructure: The optimal solution to the global problem can be constructed from the optimal solutions of its sub-problems. Dynamic Programming (DP), GPUs, and KV caching are deeply intertwined in modern AI workloads—particularly in large language models (LLMs) and sequence-to-sequence architectures. At a high level,...

Azure Session Management

Image
  Photo by SHVETS production Say we are going to create an application for customer management. Which requires faster interaction from the customer to the application. So we need to manage the session with cache. Users can log in from any device and use it seamlessly from any other device without any issues. Below is an end-to-end solution for user login and session management using Azure Redis Cache, API Gateway, Load Balancer, Azure App Service, and Azure Function serverless with a Flask application in the backend. In Azure, maintaining distributed session data typically involves using a combination of Azure services and technologies. Here are some best practices and technologies you can use to keep and manage distributed session data: 1. Azure Cache for Redis:    - Description: Azure Cache for Redis is a fully managed, in-memory data store service built on the popular open-source Redis. It is commonly used to store and manage session data for web applications.   ...