Code Farming
Author

Code Farming

Senior engineer at a top internet giant, sharing Java, AI, tech knowledge, growth insights, and interview experiences.

38
Articles
0
Likes
132
Views
0
Comments
Recent Articles

Latest from Code Farming

38 recent articles
Code Farming
Code Farming
Jul 23, 2026 · Backend Development

Cut Authentication Traffic 50‑Fold with JWT: A Simple Token Strategy

The article explains how replacing centralized session lookups with JWT-based local verification can cut authentication latency from 15 ms to 0.3 ms—a roughly 50‑fold improvement—while describing a double‑token strategy, its refresh flow, security best practices, and trade‑offs such as delayed revocation.

Access TokenJWTRefresh Token
0 likes · 6 min read
Cut Authentication Traffic 50‑Fold with JWT: A Simple Token Strategy
Code Farming
Code Farming
Jul 22, 2026 · Backend Development

Designing a 5‑Layer Flash‑Sale System to Handle Millions of Requests

To survive a million concurrent flash‑sale clicks, the article breaks down a production‑grade, five‑layer architecture—CDN, load balancer, API gateway, Redis/Lua stock control, message‑queue order processing, and a state‑machine fallback—that filters traffic early, uses atomic operations, and decouples writes to keep database load to just a few QPS.

Flash SaleLuaMySQL
0 likes · 7 min read
Designing a 5‑Layer Flash‑Sale System to Handle Millions of Requests
Code Farming
Code Farming
Jul 20, 2026 · Backend Development

How a Message Queue Keeps Flash‑Sale Systems Stable Under 10k Orders per Second

The article explains how using a message queue as a buffer, asynchronous processor, and decoupling layer enables flash‑sale systems to handle tens of thousands of orders per second, reducing database overload, cutting response time from 500 ms to 50 ms, and preventing cascade failures.

Flash SaleHigh ConcurrencySystem Design
0 likes · 5 min read
How a Message Queue Keeps Flash‑Sale Systems Stable Under 10k Orders per Second
Code Farming
Code Farming
Jul 13, 2026 · Backend Development

Mastering Traffic Control: Keeping Systems Stable Under a Million Concurrent Requests

The article explains how to prevent system crashes during massive traffic spikes by applying three core techniques—rate limiting, circuit breaking, and graceful degradation—detailing algorithm choices, state machines, and practical implementation steps for high‑concurrency back‑end services.

BackendCircuit BreakerHigh Concurrency
0 likes · 6 min read
Mastering Traffic Control: Keeping Systems Stable Under a Million Concurrent Requests
Code Farming
Code Farming
Jul 13, 2026 · Backend Development

Designing Trillion‑Scale Counters: From MySQL to a Custom Redis Engine

The article dissects a proven trillion‑level counter architecture, tracing its evolution from a simple MySQL table through hash sharding, a full Redis migration, deep Redis memory optimizations, and hot‑cold separation, while detailing the trade‑offs and performance gains at each step.

High ConcurrencyRedis optimizationcounter architecture
0 likes · 6 min read
Designing Trillion‑Scale Counters: From MySQL to a Custom Redis Engine
Code Farming
Code Farming
Jul 9, 2026 · Cloud Native

How Service Registries Enable Dynamic Addressing in Distributed Systems

The article explains why static service addresses break in micro‑service architectures, then breaks down the core mechanisms of a registration center—service registration and discovery, heartbeat health checks, and a selection matrix of Nacos, Eureka, ZooKeeper, and ETCD—providing practical guidance for choosing the right solution.

EurekaNacosZooKeeper
0 likes · 6 min read
How Service Registries Enable Dynamic Addressing in Distributed Systems
Code Farming
Code Farming
Jul 7, 2026 · Backend Development

Four Ways to Ensure Unique IDs After Database Sharding

When a system is split into multiple databases and tables, the article explains the root cause of ID collisions and compares four mainstream ID generation strategies—UUID, database auto‑increment, Snowflake, and segment allocation—detailing their trade‑offs, pitfalls, and selection guidelines for different concurrency levels.

High ConcurrencySnowflakeUUID
0 likes · 9 min read
Four Ways to Ensure Unique IDs After Database Sharding
Code Farming
Code Farming
Jul 2, 2026 · Backend Development

Five Fatal Cache Pitfalls Explained with Five Diagrams

The article outlines five common cache design problems—penetration, concurrency, avalanche, hot‑data management, and business‑cache coupling—illustrates each with a diagram, and provides concrete Redis‑based solutions such as placeholder values, setNX locks, random TTLs, sorted‑set queues, and a Binlog‑Canal‑MQ pipeline.

CacheCache ConcurrencyCache Decoupling
0 likes · 7 min read
Five Fatal Cache Pitfalls Explained with Five Diagrams
Code Farming
Code Farming
Jul 1, 2026 · Databases

Redis Core Principles Explained with Four Diagrams

This article breaks down Redis’s core mechanisms—including its single‑threaded performance tricks, AOF and RDB persistence designs, and the evolution of high‑availability from replication to Sentinel and Cluster—using four clear diagrams to help readers master the system.

AOFPersistenceRDB
0 likes · 6 min read
Redis Core Principles Explained with Four Diagrams
Code Farming
Code Farming
Jun 24, 2026 · Databases

MySQL Indexes: Master B+Tree Fundamentals to Nail Interview Questions

The article breaks down MySQL index mechanics into four visual sections, explaining B+Tree structure, why it outperforms B‑tree, hash and binary trees, common index‑failure scenarios, and three practical optimization techniques, giving interviewees a clear framework to answer index‑related questions confidently.

B+ TreeIndex OptimizationMySQL
0 likes · 7 min read
MySQL Indexes: Master B+Tree Fundamentals to Nail Interview Questions