<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Microservices | 1byteone - Java Backend / AI Application Developer</title><link>https://1byteone.github.io/en/tags/microservices/</link><atom:link href="https://1byteone.github.io/en/tags/microservices/index.xml" rel="self" type="application/rss+xml"/><description>Microservices</description><generator>HugoBlox Kit (https://hugoblox.com)</generator><language>en-us</language><lastBuildDate>Fri, 21 Aug 2026 00:00:00 +0000</lastBuildDate><image><url>https://1byteone.github.io/media/icon_hu_1c0e9cb08cfb822a.png</url><title>Microservices</title><link>https://1byteone.github.io/en/tags/microservices/</link></image><item><title>Production Spring Boot Architecture</title><link>https://1byteone.github.io/en/blog/spring-boot-production-architecture/</link><pubDate>Fri, 21 Aug 2026 00:00:00 +0000</pubDate><guid>https://1byteone.github.io/en/blog/spring-boot-production-architecture/</guid><description>&lt;p&gt;&lt;em&gt;Whiteboard note: the goal is not to memorize boxes, but to connect each arrow to a request, a contract, and an operational signal.&lt;/em&gt;&lt;/p&gt;
&lt;h2 id="start-with-a-real-scenario"&gt;Start with a real scenario&lt;/h2&gt;
&lt;p&gt;Use this situation as the mental model: &lt;strong&gt;A flash-sale service protects the database with cache, bounded writes, idempotency, and asynchronous inventory events.&lt;/strong&gt;. A useful backend diagram answers four questions: where does input enter, who owns state, which boundary can fail, and how do we know the system is healthy? The flow is &lt;strong&gt;Gateway → Service → Cache / DB / MQ → Observability&lt;/strong&gt;.&lt;/p&gt;
&lt;h2 id="deconstructing-the-architecture"&gt;Deconstructing the architecture&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Contract&lt;/strong&gt;: define input, output, and error shape before adding implementation detail.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Mechanism&lt;/strong&gt;: Nginx / Gateway → auth + rate limit; Service → idempotency + transaction. This is the part that determines latency, throughput, and testability.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;State and resources&lt;/strong&gt;: Redis → cache-aside with TTL; MySQL → source of truth. Explain creation, ownership, cleanup, and recovery.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Failure path&lt;/strong&gt;: RocketMQ → async side effects; combine it with &lt;strong&gt;Metrics + Logs + Traces → feedback loop&lt;/strong&gt; when choosing a fallback, retry, or rollback.&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id="a-small-implementation-boundary"&gt;A small implementation boundary&lt;/h2&gt;
&lt;p&gt;The following sketch is intentionally small. It shows where a production implementation should place validation and ownership rather than pretending that a happy path is enough.&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;request → bounded resource → validated boundary → observable result
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Keep external systems behind an adapter, repository, client, or gateway. The domain layer should depend on a stable contract so tests can use fakes and incidents can be isolated to one boundary.&lt;/p&gt;
&lt;h2 id="engineering-decisions-for-the-scenario"&gt;Engineering decisions for the scenario&lt;/h2&gt;
&lt;ol&gt;
&lt;li&gt;&lt;strong&gt;Protect dependencies first.&lt;/strong&gt; Pools, queues, semaphores, caches, and worker counts need explicit limits. An unbounded queue only hides overload.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Preserve correctness.&lt;/strong&gt; Use an idempotency key, transaction boundary, lock, version check, or schema validation where retries or concurrency can duplicate work.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Optimize with evidence.&lt;/strong&gt; Use traces, slow-query data, GC pauses, queue depth, or p99 latency before choosing a cache, index, batch size, or concurrency setting.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Make recovery testable.&lt;/strong&gt; Timeout, retry, rate limit, circuit breaking, rollback, and alerting should be exercised in a drill.&lt;/li&gt;
&lt;/ol&gt;
&lt;h2 id="common-mistakes"&gt;Common mistakes&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;Drawing only the happy path while omitting timeout, empty data, rejection, rollback, or replica lag.&lt;/li&gt;
&lt;li&gt;Treating framework defaults as business contracts and discovering their limits after an upgrade.&lt;/li&gt;
&lt;li&gt;Scaling machines before measuring pool exhaustion, lock contention, slow SQL, allocation, or event-loop blocking.&lt;/li&gt;
&lt;li&gt;Treating logs as the only observability tool; metrics, traces, sampling, and redaction are also required.&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id="production-checklist"&gt;Production checklist&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;&lt;input disabled="" type="checkbox"&gt; Input, output, and error responses have explicit schemas&lt;/li&gt;
&lt;li&gt;&lt;input disabled="" type="checkbox"&gt; Dependencies have timeout, retry budgets, rate limits, and fallback behavior&lt;/li&gt;
&lt;li&gt;&lt;input disabled="" type="checkbox"&gt; Pools and queues expose capacity, waiting, and rejected-work metrics&lt;/li&gt;
&lt;li&gt;&lt;input disabled="" type="checkbox"&gt; Important state has idempotency, transaction, or recovery semantics&lt;/li&gt;
&lt;li&gt;&lt;input disabled="" type="checkbox"&gt; Logs, metrics, and traces share a request or correlation ID&lt;/li&gt;
&lt;li&gt;&lt;input disabled="" type="checkbox"&gt; Regression tests, load tests, and failure drills use production-like data&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id="summary"&gt;Summary&lt;/h2&gt;
&lt;p&gt;You understand this whiteboard when you can start from one request, explain every arrow&amp;rsquo;s contract, state how each risk is handled, and name the signal that would tell you to change the design.&lt;/p&gt;</description></item><item><title>Distributed Micro Cloud Mall</title><link>https://1byteone.github.io/en/projects/ecommerce-rag-search/</link><pubDate>Fri, 15 May 2026 00:00:00 +0000</pubDate><guid>https://1byteone.github.io/en/projects/ecommerce-rag-search/</guid><description>&lt;p&gt;Microservice E-commerce Platform - SpringCloud Alibaba Stack (Nacos/Gateway/Sentinel) + MyBatis-Plus + Feign Remote Calls.&lt;/p&gt;
&lt;h2 id="project-overview"&gt;Project Overview&lt;/h2&gt;
&lt;p&gt;Complete practice from monolithic to microservice architecture, covering enterprise middleware integration and distributed solutions. The project benchmarks against mid-senior Java backend engineer core competency models.&lt;/p&gt;
&lt;h2 id="professional-goal-position-capability-benchmarking"&gt;Professional GOAL (Position Capability Benchmarking)&lt;/h2&gt;
&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Level&lt;/th&gt;
&lt;th&gt;Capability Domain&lt;/th&gt;
&lt;th&gt;Coverage Modules&lt;/th&gt;
&lt;th&gt;Weight&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;🥇 &lt;strong&gt;Distributed Architecture&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Microservice splitting, service governance, distributed transactions, message queues&lt;/td&gt;
&lt;td&gt;mall-order-service, mall-seckill-service, Middleware&lt;/td&gt;
&lt;td&gt;35%&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;🥈 &lt;strong&gt;Middleware Depth&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Redis cache, ES search, RocketMQ messaging, Seata transactions, Sentinel rate limiting&lt;/td&gt;
&lt;td&gt;docs/Middleware/ (11 middlewares)&lt;/td&gt;
&lt;td&gt;30%&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;🥉 &lt;strong&gt;Business Implementation&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Product/User/Cart/Order CRUD, JWT auth, AOP logging&lt;/td&gt;
&lt;td&gt;mall-product-service, mall-user-service, mall-cart-service&lt;/td&gt;
&lt;td&gt;25%&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;🏅 &lt;strong&gt;Engineering&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Docker containerization, Gateway, Nacos config center, CI deployment&lt;/td&gt;
&lt;td&gt;mall-gateway, docs/docker/&lt;/td&gt;
&lt;td&gt;10%&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;h2 id="technical-architecture"&gt;Technical Architecture&lt;/h2&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-fallback" data-lang="fallback"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;┌──────────┐ ┌──────────┐ ┌──────────┐
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;│ Client │ │ Client │ │ Client │
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;└────┬─────┘ └────┬─────┘ └────┬─────┘
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; └──────────────┴──────────────┘
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; │
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; ┌──────┴──────┐
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; │ Spring Cloud │
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; │ Gateway │ ← Unified Auth + Routing + Rate Limiting
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; └──────┬──────┘
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; │
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; ┌──────────┼──────────┐
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; │ │ │
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;┌────┴────┐ ┌──┴───┐ ┌───┴────┐
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;│ Services │ │Middle│ │Infra │
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;│ User │ │Redis │ │Nacos │
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;│ Product │ │MySQL │ │Sentinel│
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;│ Order │ │Mongo │ │Seata │
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;│ Cart │ │ES │ │XXL-Job │
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;│ Pay │ │MQ │ │ │
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;│ Seckill │ │Canal │ │ │
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;└─────────┘ └──────┘ └─────────┘
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h2 id="project-structure"&gt;Project Structure&lt;/h2&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-fallback" data-lang="fallback"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;mall-micro-cloud/
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;├── mall-api/ # Feign Interface Layer
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;├── mall-common/ # Common Utilities
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;├── mall-gateway/ # Spring Cloud Gateway
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;├── mall-services/
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;│ ├── mall-user-service/ # User Service (JWT + BCrypt)
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;│ ├── mall-product-service/ # Product Service (MyBatis-Plus)
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;│ ├── mall-cart-service/ # Cart Service (Redis Cache)
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;│ ├── mall-order-service/ # Order Service (Seata Distributed Tx)
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;│ ├── mall-pay-service/ # Payment Service (RocketMQ Tx Messages)
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;│ ├── mall-seckill-service/ # Seckill Service (High Concurrency)
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;│ ├── mall-es-service/ # Search Service (Elasticsearch)
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;│ ├── mall-oss-service/ # Object Storage Service
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;│ ├── mall-scheduler-service/ # Scheduler Service (XXL-Job)
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;│ ├── mall-consumer-service/ # Message Consumer Service
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;│ └── mall-test-service/ # Test Service
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;├── docs/
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;│ ├── Middleware/ # 11 Middleware Tutorials
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;│ ├── interview/ # Interview Questions (9 chapters)
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;│ ├── db-sql/ # Business SQL
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;│ └── docker/ # Docker Deployment Guide
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;└── pom.xml # Maven Parent POM
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h2 id="technical-highlights"&gt;Technical Highlights&lt;/h2&gt;
&lt;h3 id="1-distributed-architecture"&gt;1. Distributed Architecture&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Microservice Splitting&lt;/strong&gt;: Independent services by business domain&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Service Governance&lt;/strong&gt;: Nacos discovery + Gateway routing&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Distributed Transactions&lt;/strong&gt;: Seata AT mode for cross-service consistency&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id="2-deep-middleware-integration"&gt;2. Deep Middleware Integration&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Redis&lt;/strong&gt;: Cache + Distributed Lock + Session Management&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Elasticsearch&lt;/strong&gt;: Full-text Search + IK Analyzer&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;RocketMQ&lt;/strong&gt;: Async Messaging + Transaction Messages&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Sentinel&lt;/strong&gt;: Rate Limiting + Circuit Breaking&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id="3-high-concurrency-seckill"&gt;3. High-Concurrency Seckill&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;Redis pre-deduction + Redisson reentrant lock&lt;/li&gt;
&lt;li&gt;RocketMQ async persistence prevents overselling&lt;/li&gt;
&lt;li&gt;Sentinel rate limiting protects system stability&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id="4-engineering-practices"&gt;4. Engineering Practices&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;Docker containerization&lt;/li&gt;
&lt;li&gt;Gateway unified authentication&lt;/li&gt;
&lt;li&gt;Nacos configuration center&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id="project-results"&gt;Project Results&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Architecture&lt;/strong&gt;: 11 microservices designed and governed&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Middleware&lt;/strong&gt;: 11 enterprise middlewares integrated&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Performance&lt;/strong&gt;: 10k+ concurrent stress testing passed&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Documentation&lt;/strong&gt;: Complete middleware tutorials and interview questions&lt;/li&gt;
&lt;/ul&gt;
&lt;hr&gt;
&lt;p&gt;&lt;strong&gt;Project Status&lt;/strong&gt;: ✅ Completed&lt;br&gt;
&lt;strong&gt;GitHub&lt;/strong&gt;:
&lt;/p&gt;</description></item></channel></rss>