
β‘οΈ Guides: https://teapawt.org/t.co/XnyCOz3kgs π Demo/Features: https://teapawt.org/t.co/4WPqWeQZqk π§ Cloud Quizzes: https://teapawt.org/t.co/IB96Vy7kO3 π§πΌβ Founder: @CSJcode
Joined October 2024
- Tweets2.4K
- Following3.4K
- Followers1.9K
- Likes3.5K
SystemsArchitect.io retweeted
Amazon Says Cloud Infrastructure In Bahrain, UAE 'Beyond Saving' zerohedge.com/technology/amaβ¦
SystemsArchitect.io retweeted
System Design -Day 64 - Database Internals: How a Database Actually Works
We have completed Phase 2 - Messaging & Event-Driven Architecture.
Now we are starting:
Phase 3 - Database & Data-System Design
You write INSERT, SELECT, UPDATE, and DELETE.
But what actually happens inside the database after you execute that SQL?
Understanding the internals helps explain indexes, query performance, transactions, locks, caching, and scaling.
-------------------------------
The High-Level Picture
A database is much more than a collection of tables.
Application
β
SQL Query
β
Query Processor
β
Storage Engine
β
Buffer / Cache
β
Disk
Every layer has a different responsibility.
----------------------
SQL Doesn't Go Directly to Disk
When you execute:
SELECT * FROM orders
WHERE customer_id = 101;
The database doesn't simply search the disk row by row.
It first parses and analyzes the query.
SQL
β
Parser
β
Query Planner
β
Execution Plan
β
Execution
------------------
Query Parser
The parser checks whether the SQL is valid.
SELECT
FROM
WHERE
It builds an internal representation of the query.
For example:
SELECT
β
orders
β
customer_id = 101
Syntax errors are detected at this stage.
---------------------------
Query Planner / Optimizer
The database may have several ways to execute the same query.
For example:
Option A β Full Table Scan
Option B β Index Scan
Option C β Index + Table Lookup
The optimizer estimates the cost of each option and chooses a plan.
Query
β
Optimizer
β
Best Available Plan
This is why the same SQL can perform very differently depending on indexes and statistics.
----------------------------
Storage Engine
The storage engine is responsible for actually storing and retrieving data.
It handles things like:
- Data pages
- Indexes
- Reads
- Writes
- Caching
- Concurrency
- Durability
Conceptually:
Query
β
Storage Engine
β
Pages
β
Disk
Different databases use different storage-engine designs.
------------------------
Data Is Stored in Pages
Databases usually don't read one row from disk at a time.
They work with pages/blocks.
Disk
ββββββββββββββββββββββ
β Page 1 β
β Row Row Row Row β
ββββββββββββββββββββββ€
β Page 2 β
β Row Row Row Row β
ββββββββββββββββββββββ€
β Page 3 β
β Row Row Row Row β
ββββββββββββββββββββββ
A page is the basic unit of many database I/O operations.
------------------------------
Buffer Pool / Cache
Disk is much slower than memory.
So databases keep frequently used pages in memory.
Query
β
Buffer Pool
β
Page Found? ββ YES β Use Memory
β
NO
β
Read From Disk
β
Put Page In Memory
This is one of the biggest reasons database memory matters.
-------------------
What Happens During an INSERT?
Suppose:
INSERT INTO orders
VALUES (101, 500);
Conceptually:
INSERT
β
Parse
β
Plan
β
Modify Page in Memory
β
Write Log
β
Eventually Flush Page
The database doesn't necessarily write the complete data page to disk immediately.
This is where write-ahead logging becomes important.
---------------------------
Write-Ahead Log (WAL)
Before modifying durable database state, the database records the change in a log.
Transaction
β
WAL
β
Data Pages
If the database crashes:
Crash
β
Read WAL
β
Recover Changes
WAL is a fundamental building block for durability and crash recovery.
------------------
What Happens During SELECT?
For:
SELECT * FROM orders
WHERE id = 101;
The database may:
Query
β
Query Plan
β
Index Lookup
β
Find Page
β
Buffer Pool
β
Read Row
β
Return Result
If there is no useful index:
Query
β
Full Table Scan
β
Read Many Pages
β
Find Matching Row
This is why indexing matters.
--------------------
Why Database Internals Matter
These concepts explain many production problems.
Slow query?
Could be:
Bad Query Plan
Missing Index
Large Table Scan
Poor Statistics
Disk I/O
Database suddenly slow?
Could be:
Buffer Pool Misses
High Disk I/O
Lock Contention
Connection Exhaustion
Data after crash?
Think:
WAL
Recovery
Durability
Understanding the internals helps you diagnose the why, not just apply random fixes.
---------------------
The Complete Picture
Application
β
SQL Query
β
βββββββββββββββββ
β Query Parser β
βββββββββ¬ββββββββ
β
βββββββββββββββββ
β Query Planner β
βββββββββ¬ββββββββ
β
βββββββββββββββββ
βStorage Engine β
βββββββββ¬ββββββββ
β
Buffer Pool
β β
Memory WAL
β β
ββββ Disk
----------------------
Key Takeaway
When you execute SQL, the database goes through a chain of systems:
SQL
β
Parse
β
Plan
β
Execute
β
Buffer / Cache
β
Pages
β
Disk + WAL
The important mental model is:
A database is a query processor sitting on top of a sophisticated storage system.
Once you understand that, concepts like indexes, query plans, transactions, MVCC, locks, replication, and sharding become much easier to reason about..
SystemsArchitect.io retweeted
βοΈ System Design Series | Module 1 [Foundations] | Post 12
Load Balancing - L4 vs L7
SystemsArchitect.io retweeted
LLM Gateway Architecture
Your application shouldn't have this everywhere:
openai. chat(...)
Then somewhere else:
anthropic.messages(...)
And somewhere else:
gemini.generate(...)
Now imagine changing models across 50 services.
That's where an LLM Gateway becomes extremely useful.
Instead of:
Application
β
OpenAI
Use:
Application
β
LLM Gateway
β
ββββββββΌβββββββ
β β β
OpenAI Anthropic Gemini
The application talks to one interface.
The gateway handles the complexity.
-------------------------
What is an LLM Gateway?
An LLM Gateway is an infrastructure layer between your applications and one or more AI model providers.
It can centralize:
- Authentication
- Model routing
- Rate limiting
- Retries
- Fallbacks
- Caching
- Logging
- Cost tracking
- Security
- Observability
-----------------------------
Why Do We Need One?
Without a gateway:
Service A βββ OpenAI
Service B βββ Anthropic
Service C βββ Gemini
Service D βββ OpenAI
Every service manages:
- API keys
- Provider SDKs
- Retry logic
- Rate limits
- Monitoring
- Model configuration
That's difficult to maintain.
-------------------------------
With an LLM Gateway
βββ OpenAI
β
Application β Gateway ββ Anthropic
β
βββ Gemini
Applications use one consistent interface.
------------------------------
1. Centralized Authentication
Don't distribute provider API keys across every service.
Instead:
Application
β
LLM Gateway
β
Provider Credentials
β
LLM Provider
Secrets stay centralized.
----------------------------
2. Model Routing
The gateway can decide which model should handle a request.
Simple Request
β
Fast / Cheap Model
Complex Request
β
Powerful Model
Routing can consider:
- Cost
- Latency
- Quality
- Availability
- Request type
-------------------
3. Rate Limiting
Suppose your application suddenly receives 100,000 requests.
The gateway can enforce:
User
β
Rate Limiter
β
Allowed?
βββ Yes β LLM
βββ No β Reject / Queue
This protects your providers and your budget.
--------------------
4. Retry & Timeout
LLM providers can fail.
Request
β
Provider
β
Timeout
β
Retry
β
Fallback Provider
The application doesn't need to implement this logic repeatedly.
---------------------------
5. Fallbacks
Example:
Primary Model
β
Unavailable
β
Fallback Model
β
Response
This can keep your application available even when a provider has an outage.
------------------------
6. Cost Tracking
A gateway can track usage per:
- User
- Team
- Application
- Model
- Tenant
Example:
Tenant A
β
$120 / month
Tenant B
β
$85 / month
This becomes extremely important at scale.
-------------------------
7. Observability
The gateway can capture:
Request
β
Model
β
Latency
β
Tokens
β
Cost
β
Status
Now you can identify expensive or slow workflows.
---------------------------
8. Caching
Repeated requests can sometimes be served from a cache.
Request
β
Cache
βββ HIT β Response
βββ MISS β LLM β Store
This reduces both latency and cost.
------------------------------
Production Architecture
βββ OpenAI
β
Application ββ> LLM βββββΌββ Anthropic
Gateway β
βββ Gemini
β
ββββββββ΄βββββββ
β β
Cache Observability
β β
Rate Limits Cost Tracking
β
Security
β
Fallbacks
The gateway becomes the control plane for LLM traffic.
---------------------------
Gateway vs Direct Provider Integration
Direct Integration LLM Gateway
Provider-specific code Unified interface
Keys in applications Centralized credentials
Duplicate retry logic Centralized retries
Difficult model switching Easy routing
Scattered monitoring Centralized observability
Harder cost tracking Centralized usage tracking
Provider lock-in Easier multi-provider strategy
--------------------------
Common Mistakes
βHardcoding provider APIs everywhere
βScattering API keys across services
βNo rate limiting
βNo timeout strategy
βNo fallback
βNo cost tracking
βNo centralized observability
βMaking the gateway a single point of failure
------------------------
Best Practices
β Keep applications provider-agnostic
β Centralize provider credentials
β Add rate limits
β Implement timeouts
β Use controlled retries
β Support fallback models/providers
β Track tokens and costs
β Monitor latency
β Make the gateway highly available
β Keep routing policies configurable
-------------------------
Key Takeaway
An LLM Gateway isn't just a proxy.
It's the control layer between your applications and AI providers.
It gives engineering teams control over:
Routing β Reliability β Security β Cost β Observability
And when you have multiple applications, multiple models, and multiple providers...that control layer becomes extremely valuable.
SystemsArchitect.io retweeted
AI Agent Observability & Tracing: Debugging What Your Agent Actually Does
Imagine your AI agent gives the wrong answer.
Where did it fail?
- Was the query rewritten incorrectly?
- Did retrieval miss the right documents?
- Did the wrong tool get selected?
- Did the API fail?
- Did the reflection step reject the correct answer?
Without observability...
You're debugging a black box.
Production AI systems need end-to-end tracing, not just application logs.
-----------------------------------
What is AI Agent Observability?
Observability is the ability to inspect, measure, and understand everything an AI agent does while solving a task.
User Request
β
Agent Workflow
β
Logs + Traces + Metrics
β
Debug & Optimize
Instead of only seeing the final response, you see every decision that led to it.
---------------------------------------
Why Observability Matters
Suppose a user asks:
Generate last month's revenue report.
The agent:
- Plans tasks
- Retrieves data
- Calls SQL
- Generates charts
- Summarizes results
- Sends an email
If something fails, you need to know exactly which step failed.
--------------------------------------
1. Execution Trace
Every action becomes part of a trace.
User Query
β
Planner
β
Tool Call
β
RAG Search
β
Reflection
β
Final Response
This shows the complete execution path.
------------------------------------
2. Tool Call Tracing
Track every external interaction.
Tool
β
Start Time
β
End Time
β
Status
β
Response
Useful for identifying slow or failing tools.
--------------------------------------
3. LLM Observability
Monitor every model invocation.
Capture:
- Prompt
- Retrieved Context
- Model
- Token Usage
- Latency
- Cost
- Output
This helps optimize performance and spending.
--------------------------------------
4. RAG Tracing
Track the retrieval pipeline.
Query
β
Query Rewrite
β
Hybrid Search
β
Reranker
β
Compression
β
LLM
This helps identify retrieval bottlenecks.
----------------------------------
5. Memory Observability
Understand memory behavior.
Memory Read
β
Memory Update
β
Memory Delete
Detect unnecessary memory growth or missing context.
---------------------------------------
6. Agent Timeline
Visualize everything chronologically.
09:01 Planner
09:02 Tool
09:03 Database
09:04 Reflection
09:05 Final Answer
A timeline often reveals delays immediately.
------------------------------------
7. Metrics Dashboard
Track production metrics such as:
β Success Rate
β Failure Rate
β Latency
β Tool Errors
β Token Usage
β Cost per Request
β Hallucination Rate
β Retrieval Accuracy
---------------------------------------
8. Distributed Tracing
Large systems involve many services.
User
β
Gateway
β
Planner
β
Tool Service
β
Database
β
LLM
β
Response
A single trace follows the request across all components.
--------------------------------------
Production Architecture
User
β
Gateway
β
Planner
β
Memory
β
RAG
β
LLM
β
Tool Calls
β
Reflection
β
Final Response
β
ββββββββββββββββββββββ
Logs
Traces
Metrics
Alerts
Dashboards
-------------------------------------
Common Mistakes
βLogging only the final answer
βNo trace IDs
βIgnoring token usage
βMissing tool latency
βNo retrieval visibility
βNo cost monitoring
βNo centralized dashboards
βDebugging production issues manually
----------------------------------------
Best Practices
β Trace every workflow step
β Log every tool invocation
β Monitor retrieval quality
β Track token consumption
β Measure latency per component
β Correlate logs with trace IDs
β Build dashboards
β Alert on abnormal failures
β Continuously optimize workflows
---------------------------------
Key Takeaway
You can't improve what you can't observe.
Production AI systems aren't monitored only at the application level.
They monitor:
- Planning
- Memory
- Retrieval
- Tool Calls
- LLM Responses
- Reflection
- Costs
- Performance
Observability transforms AI from a mysterious black box into an engineering system you can measure, debug, and continuously improve.
SystemsArchitect.io retweeted
This is HOW we build, test, and scale Agent Skills at Google.
Open-source Google Agent skills GitHub Repo: github.com/google/skills
SystemsArchitect.io retweeted
Backend Roadmap (Part 6/11): Concurrency & Async Programming
Your server gets 10,000 requests at once.
Do they wait in line - or get handled simultaneously?
That answer defines whether your backend scales or crashes.
In this post, I covered everything that makes backends fast and non-blocking:
# Sync vs Async -> Synchronous code blocks. Asynchronous code doesn't wait - tasks start, run, and complete independently. For IO-bound work, async wins every time.
# Concurrency Models:
- Multi-threading -> Multiple threads, great for CPU-bound tasks
- Event Loop -> Single thread handles thousands of IO tasks (Node.js, Deno)
- Async/Await -> Makes async code look and read like synchronous code
# Async Patterns - the evolution:
- Callbacks -> works, but leads to callback hell
- Promises -> cleaner chaining with .then().catch()
- Async/Await -> most readable, built on top of Promises
# Common Pitfalls to avoid:
- Never block the event loop with heavy CPU work
- Always handle errors in async code
- Too many concurrent ops = overwhelmed resources
- Use semaphores, queues, and connection pooling
Key mental model:
β’ Concurrency = structure (dealing with many tasks)
β’ Parallelism = execution (doing many tasks literally at once)
β’ IO-bound ->async + event loop
β’ CPU-bound ->worker threads + multi-threading
Choose the right tool. Write non-blocking code. Build scalable systems.
This is Part 6 of my "11 Skills Every Backend Developer Should Master in 2026" series.
Next up -> Distributed Systems (Microservices, Service Mesh, Eventual Consistency)
Do you prefer Promises or Async/Await? And are you using worker threads for CPU tasks? π
Backend Roadmap (Part 5/11): Event-Driven Systems
Most systems are built to respond to requests.
The best systems are built to react to events.
That's the shift that makes your architecture truly scalable, decoupled, and real-time.
In this post, I broke down everything you need to know:
# Apache Kafka - The industry standard for high-throughput event streaming. Topics, Partitions, Offsets, Consumer Groups - built for logs, metrics, data pipelines, and event sourcing at massive scale.
# Apache Pulsar - The cloud-native challenger. Separates storage (Bookies) from compute (Brokers), supports both streaming AND queuing, stronger multi-tenancy. Built for IoT, SaaS, and multi-tenant systems.
Messaging Patterns:
- Pub/Sub -> One producer, many consumers (broadcast)
- Queue -> One producer, one consumer processes it (work distribution)
Key mental model:
- Kafka -> High throughput, log-based, single-purpose streaming
- Pulsar -> Flexible, multi-purpose, storage-compute separation
- Both -> Partitions ensure ordering + parallelism
- Always -> Design idempotent events, handle failures with DLQ
Events are the fuel. Systems are the engines. Build for what happens next.
Monitor lag, set retention policies, partition by key - and your event-driven system will scale to millions.
This is Part 5 of my "11 Skills Every Backend Developer Should Master in 2026" series.
Next up -> Concurrency & Async Programming (Async I/O, Reactive Programming, Structured Concurrency)
Are you using Kafka or Pulsar in production? What's your experience? π
SystemsArchitect.io retweeted
BREAKING: $AMZN is up 9% today after AWS cloud revenue grew 37% to $42.2 BILLION, its fastest growth in 18 quarters.
Total revenue hit $200.6 billion, up 20% and above the $196.5 billion expected.
Amazon also raised its 2026 capex to $220 billion from $200 billion.
The market didn't care, because AWS accelerating for a fifth straight quarter is the proof that the AI spending is producing returns.
Apple fell -8% on the same day after weak guidance. Investors are now picking their AI winners.
SystemsArchitect.io retweeted
AI is evolving faster than ever, but most people are only scratching the surface.
If you want to stay ahead in 2026, mastering prompts alone isn't enough.
You need to understand the 5 core foundations driving today's AI revolution:
π€ Autonomous AI Systems (Agentic AI)
π§ Intelligent AI Agents
π¬ Large Language Models (LLMs)
π¨ Generative AI
π Retrieval-Augmented Generation (RAG)
Each plays a unique role.Together, they power everything from AI copilots and autonomous workflows to enterprise automation and intelligent search.
Whether you're a developer, founder, marketer, cybersecurity professional, or simply AI-curious, these five pillars will shape the next generation of software and business.
Which pillar are you currently exploring the most?π
Share your answer in the comments.
#ArtificialIntelligence #AI #GenerativeAI #AgenticAI #AIAgents #LLMs #RAG #MachineLearning #TechInnovation #FutureOfWork #Automation #DataScience #AIEngineering #Innovation #Technology
SystemsArchitect.io retweeted
Backend Engineering isn't just APIs.
You need databases, caching, authentication, system design, DevOps, microservices, and scalability.
Here's the complete roadmap. π
SystemsArchitect.io retweeted
βΈοΈ Kubernetes Looks Complexπ₯
Until you understand
what each component actually does π¨βπ»
From Pods β API Server β CoreDNS,
these components work together
to run modern cloud applications at scale π
If you're learning Kubernetes,
master these components first.
Everything else becomes easier after that π₯
SystemsArchitect.io retweeted
12 Docker Concepts every Software Engineer must know!
React Native devs can now build AR + VR apps without learning Unity π€―
Same React Native codebase β works on phones + Meta Quest.
@ReactVisionXR
This changes a LOT for developers π§΅
SystemsArchitect.io retweeted
Kubernetes becomes much easier once you realize it is mostly the same AWS patterns you already know. Just running inside a cluster.
Take Network Policies, for example
In AWS, you create a Security Group rule like this:
> > Allow port 5432 from the app Security Group to the RDS Security Group
You are not opening random IPs.
You are allowing one identity to talk to another.
Kubernetes does the exact same thing:
> > Only pods with label `app=api` can talk to pods with label `app=db` on port 5432
That is basically a Security Group for pods.
And once this clicks, Kubernetes stops feeling alien.
More useful mappings:
> > ALB --> Ingress Controller
> > Target Group --> Service
> > Auto Scaling Group --> Deployment
> > IAM Role --> ServiceAccount + IRSA
> > EBS Volume --> PersistentVolume
> > Route 53 Private Zone --> CoreDNS
The engineers who struggle with Kubernetes try to memorize YAML.
If you already understand cloud architecture, you are already much closer to Kubernetes than you think.
You are not starting from zero.
You are translating concepts you already know.
π€ Made with AI
SystemsArchitect.io retweeted
System Design Series - Day 21/30
Alerting That Doesn't Destroy Your Sleep
Bad alerting is worse than no alerting.
If every little thing wakes you up at 3 AM, youβll eventually ignore all alerts.
Then the real emergency comes⦠and you miss it.
Hereβs how to build smart alerting that actually works (and lets you sleep peacefully).
Thread π
SystemsArchitect.io retweeted
I loved reading the first edition of "Designing Data-Intensive Applications". It is the most comprehensive book on the types of systems I work on. I recently started reading the second edition. It was a pleasant surpriseβand rather humblingβto read the references in Chapter 1.
SystemsArchitect.io retweeted
AI AGENT LAYERS
INPUT AND PERCEPTION LAYER
β Collects and interprets user input from text, voice, images, or sensors
β Processes natural language and external data sources
β Converts raw input into structured information for decision-making
β Technologies: NLP, Speech Recognition, Computer Vision
MEMORY LAYER
β Stores short-term and long-term contextual information
β Maintains conversation history and user preferences
β Enables personalization and contextual reasoning
β Technologies: Vector Databases, Embeddings, Knowledge Bases
REASONING LAYER
β Analyzes information and makes intelligent decisions
β Applies logic, inference, and contextual understanding
β Helps the AI agent determine the best action to take
β Technologies: LLMs, Rule Engines, Knowledge Graphs
PLANNING LAYER
β Breaks complex goals into smaller actionable tasks
β Creates workflows and execution sequences
β Optimizes task completion strategies
β Technologies: Task Planners, Workflow Engines, Agent Frameworks
TOOL USAGE LAYER
β Connects the AI agent with external tools and APIs
β Enables actions like web search, database queries, and automation
β Expands the capabilities of the AI system beyond text generation
β Examples: APIs, Browsers, Calculators, Code Interpreters
EXECUTION LAYER
β Performs tasks and executes planned actions
β Handles automation and task orchestration
β Interacts with external systems and environments
β Technologies: Python Scripts, Cloud Functions, Automation Pipelines
LEARNING AND FEEDBACK LAYER
β Improves agent performance using feedback and interactions
β Learns from previous outcomes and user corrections
β Enhances decision-making accuracy over time
β Technologies: Reinforcement Learning, Fine-Tuning, Feedback Loops
SECURITY AND GOVERNANCE LAYER
β Ensures safe, secure, and ethical AI operations
β Implements permissions, authentication, and policy enforcement
β Prevents harmful or unauthorized actions
β Technologies: Access Control, Encryption, Monitoring Systems
COMMUNICATION LAYER
β Delivers responses and updates to users clearly
β Supports multi-channel communication platforms
β Ensures smooth human-AI interaction
β Examples: Chat Interfaces, Voice Assistants, Messaging Platforms
OBSERVABILITY AND MONITORING LAYER
β Tracks agent behavior, performance, and reliability
β Logs activities, errors, and execution metrics
β Helps improve system stability and debugging
β Technologies: Logging Systems, Monitoring Dashboards, Alerts
FLOW OVERVIEW
USER
β INPUT AND PERCEPTION LAYER
β MEMORY LAYER
β REASONING LAYER
β PLANNING LAYER
β TOOL USAGE LAYER
β EXECUTION LAYER
β COMMUNICATION LAYER
β USER
This layered AI Agent architecture ensures intelligent automation, contextual reasoning, scalability, and reliable task execution.
Grab the AI Agent ebook: codewithdhanian.gumroad.com/β¦
SystemsArchitect.io retweeted
Kubernetes Deployment Strategies need not be that complex to understand.
Here, Iβve made this to simplify the understanding.
48K+ read my DevOps and Cloud newsletter: techopsexamples.com/subscribβ¦
What do we cover:
DevOps, Cloud, Kubernetes, IaC, GitOps, MLOps
π Consider a Repost if this is helpful






































