MAC retweeted
How Redis Actually Works
Redis can handle 100,000+ operations per second with sub-millisecond latency. But how does it achieve this level of performance?
Let's break down what happens under the hood:
1. Client Connections
Clients connect to the Redis server over TCP and send commands like GET, SET, and INCR.
2. I/O Multiplexing
Instead of creating a separate thread for every connection, Redis uses I/O multiplexing (epoll on Linux) to efficiently monitor thousands of client connections and identify sockets ready for I/O.
3. Single-Threaded Event Loop
Redis executes most commands sequentially on a single main thread. This minimizes context switching, lock contention, and synchronization overhead. Modern Redis also supports additional threads for network I/O and background tasks.
4. In-Memory Data Structures
Redis stores data primarily in RAM, avoiding expensive disk access during normal command execution.
It supports several powerful data structures including Strings, Hashes, Lists, Sets, Sorted Sets and Streams.
5. Persistence
Despite being an in-memory database, Redis supports two main persistence mechanisms:
→ RDB: Periodically saves a point-in-time snapshot to disk using a forked child process and copy-on-write.
→ AOF (Append-Only File): Records write operations in an append-only log that can be replayed during recovery.
6. Replication
Redis asynchronously streams write operations from the primary server to its replicas.
Replicas can serve read requests, distribute read traffic, and support high availability through failover mechanisms.
This architecture makes Redis an excellent choice for distributed caching, session management, rate limiting, real-time leaderboards, and many other low-latency use cases.
♻️ Repost to help others learn this
MAC retweeted
𝗦𝗦𝗢 𝘃𝘀 𝗢𝗔𝘂𝘁𝗵 𝘃𝘀 𝗢𝗜𝗗𝗖 𝘃𝘀 𝗦𝗔𝗠𝗟.
Do you know the differences?
𝗦𝗦𝗢 is a user experience, not a protocol. It lets users log in once and access multiple apps without re-authenticating; providing seamless access across tools. It relies on protocols like SAML or OIDC.
𝗢𝗔𝘂𝘁𝗵 is for authorization. It lets apps access user data or services without sharing credentials. It controls what an app can access, not identity.
𝗢𝗜𝗗𝗖 is an authentication layer on top of OAuth 2.0. It verifies user identity and provides user info via ID tokens (usually JWTs). It’s the standard for login + identity in modern apps.
𝗦𝗔𝗠𝗟 is an older, XML-based standard primarily used for enterprise SSO. It’s still widely used in legacy and enterprise systems, though newer applications increasingly adopt OIDC. It’s powerful but more complex than OIDC.
OAuth = access.
OIDC = identity.
SAML = older enterprise SSO.
SSO = the experience.
But getting identity right doesn’t solve the whole access problem.
As more apps and AI agents connect to production data, managing permissions separately in every tool gets harder.
Retool centralizes that with SSO, role-based permissions, and Data Access Enforcement, giving teams shared guardrails underneath the apps and agents they build.
Build with the tools you already use. Run with Retool's enterprise controls.
𝗚𝗿𝗲𝗮𝘁 𝘀𝗵𝗼𝗿𝘁 𝗿𝗲𝗮𝗱 𝗼𝗻 𝗵𝗼𝘄 𝗶𝘁 𝘄𝗼𝗿𝗸𝘀 → lucode.co/article-retool-gov…
What else would you add?
——
💾 Save it for later.
🙏 Thanks to @retool for sponsoring this post.
➕ Follow me to improve at system design and AI engineering.
MAC retweeted
If you want to get good at Apache Kafka, learn these 15 concepts:
1. Event: A message containing data, such as an order placed or a payment completed.
2. Topic: A named stream where related events are stored, such as orders or payments.
3. Partition: A topic is divided into partitions, each storing events in the order they arrive.
4. Offset: A unique position within a partition that helps consumers track their reading progress.
5. Broker: A Kafka server that stores event data and handles reads and writes.
6. Producer: An application that publishes events to Kafka topics.
7. Consumer: An application that reads and processes events from Kafka topics.
8. Consumer Group: Multiple consumers that divide partitions among themselves to process events in parallel.
9. Rebalancing: Redistributes partition assignments when consumers join, leave, or group assignments change.
10. Replication: Keeps copies of partitions on multiple brokers so data remains available if a broker fails.
11. In-Sync Replicas (ISR): Replicas that are sufficiently caught up with the partition leader.
12. Exactly-Once Semantics: Ensures records produce a single committed result in supported Kafka processing workflows, even with retries.
13. Retention: Controls how long or how much data Kafka stores before deleting old records.
14. Log Compaction: Removes older records with the same key while preserving the latest value for each key.
15. KRaft: Kafka's built-in mechanism for managing cluster metadata and electing controllers without ZooKeeper.
♻️ Repost to help others learn this.
MAC retweeted
𝗦𝗟𝗢 𝘃𝘀 𝗦𝗟𝗜 𝘃𝘀 𝗦𝗟𝗔.
An 𝗦𝗟𝗜 (Service Level Indicator) measures what’s actually happening in your system; like request latency, error rate, or uptime. It’s the raw signal that tells you how your service is performing.
An 𝗦𝗟𝗢 (Service Level Objective) defines the acceptable range for an SLI, like “99.9% of requests succeed within 200ms.” It’s what your team aims to achieve to maintain reliability.
An 𝗦𝗟𝗔 (Service Level Agreement) is a formal contract with users or customers, often tied to penalties if targets aren’t met. It defines the consequences, not just the goal.
But a service isn't the only thing teams hold to a target.
A roadmap is a target too: which initiatives get the people, time and budget. Most roadmaps have no SLI behind them. People move, priorities shift, AI agents take on work without status updates, and the gap between plan and reality grows quietly.
Measuring that gap starts with the data work already produces. Tempo Loop connects time, capacity, spend and financials into one continuously updated view of whether the work still matches the strategy that funded it, for human and AI work alike.
𝗘𝘅𝗽𝗹𝗼𝗿𝗲 𝗧𝗲𝗺𝗽𝗼 𝗟𝗼𝗼𝗽 → lucode.co/tempo-loop-z72xd
What else would you add?
——
♻️ Repost to help others learn and grow.
🙏 Thanks to @TempoHQ for sponsoring this post.
➕ Follow me ( Nikki Siapno ) to improve at AI and system design.
MAC retweeted
Most developers can write code.
But can you design a system that handles millions of users without breaking?
Understanding System Design is what separates coding from engineering.
Check what you need to understand:
① Client Apps & API Gateways
② Application Services
③ Caching & Message Queues
④ Databases & External Services
⑤ Scalability & Reliability
⑥ Availability & Maintainability
⑦ Common System Failure Patterns
⑧ Real-world Food Delivery Architecture
Don't just learn how to build features. Learn how to design systems that scale.
Save this infographic. Study each component. Build something with it.
What's the most challenging part of System Design for you?
Repost ♻️ to help another developer learn.
MAC retweeted
RAG isn’t just connecting an LLM to a database.
It’s about building reliable AI systems.
→ Chunking & Embeddings
→ Vector Databases
→ Hybrid Search & Reranking
→ Query Rewriting
→ Multi-Query RAG
→ Agentic & Graph RAG
→ Evaluation & Grounded Answers
Bookmark this.
#AI
MAC retweeted
𝐖𝐡𝐚𝐭 𝐀𝐫𝐞 𝐅𝐮𝐧𝐜𝐭𝐢𝐨𝐧𝐚𝐥 𝐯𝐬 𝐍𝐨𝐧-𝐅𝐮𝐧𝐜𝐭𝐢𝐨𝐧𝐚𝐥 𝐑𝐞𝐪𝐮𝐢𝐫𝐞𝐦𝐞𝐧𝐭𝐬 𝐢𝐧 𝐒𝐲𝐬𝐭𝐞𝐦 𝐃𝐞𝐬𝐢𝐠𝐧?
A system can have all the right features and still fail.
Why? Because knowing what a system should do is only half the job. You must also understand how well it should perform.
That's where functional and non-functional requirements come in.
𝐖𝐡𝐚𝐭 𝐀𝐫𝐞 𝐅𝐮𝐧𝐜𝐭𝐢𝐨𝐧𝐚𝐥 𝐑𝐞𝐪𝐮𝐢𝐫𝐞𝐦𝐞𝐧𝐭𝐬?
Functional requirements define what a system must do.
They describe the features, behaviors, and business operations the system must support.
• User registration and login
• Creating, updating, and deleting records
• Processing payments
• Searching and filtering products
• Sending notifications
• Generating reports
𝐄𝐱𝐚𝐦𝐩𝐥𝐞:
An e-commerce system must allow users to add products to their shopping carts and complete purchases.
𝐖𝐡𝐚𝐭 𝐀𝐫𝐞 𝐍𝐨𝐧-𝐅𝐮𝐧𝐜𝐭𝐢𝐨𝐧𝐚𝐥 𝐑𝐞𝐪𝐮𝐢𝐫𝐞𝐦𝐞𝐧𝐭𝐬?
Non-functional requirements define how well a system must operate.
They describe quality attributes, performance expectations, and operational constraints.
• Performance — API responses should meet a defined latency target.
• Scalability — The system should handle increasing traffic.
• Availability — The service should meet its uptime target.
• Security — Sensitive data must be protected.
• Reliability — The system should behave consistently under expected conditions.
• Maintainability — Developers should be able to modify the system efficiently.
• Usability — Users should be able to navigate the application easily.
𝐄𝐱𝐚𝐦𝐩𝐥𝐞:
An e-commerce system should process 95% of product search requests within 200 milliseconds under a specified workload.
𝐅𝐮𝐧𝐜𝐭𝐢𝐨𝐧𝐚𝐥 𝐯𝐬 𝐍𝐨𝐧-𝐅𝐮𝐧𝐜𝐭𝐢𝐨𝐧𝐚𝐥 𝐑𝐞𝐪𝐮𝐢𝐫𝐞𝐦𝐞𝐧𝐭𝐬
Functional Requirements
User → Request → System Feature → Expected Business Result
The system performs a specific operation.
Example: A user can reset a forgotten password.
Non-Functional Requirements
User → Request → System Performance → Quality Target
The system meets defined quality expectations while performing its operations.
Example: Password reset requests are processed within two seconds under the agreed workload.
𝐇𝐨𝐰 𝐓𝐡𝐞𝐲 𝐖𝐨𝐫𝐤 𝐓𝐨𝐠𝐞𝐭𝐡𝐞𝐫
Imagine you're designing a banking application.
𝐅𝐮𝐧𝐜𝐭𝐢𝐨𝐧𝐚𝐥 𝐑𝐞𝐪𝐮𝐢𝐫𝐞𝐦𝐞𝐧𝐭𝐬
1. Users can log in securely.
2. Users can transfer money.
3. Users can view transaction history.
4. Users can download account statements.
5. The system sends transaction notifications.
𝐍𝐨𝐧-𝐅𝐮𝐧𝐜𝐭𝐢𝐨𝐧𝐚𝐥 𝐑𝐞𝐪𝐮𝐢𝐫𝐞𝐦𝐞𝐧𝐭𝐬
1. Transactions must satisfy defined latency targets.
2. The service must meet its availability objective.
3. Sensitive information must be encrypted appropriately.
4. The system must handle peak transaction volumes.
5. Financial transactions must preserve correctness and integrity.
Both are necessary. A banking system that supports money transfers but loses transactions is unacceptable. A perfectly secure system that cannot complete transfers is equally ineffective.
𝐓𝐡𝐞 𝐊𝐞𝐲 𝐃𝐢𝐟𝐟𝐞𝐫𝐞𝐧𝐜𝐞
Functional Requirements → What the system does.
Non-Functional Requirements → How well the system does it.
Functional requirements drive features and business logic.
Non-functional requirements influence architecture, infrastructure, database choices, caching, monitoring, and security controls.
𝐖𝐡𝐲 𝐓𝐡𝐞𝐲 𝐌𝐚𝐭𝐭𝐞𝐫 𝐢𝐧 𝐒𝐲𝐬𝐭𝐞𝐦 𝐃𝐞𝐬𝐢𝐠𝐧
• They clarify business expectations.
• They guide architectural decisions.
• They help teams define measurable success criteria.
• They expose scalability and reliability risks early.
• They reduce costly redesigns.
• They help developers balance performance, security, availability, and cost.
𝐏𝐫𝐨 𝐓𝐢𝐩
Don't write vague requirements like "the system must be fast" or "the application must be secure."
Make them measurable and testable.
Instead of: "The API must be fast."
Write: "The API must achieve a p95 response time below 200 ms at 1,000 requests per second under the defined test conditions."
Instead of: "The system must be available."
Write: "The service must achieve 99.95% monthly availability, measured using the agreed monitoring method."
Great system design starts with understanding both what you're building and the quality standards it must meet.
📘 Master System Design: codewithdhanian.gumroad.com/…
♻️ Repost this to help other developers master system design.
MAC retweeted
A price drop sounds like a simple notification feature to
Until one product drops from ₹5,000 → ₹3,999 and 10 million users are watching it.
Now you have a serious distributed systems problem.
The biggest challenge isn't sending notifications.
It's fan-out
1. Don't process notifications synchronously
- The price service should only update the price and publish an event.
Price Service
↓
Product DB
↓
Kafka: PRICE_CHANGED
- The notification system consumes this event asynchronously.
This keeps the price update fast even during massive spikes.
2. Shard the watchers
Never do:
Price changed
↓
Fetch 10M watchers
↓
Send notifications
Instead,
partition the watchers:
Product 123
├── Shard 1 → 1M users
├── Shard 2 → 1M users
├── Shard 3 → 1M users
└── ...
Now multiple workers can process different shards in parallel.
3. Put notifications behind a queue
Kafka
↓
Fanout Service
↓
Notification Queue
↓
Notification Workers
↓
Provider Router
↙ ↓ ↘
Push Email SMS
The queue absorbs traffic spikes and prevents notification providers from being overwhelmed.
4. Prevent duplicate alerts
- Clients retry.
- Workers retry.
- Providers can timeout.
- So the same notification might be processed multiple times.
Use an idempotency key such as:
- userId + productId + priceVersion + channel
If that key was already processed, don't send it again.
5. Handle provider failures
Don't retry failed notifications aggressively.
Use exponential backoff:
- 1 min → 5 min → 15 min → 1 hour
- After repeated failures, move the notification to a DLQ for later investigation or replay.
6. Protect your database
- User preferences shouldn't require a database query for every notification.
- Keep frequently accessed preferences in Redis and use the database as the source of truth.
- Delivery status can also be processed asynchronously instead of writing directly to the primary DB for every notification.
The final architecture:
Price Update
↓
Price Service
↓
Kafka
↓
Fanout Service
↓
Sharded Watchers
↓
Notification Queue
↓
Workers
↓
Provider Router
↙ ↓ ↘
Push Email SMS
↓
Delivery Events
↓
Status Store
The key lesson:
Don't solve 10 million notifications by adding a bigger server.
Use partitioning, batching, queues, idempotency, rate limiting, retries and backpressure.
The interesting system design question is:
How do you make one extremely popular product behave like normal traffic?
System Design: Design a Real-Time Price Drop Alert System
Imagine Amazon has millions of users tracking products.
A product price changes from ₹5,000 → ₹3,999.
Every user watching that product should get an alert.
Requirements:
- Millions of users and products
- Price updates can arrive in huge bursts
- Notify users through push/email
- Don't send duplicate alerts
- Respect user preferences
- Handle provider failures and retries
- Track delivery status
- One product can have millions of watchers
The interesting part:
What happens when one popular product drops in price and 10 million users need notifications at almost the same time?
How would you design it without overwhelming your database, queue, or notification providers?
MAC retweeted
Jev + Claude Opus 5.5... i can't understand why everyone isn't wiring this up yet
the forks alone drop from about $110 a day to $4 once jev takes them over. right now it's the best way i know to run opus
what jev handles:
-> scores which project notes matter before the context even loads
-> hands the easy steps to a faster worker
-> picks a recovery path when a tool fails, so nothing retries blind
-> runs the focused checks before the full test suite
opus does the hard reasoning. jev chooses from options the harness already prepared and validated
that's jev engineering in one line: the expensive model thinks, the cheap one decides
$106 a day back on the same work is a number your manager remembers
read the paper, then the full jev guide below
MAC retweeted
LLM Engineering Learning Roadmap
|-- AI & Machine Learning Foundations
| |-- Linear Algebra, Probability & Statistics
| |-- Supervised & Unsupervised Learning
| |-- Gradient Descent & Optimization
| |-- Model Evaluation & Validation
| |-- Data Preprocessing & Feature Engineering
|-- Deep Learning Fundamentals
| |-- Neural Networks & Backpropagation
| |-- Activation & Loss Functions
| |-- Regularization & Optimization
| |-- CNNs, RNNs & Sequence Models
| |-- PyTorch & TensorFlow Fundamentals
|-- Transformer Architecture
| |-- Attention Mechanism
| |-- Self-Attention & Multi-Head Attention
| |-- Encoder-Decoder Architecture
| |-- Positional Encoding
| |-- Transformer Training Pipeline
|-- LLM Fundamentals
| |-- Causal & Masked Language Models
| |-- Tokenization & Vocabulary
| |-- Pretraining Objectives
| |-- Context Windows & Token Limits
| |-- Model Scaling & Parameters
|-- Prompt Engineering
| |-- Zero-Shot & Few-Shot Prompting
| |-- Structured Prompting
| |-- System & Developer Instructions
| |-- Tool Calling & Function Calling
| |-- Prompt Evaluation & Optimization
|-- LLM Application Development
| |-- Chatbots & AI Assistants
| |-- Structured Output Generation
| |-- Streaming Responses
| |-- Multimodal LLM Applications
| |-- AI-Powered Developer Tools
|-- Retrieval-Augmented Generation (RAG)
| |-- Document Processing & Chunking
| |-- Embeddings & Semantic Search
| |-- Vector Databases
| |-- Hybrid Search & Reranking
| |-- Retrieval Evaluation & Optimization
|-- Fine-Tuning & Model Customization
| |-- Dataset Preparation & Cleaning
| |-- Supervised Fine-Tuning (SFT)
| |-- LoRA, QLoRA & PEFT
| |-- Instruction Tuning
| |-- Model Evaluation & Benchmarking
|-- AI Agents & Tool Use
| |-- Agent Architecture
| |-- Planning & Task Decomposition
| |-- Tool Calling & External APIs
| |-- Memory & Context Management
| |-- Multi-Agent Workflows
|-- LLM Evaluation & Safety
| |-- Accuracy & Relevance Evaluation
| |-- Hallucination Detection
| |-- Prompt & Model Testing
| |-- Guardrails & Content Safety
| |-- Bias, Privacy & Responsible AI
|-- LLM Infrastructure & Deployment
| |-- Model Serving & Inference
| |-- GPU & Memory Optimization
| |-- Quantization & Model Compression
| |-- Docker & Kubernetes
| |-- Cloud AI Infrastructure
|-- Performance & Cost Optimization
| |-- Latency & Throughput Optimization
| |-- KV Cache & Batching
| |-- Model Routing
| |-- Caching Strategies
| |-- Token & Infrastructure Cost Optimization
|-- LLMOps & Production Systems
| |-- Experiment Tracking
| |-- Model & Prompt Versioning
| |-- Monitoring & Observability
| |-- Logging & Tracing
| |-- Continuous Evaluation & Improvement
|-- Real-World LLM Engineering Projects
| |-- Build a Production AI Chatbot
| |-- Build a RAG Knowledge Assistant
| |-- Build an AI Coding Assistant
| |-- Build a Tool-Using AI Agent
| |-- Build and Deploy a Production LLM API
|-- Continuous Learning & Growth
| |-- Read LLM Research Papers
| |-- Explore Open-Source Models
| |-- Study Model Architectures & Benchmarks
| |-- Build Open-Source AI Projects
| |-- Follow New LLM Engineering Trends
Get the LLMs 2026 Development Projects Ebook
codewithdhanian.gumroad.com/…
This ebook helps you build practical LLM systems through prompt engineering, RAG, fine-tuning, AI agents, evaluation, deployment, and production-ready LLM workflows.
MAC retweeted
Jev is TypeSafe AI's first System One Model.
It is 100x faster and cheaper than frontier LLMs.
That opens up a lot of use cases people usually skip because the big models are too slow or too expensive for them.
Here are 9 use cases where we think Jev could be used instead of an LLM.
MAC retweeted
Clean Architecture vs Onion Architecture
𝗖𝗹𝗲𝗮𝗻 𝗔𝗿𝗰𝗵𝗶𝘁𝗲𝗰𝘁𝘂𝗿𝗲 organizes an application around its business rules and use cases, keeping them independent from external technologies.
The architecture typically separates entities, use cases, interface adapters, and frameworks or infrastructure. Dependencies point inward toward the core, helping keep business logic independent from databases, frameworks, UI, and external services. The focus is on separation of concerns, testability, and maintaining a stable application core.
𝗢𝗻𝗶𝗼𝗻 𝗔𝗿𝗰𝗵𝗶𝘁𝗲𝗰𝘁𝘂𝗿𝗲 also places the domain model at the center and pushes infrastructure concerns toward the outside.
The core domain contains the most important business rules, while application services surround it and infrastructure sits in the outer layers. Dependencies point toward the center, allowing the domain to remain independent from databases, frameworks, and external systems.
Clean Architecture emphasizes use cases and a structured separation between business rules, adapters, and infrastructure. Onion Architecture emphasizes the domain model at the center with dependencies flowing inward.
Both aim to protect business logic from infrastructure. The key difference is mainly how the architecture organizes and describes those boundaries.
What else would you add?
📘 Mastering Software Architectures:
codewithdhanian.gumroad.com/…
➕ Follow me ( @e_opore ) to improve at software architecture.
MAC retweeted
8 RAG Architectures Developers Should Know.
RAG isn't one fixed architecture. It's a spectrum of retrieval approaches that determine what gets searched, how results are ranked, and how much control the LLM has over retrieval.
Knowing these architectures is important. But understanding how to evaluate and choose the right one for your application is just as important.
Learn more about that here: lucode.co/production-rag-eva…
1. 𝗡𝗮𝗶𝘃𝗲 𝗥𝗔𝗚
↳ Retrieves the top matching chunks from a vector store and passes them directly to the LLM.
2. 𝗛𝘆𝗯𝗿𝗶𝗱 𝗥𝗔𝗚
↳ Combines keyword search with vector search, which helps when both exact terms and semantic meaning matter.
3. 𝗥𝗲𝗿𝗮𝗻𝗸𝗲𝗱 𝗥𝗔𝗚
↳ Retrieves a larger candidate set first, then scores and reorders chunks so the most relevant context gets used.
4. 𝗠𝘂𝗹𝘁𝗶-𝗤𝘂𝗲𝗿𝘆 𝗥𝗔𝗚
↳ Rewrites one question into multiple related queries to improve recall across different phrasings and document matches.
5. 𝗛𝗶𝗲𝗿𝗮𝗿𝗰𝗵𝗶𝗰𝗮𝗹 𝗥𝗔𝗚
↳ Searches broad document sections first, then narrows into smaller chunks for more precise retrieval.
6. 𝗚𝗿𝗮𝗽𝗵 𝗥𝗔𝗚
↳ Represents knowledge as entities and relationships, which helps when the answer depends on connected facts.
7. 𝗖𝗼𝗿𝗿𝗲𝗰𝘁𝗶𝘃𝗲 𝗥𝗔𝗚
↳ Checks whether retrieved context is useful and adjusts the retrieval process when the first results are weak.
8. 𝗔𝗴𝗲𝗻𝘁𝗶𝗰 𝗥𝗔𝗚
↳ Lets the LLM plan retrieval steps, choose tools or sources, and reason through multiple searches before answering.
Here's a simple mental model: Naive = fast and simple. Hybrid + Reranked = better precision. Multi-Query + Hierarchical = broader coverage. Graph = connected facts. Corrective = self-checking. Agentic = autonomous reasoning.
RAG helps models retrieve knowledge. Memory systems help them retain it. If you want to learn how production AI evolves beyond RAG into stateful memory systems, here's a great deep dive → lucode.co/rag-to-memory-syst…
What else would you add?
——
♻️ Repost to help others learn RAG.
🙏 Thanks to @Oracle for sponsoring this post.
➕ Follow me ( @NikkiSiapno ) to improve at AI engineering.


























