<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"><channel><title>Vinh&apos;s Notes</title><description>Daily notes on system design, Java and backend technology by Nguyen Quang Vinh.</description><link>https://notes.vinhnq.com/</link><item><title>Adapter and Factory: integrating a payment gateway and picking the right implementation</title><link>https://notes.vinhnq.com/en/posts/adapter-va-factory-pattern/</link><guid isPermaLink="true">https://notes.vinhnq.com/en/posts/adapter-va-factory-pattern/</guid><description>Review an Adapter for a payment gateway that takes VND (a cast that drops the cents, double for money, int overflow) and rewrite it with Money, a sealed result and per-currency rounding. Then tell simple factory, Factory Method and Abstract Factory apart, build a bean registry in Spring, and avoid two wiring traps: @RequiredArgsConstructor with non-final fields and injecting by a parent class.</description><pubDate>Wed, 18 Nov 2026 00:00:00 GMT</pubDate></item><item><title>Architecture docs part 2: ADRs, quality requirements, the risk register and an address component example</title><link>https://notes.vinhnq.com/en/posts/adr-va-quality-requirement/</link><guid isPermaLink="true">https://notes.vinhnq.com/en/posts/adr-va-quality-requirement/</guid><description>Recording decisions in ADRs with rejected alternatives and consequences, turning &apos;fast and stable&apos; into measurable quality requirements, a risk and technical-debt register, and a sample solution design for an address component with a PostgreSQL schema that was actually run and the review findings it needs.</description><pubDate>Wed, 18 Nov 2026 00:00:00 GMT</pubDate></item><item><title>Virtual memory, page cache, swap and the JVM in containers</title><link>https://notes.vinhnq.com/en/posts/bo-nho-ao-page-cache-va-jvm/</link><guid isPermaLink="true">https://notes.vinhnq.com/en/posts/bo-nho-ao-page-cache-va-jvm/</guid><description>Virtual memory, page tables, the TLB and page faults; overcommit, swap and the OOM killer; why a JVM&apos;s RSS is bigger than its heap and how to size a container memory limit; the page cache and mmap; CPU caches, cache lines, false sharing and why the Java Memory Model exists.</description><pubDate>Wed, 18 Nov 2026 00:00:00 GMT</pubDate></item><item><title>Index types beyond the B-tree: hash, GIN, GiST, bitmap and LSM trees</title><link>https://notes.vinhnq.com/en/posts/cac-loai-index-gin-gist-lsm-bitmap/</link><guid isPermaLink="true">https://notes.vinhnq.com/en/posts/cac-loai-index-gin-gist-lsm-bitmap/</guid><description>When a B-tree isn&apos;t enough: hash and the adaptive hash index, GIN for arrays, jsonb and full-text, GiST for time ranges, coordinates and exclusion constraints against double booking, bitmap indexes vs bitmap scans, and LSM trees for write-heavy systems. Measured on PostgreSQL 16 and MySQL 8.4.</description><pubDate>Wed, 18 Nov 2026 00:00:00 GMT</pubDate></item><item><title>Cache-aside, write-around and keeping the cache consistent with the database</title><link>https://notes.vinhnq.com/en/posts/cache-aside-va-invalidation/</link><guid isPermaLink="true">https://notes.vinhnq.com/en/posts/cache-aside-va-invalidation/</guid><description>Where caches live, how to measure them, read and write strategies, why invalidation is hard, and a three-attempt case study: update or delete the cache, in which order, which race survives, and how to close it with TTLs, retries, CDC and versions.</description><pubDate>Wed, 18 Nov 2026 00:00:00 GMT</pubDate></item><item><title>Caching in system design: cache tiers, the limits of Redis, and a 1-million-QPS counter case study</title><link>https://notes.vinhnq.com/en/posts/cache-nhieu-tang-va-bo-dem-quy-mo-lon/</link><guid isPermaLink="true">https://notes.vinhnq.com/en/posts/cache-nhieu-tang-va-bo-dem-quy-mo-lon/</guid><description>Where caches sit between the client and the database, three jobs (speeding up, buffering, sharing data), the limits of one Redis in numbers, designing like/view counters for a social network at 1 million QPS, unread broadcast notification counts with read pointers, and five small problems solved with Redis data structures.</description><pubDate>Wed, 18 Nov 2026 00:00:00 GMT</pubDate></item><item><title>Tuning Kafka for your goal: throughput, latency, durability, availability</title><link>https://notes.vinhnq.com/en/posts/cau-hinh-kafka-theo-muc-tieu/</link><guid isPermaLink="true">https://notes.vinhnq.com/en/posts/cau-hinh-kafka-theo-muc-tieu/</guid><description>No configuration maxes out all four goals: rank throughput, latency, durability and availability first (a financial system differs from an ingestion pipeline), then pick producer, consumer, topic and broker values; plus Spring Boot 3, the auto-commit trap, CooperativeSticky, partition counts and a 3-broker KRaft docker compose lab.</description><pubDate>Wed, 18 Nov 2026 00:00:00 GMT</pubDate></item><item><title>Deployment strategies: rolling, blue-green, canary, feature flags and zero downtime on Kubernetes</title><link>https://notes.vinhnq.com/en/posts/chien-luoc-deploy-rolling-blue-green-canary/</link><guid isPermaLink="true">https://notes.vinhnq.com/en/posts/chien-luoc-deploy-rolling-blue-green-canary/</guid><description>Recreate, rolling, blue-green, canary, shadow and feature flags compared on rollback, cost and database compatibility; expand/contract migrations so two versions can run side by side; the Kubernetes a backend developer needs (probes, maxSurge/maxUnavailable, resources, PodDisruptionBudget), Spring Boot graceful shutdown and health groups, and what to watch during a canary.</description><pubDate>Wed, 18 Nov 2026 00:00:00 GMT</pubDate></item><item><title>Choosing a database in system design: SQL, NoSQL, NewSQL, columnar and time-series</title><link>https://notes.vinhnq.com/en/posts/chon-database-sql-nosql-newsql/</link><guid isPermaLink="true">https://notes.vinhnq.com/en/posts/chon-database-sql-nosql-newsql/</guid><description>The limits of one relational database in numbers, why an RDBMS is hard to scale out, five NoSQL families and NewSQL scored on the same scale, columnar for OLAP, time-series for metrics, and how to choose by the level of contention.</description><pubDate>Wed, 18 Nov 2026 00:00:00 GMT</pubDate></item><item><title>CI/CD for a Spring Boot backend: a GitHub Actions pipeline from commit to production</title><link>https://notes.vinhnq.com/en/posts/ci-cd-pipeline-cho-backend/</link><guid isPermaLink="true">https://notes.vinhnq.com/en/posts/ci-cd-pipeline-cho-backend/</guid><description>How CI, continuous delivery and continuous deployment differ; a complete GitHub Actions workflow for a Spring Boot service (build, unit tests, Testcontainers, static analysis, image build and scan, deploy); Maven caching, branching, image tags, secrets and OIDC, quality gates, Flyway in the pipeline, promoting artifacts across environments, faster pipelines and rollback.</description><pubDate>Wed, 18 Nov 2026 00:00:00 GMT</pubDate></item><item><title>Clean code: why it matters, naming, functions and control flow</title><link>https://notes.vinhnq.com/en/posts/clean-code-dat-ten-ham-va-luong-dieu-khien/</link><guid isPermaLink="true">https://notes.vinhnq.com/en/posts/clean-code-dat-ten-ham-va-luong-dieu-khien/</guid><description>Clean code seen as the cost of change: Ousterhout&apos;s three symptoms of complexity, naming, small single-purpose functions, SRP/OCP class design with sealed interfaces, one level of abstraction per function, guard clauses and lower cognitive complexity.</description><pubDate>Wed, 18 Nov 2026 00:00:00 GMT</pubDate></item><item><title>Clean code: error handling, boundaries, tests and refactoring real code</title><link>https://notes.vinhnq.com/en/posts/clean-code-loi-boundary-va-refactor/</link><guid isPermaLink="true">https://notes.vinhnq.com/en/posts/clean-code-loi-boundary-va-refactor/</guid><description>The practical side of clean code: error-handling rules and checked vs unchecked exceptions, comments and formatting, tests without over-mocking, wrapping third-party SDKs behind adapters, the refactoring catalogue, and a checkout refactor whose golden master test caught a rounding bug.</description><pubDate>Wed, 18 Nov 2026 00:00:00 GMT</pubDate></item><item><title>Code review: resolving disagreements and two worked reviews of real code</title><link>https://notes.vinhnq.com/en/posts/code-review-bat-dong-va-review-mau/</link><guid isPermaLink="true">https://notes.vinhnq.com/en/posts/code-review-bat-dong-va-review-mau/</guid><description>When reviewer and author disagree: the steps from listening, establishing context and measuring with a PoC to escalating and disagree-and-commit, through a case study of a 5-minute fraud-check wait. Then two worked reviews written as labelled comments: a Spring Boot booking flow and a Redis distributed lock.</description><pubDate>Wed, 18 Nov 2026 00:00:00 GMT</pubDate></item><item><title>Code review: goals, a checklist, the process and writing comments</title><link>https://notes.vinhnq.com/en/posts/code-review-hieu-qua/</link><guid isPermaLink="true">https://notes.vinhnq.com/en/posts/code-review-hieu-qua/</guid><description>Code review for backend teams: what review is for, a checklist for Java/Spring, peer and group review, PR size (and a figure that&apos;s often misattributed), labelled TODO/NIT/OPTIONAL/FYI comments, and what to leave to CI.</description><pubDate>Wed, 18 Nov 2026 00:00:00 GMT</pubDate></item><item><title>Connection pooling and HikariCP: internals, settings and sizing</title><link>https://notes.vinhnq.com/en/posts/connection-pool-hikaricp/</link><guid isPermaLink="true">https://notes.vinhnq.com/en/posts/connection-pool-hikaricp/</guid><description>Why connection pools exist, how HikariCP waits for a connection (ConcurrentBag), the settings that matter (maximumPoolSize, connectionTimeout, maxLifetime, keepaliveTime, leakDetectionThreshold), sizing with the formula and Little&apos;s Law, PgBouncer transaction pooling, @Transactional holding connections, virtual threads, HTTP client pools and the metrics to watch, with a JDK 21 experiment measured in numbers.</description><pubDate>Wed, 18 Nov 2026 00:00:00 GMT</pubDate></item><item><title>Airline booking: away/return directions, a double-entry ledger and change history</title><link>https://notes.vinhnq.com/en/posts/dat-ve-may-bay-booking-ledger-lich-su/</link><guid isPermaLink="true">https://notes.vinhnq.com/en/posts/dat-ve-may-bay-booking-ledger-lich-su/</guid><description>Airline case study, part 3: splitting a booking into directions and money lines, storing money properly, tickets and passengers, a double-entry ledger with a balance constraint in PostgreSQL, optimistic locking with a version column and a booking_history table, and other ways to keep history.</description><pubDate>Wed, 18 Nov 2026 00:00:00 GMT</pubDate></item><item><title>Airline booking: holding seats correctly when many people book at once</title><link>https://notes.vinhnq.com/en/posts/dat-ve-may-bay-giu-ghe-dong-thoi/</link><guid isPermaLink="true">https://notes.vinhnq.com/en/posts/dat-ve-may-bay-giu-ghe-dong-thoi/</guid><description>Airline case study, part 2: why check-then-act oversells, conditional updates for a counter and the throughput ceiling of a hot row, SKIP LOCKED for auto-assignment and its false sold-out trap, deadlocks when customers pick seats and how to lock in a fixed order, hold expiry, Spring Boot 3 code and MySQL 8 differences.</description><pubDate>Wed, 18 Nov 2026 00:00:00 GMT</pubDate></item><item><title>Data modeling case studies: translations, ordering, availability calendars, recurring events, tags and counters</title><link>https://notes.vinhnq.com/en/posts/data-modeling-case-study-da-ngon-ngu-sap-xep-lich/</link><guid isPermaLink="true">https://notes.vinhnq.com/en/posts/data-modeling-case-study-da-ngon-ngu-sap-xep-lich/</guid><description>Six common data modeling problems, each with constraints, options, a chosen design and its failure modes, backed by SQL run on PostgreSQL 16 and MySQL 8.4: translations, drag-and-drop ordering, homestay availability, recurring events across DST, tags and click counts.</description><pubDate>Wed, 18 Nov 2026 00:00:00 GMT</pubDate></item><item><title>Dates and times in the backend: epoch, UTC, time zones, ISO 8601 and java.time</title><link>https://notes.vinhnq.com/en/posts/datetime-timezone-cho-backend/</link><guid isPermaLink="true">https://notes.vinhnq.com/en/posts/datetime-timezone-cho-backend/</guid><description>How computers store time (epoch seconds vs milliseconds, Y2038), how UTC differs from GMT, ISO 8601 / RFC 3339 / RFC 1123, why you need IANA zone ids rather than fixed offsets (DST), choosing the right java.time type, the JVM time zone, and a case study of a booking service getting &apos;today&apos; and the number of nights wrong.</description><pubDate>Wed, 18 Nov 2026 00:00:00 GMT</pubDate></item><item><title>DDD and package structure: bounded contexts, aggregates and a flight-booking codebase skeleton</title><link>https://notes.vinhnq.com/en/posts/ddd-va-cau-truc-package/</link><guid isPermaLink="true">https://notes.vinhnq.com/en/posts/ddd-va-cau-truc-package/</guid><description>Splitting a codebase by business capability instead of by technical concern: package-by-layer versus package-by-feature, bounded contexts and the ubiquitous language, entities, value objects, aggregates, domain services, repositories, the DDD layers, and then a flight-booking codebase skeleton built with clean architecture + DDD, with its boundaries checked by ArchUnit.</description><pubDate>Wed, 18 Nov 2026 00:00:00 GMT</pubDate></item><item><title>Design patterns through refactoring: Strategy</title><link>https://notes.vinhnq.com/en/posts/design-pattern-qua-refactor/</link><guid isPermaLink="true">https://notes.vinhnq.com/en/posts/design-pattern-qua-refactor/</guid><description>Learn Strategy by refactoring a data-sync class full of if/else: the starting smell, extracting the interface step by step, strategies as lambdas and functional interfaces, picking a strategy in Spring with a registry, and the traps around state, thread safety and rounding money.</description><pubDate>Wed, 18 Nov 2026 00:00:00 GMT</pubDate></item><item><title>Distributed tracing with OpenTelemetry: traces, spans, traceparent and sampling</title><link>https://notes.vinhnq.com/en/posts/distributed-tracing-opentelemetry/</link><guid isPermaLink="true">https://notes.vinhnq.com/en/posts/distributed-tracing-opentelemetry/</guid><description>How to debug a request that crosses a gateway, booking, payment and Kafka: traces and spans, the W3C traceparent header (with the format corrected), the Java agent, OTLP and the Collector, SigNoz/ClickHouse-style storage, head vs tail sampling with a Collector config that was actually run, and linking logs to traces.</description><pubDate>Wed, 18 Nov 2026 00:00:00 GMT</pubDate></item><item><title>Distributed transactions: 2PC, TCC, saga, pivot transactions and the transactional outbox</title><link>https://notes.vinhnq.com/en/posts/distributed-transaction-saga-2pc-outbox/</link><guid isPermaLink="true">https://notes.vinhnq.com/en/posts/distributed-transaction-saga-2pc-outbox/</guid><description>Why cross-service transactions never give true strong consistency, the consistency ladder from 2PC, AT, TCC and 2-phase messages down to saga, orchestration vs choreography, pivot transactions, countermeasures for a saga&apos;s missing isolation, and two myths: distributed transactions raise TPS, and the outbox solves distributed transactions.</description><pubDate>Wed, 18 Nov 2026 00:00:00 GMT</pubDate></item><item><title>Docker for Spring Boot: images, multi-stage Dockerfiles, the JVM in a container and Compose</title><link>https://notes.vinhnq.com/en/posts/docker-cho-spring-boot/</link><guid isPermaLink="true">https://notes.vinhnq.com/en/posts/docker-cho-spring-boot/</guid><description>What a container is (namespaces, cgroups), layers and the build cache, a multi-stage Dockerfile with layered jars or buildpacks, choosing a JRE, distroless or Alpine base image, JVM memory, non-root users, PID 1 and graceful shutdown, healthchecks, Docker Compose for local development and image vulnerability scanning.</description><pubDate>Wed, 18 Nov 2026 00:00:00 GMT</pubDate></item><item><title>DTOs, responses and validation for a Spring Boot REST API</title><link>https://notes.vinhnq.com/en/posts/dto-response-va-validation-rest-spring/</link><guid isPermaLink="true">https://notes.vinhnq.com/en/posts/dto-response-va-validation-rest-spring/</guid><description>ResponseEntity with 201 + Location and 204, envelope or bare body for success responses, record DTOs instead of entities, mapping entities to DTOs, PUT versus PATCH, relations sent as ids, custom constraints, normalizing before the uniqueness check, Swagger and pagination, with code run on Spring Boot 4.</description><pubDate>Wed, 18 Nov 2026 00:00:00 GMT</pubDate></item><item><title>Elasticsearch: analyzers, the inverted index, doc values and a mapping for homestay search</title><link>https://notes.vinhnq.com/en/posts/elasticsearch-indexing-co-ban/</link><guid isPermaLink="true">https://notes.vinhnq.com/en/posts/elasticsearch-indexing-co-ban/</guid><description>How Elasticsearch stores a document (analyzers, inverted index, _source, doc values, BKD trees), and a homestay search mapping tested on Elasticsearch 8.15: Vietnamese diacritic folding, object vs nested, a misused range field, shard sizing and syncing from PostgreSQL.</description><pubDate>Wed, 18 Nov 2026 00:00:00 GMT</pubDate></item><item><title>A PostgreSQL index lab on an airline dataset: B-tree, hash, LIKE, composite and covering indexes</title><link>https://notes.vinhnq.com/en/posts/explain-analyze-postgres-thuc-hanh/</link><guid isPermaLink="true">https://notes.vinhnq.com/en/posts/explain-analyze-postgres-thuc-hanh/</guid><description>Step-by-step EXPLAIN ANALYZE on 2 million bookings: with and without an index, B-tree vs hash, LIKE with collations and pg_trgm, when the planner skips an index, composite column order, ORDER BY, and covering indexes with INCLUDE.</description><pubDate>Wed, 18 Nov 2026 00:00:00 GMT</pubDate></item><item><title>Form binding and validation in Spring MVC</title><link>https://notes.vinhnq.com/en/posts/form-binding-va-validation-spring-mvc/</link><guid isPermaLink="true">https://notes.vinhnq.com/en/posts/form-binding-va-validation-spring-mvc/</guid><description>How form data becomes an object, why you shouldn&apos;t bind the entity directly, Bean Validation with BindingResult, showing errors in Thymeleaf, field-level and class-level custom validators, and a user CRUD lab with PRG, flash attributes and delete over POST.</description><pubDate>Wed, 18 Nov 2026 00:00:00 GMT</pubDate></item><item><title>Problem solving like a senior: definitions, causal diagrams, 5 Whys and a checklist</title><link>https://notes.vinhnq.com/en/posts/giai-quyet-van-de-va-trade-off/</link><guid isPermaLink="true">https://notes.vinhnq.com/en/posts/giai-quyet-van-de-va-trade-off/</guid><description>A problem is the gap between a stakeholder&apos;s perceived and expected reality; the elevator case study with a causal diagram, a seven-step process, a critical-thinking checklist, 5 Whys, Seven-So-What, 80/20, and an order, duplication, relationship, direction, consistency checklist for distributed systems.</description><pubDate>Wed, 18 Nov 2026 00:00:00 GMT</pubDate></item><item><title>Communication in system design, part 1: a message&apos;s journey, Protobuf, REST or gRPC</title><link>https://notes.vinhnq.com/en/posts/giao-tiep-dong-bo-rest-grpc-http2/</link><guid isPermaLink="true">https://notes.vinhnq.com/en/posts/giao-tiep-dong-bo-rest-grpc-http2/</guid><description>Five things to weigh when components talk, a message&apos;s path through serialization, protocol, handling pattern and network I/O, the Reactor pattern (not the Actor model), HTTP/2, JSON vs Protobuf and its compatibility rules, REST vs gRPC between backends, and the gRPC load-balancing trap on Kubernetes.</description><pubDate>Wed, 18 Nov 2026 00:00:00 GMT</pubDate></item><item><title>Communication in system design, part 2: Kafka or RabbitMQ, real-time push and a fraud detection case study</title><link>https://notes.vinhnq.com/en/posts/giao-tiep-realtime-va-message-broker/</link><guid isPermaLink="true">https://notes.vinhnq.com/en/posts/giao-tiep-realtime-va-message-broker/</guid><description>Choosing Kafka or RabbitMQ for asynchronous communication (fixing what the slides leave out), four ways for a server to push data to clients (polling, long polling, SSE, WebSocket), MQTT for millions of devices and order books, QUIC stated correctly, and a full case study: designing a payment fraud detection system in 45 minutes.</description><pubDate>Wed, 18 Nov 2026 00:00:00 GMT</pubDate></item><item><title>Cart and checkout with Spring: the model, the transaction and never overselling</title><link>https://notes.vinhnq.com/en/posts/gio-hang-va-dat-hang-spring/</link><guid isPermaLink="true">https://notes.vinhnq.com/en/posts/gio-hang-va-dat-hang-spring/</guid><description>Designing Cart, CartItem, Order and OrderLine; merging lines when the same product is added twice; money as BigDecimal; placing an order in one transaction with a requestId against double clicks, an atomic stock decrement and a rollback when stock runs out; order status and order history without N+1. With a Spring Boot 3 lab verified by tests.</description><pubDate>Wed, 18 Nov 2026 00:00:00 GMT</pubDate></item><item><title>Operating systems for backend engineers: kernel, system calls, processes and threads</title><link>https://notes.vinhnq.com/en/posts/he-dieu-hanh-kernel-process-thread/</link><guid isPermaLink="true">https://notes.vinhnq.com/en/posts/he-dieu-hanh-kernel-process-thread/</guid><description>The kernel and system calls, user mode and kernel mode, processes, threads and the PCB, context switches, the Linux scheduler, and how they show up in the JVM and in containers: 1:1 threads, virtual threads, CPU quotas, PID 1 and SIGTERM.</description><pubDate>Wed, 18 Nov 2026 00:00:00 GMT</pubDate></item><item><title>A liveness system: from a Redis sorted set to a timing wheel and the LMAX Disruptor</title><link>https://notes.vinhnq.com/en/posts/he-thong-liveness-timing-wheel-va-disruptor/</link><guid isPermaLink="true">https://notes.vinhnq.com/en/posts/he-thong-liveness-timing-wheel-va-disruptor/</guid><description>Case study of 1 million IoT devices sending a heartbeat every 3 seconds: picking the timer data structure (Redis ZSET or timing wheel), handling a huge bucket with several threads, and why the queue between threads becomes the bottleneck that the Disruptor solves.</description><pubDate>Wed, 18 Nov 2026 00:00:00 GMT</pubDate></item><item><title>Idempotency part 2: Kafka consumers, the idempotent producer and payment-gateway IPNs</title><link>https://notes.vinhnq.com/en/posts/idempotency-kafka-va-ipn-thanh-toan/</link><guid isPermaLink="true">https://notes.vinhnq.com/en/posts/idempotency-kafka-va-ipn-thanh-toan/</guid><description>Idempotency in messaging and payments: deduplicating Kafka consumers with a processed_message table, the idempotent producer (PID, sequence numbers, max.in.flight ≤ 5) and its limits, a state-machine IPN handler for a VNPay-style gateway, reconciliation, and a summary of what to store and for how long at each layer.</description><pubDate>Wed, 18 Nov 2026 00:00:00 GMT</pubDate></item><item><title>Idempotency part 1: at-least-once, unique constraints and an Idempotency-Key on PostgreSQL</title><link>https://notes.vinhnq.com/en/posts/idempotency-trong-he-thong-phan-tan/</link><guid isPermaLink="true">https://notes.vinhnq.com/en/posts/idempotency-trong-he-thong-phan-tan/</guid><description>Why every distributed system is at-least-once, three ways to make an operation idempotent, an Idempotency-Key implementation tested with 20 concurrent requests on PostgreSQL, a case study of duplicate bookings caused by a non-unique request_id, and why a distributed lock is no substitute for idempotency.</description><pubDate>Wed, 18 Nov 2026 00:00:00 GMT</pubDate></item><item><title>Inside an index: B-trees, B+trees, clustered tables, heaps and choosing a primary key</title><link>https://notes.vinhnq.com/en/posts/index-ben-trong-b-tree-clustered-heap/</link><guid isPermaLink="true">https://notes.vinhnq.com/en/posts/index-ben-trong-b-tree-clustered-heap/</guid><description>Why databases use B+trees, how an InnoDB clustered index differs from a PostgreSQL heap, how unique indexes treat NULL, composite indexes with range predicates, bigint vs UUIDv4 vs UUIDv7 as a primary key, and maintaining indexes once they bloat.</description><pubDate>Wed, 18 Nov 2026 00:00:00 GMT</pubDate></item><item><title>Locks in InnoDB: from the global lock to gap locks, read through data_locks</title><link>https://notes.vinhnq.com/en/posts/innodb-lock-va-data-locks/</link><guid isPermaLink="true">https://notes.vinhnq.com/en/posts/innodb-lock-va-data-locks/</guid><description>A money transfer that drives a balance negative, MySQL&apos;s lock types from global down to row level (intention, AUTO-INC, record, gap, next-key, insert intention), and performance_schema.data_locks for each kind of statement at REPEATABLE READ and READ COMMITTED, measured on MySQL 8.4.</description><pubDate>Wed, 18 Nov 2026 00:00:00 GMT</pubDate></item><item><title>I/O models: blocking, non-blocking, epoll and file descriptors</title><link>https://notes.vinhnq.com/en/posts/io-model-epoll-va-file-descriptor/</link><guid isPermaLink="true">https://notes.vinhnq.com/en/posts/io-model-epoll-va-file-descriptor/</guid><description>How I/O works from the system call down to DMA and interrupts, the four bottleneck groups and how to measure them, the five Unix I/O models, select/poll/epoll, Java NIO, Tomcat, Netty, virtual threads, sequential vs random disk I/O, fsync, and Too many open files.</description><pubDate>Wed, 18 Nov 2026 00:00:00 GMT</pubDate></item><item><title>How joins run (nested loop, hash join, merge join) and when to partition a table</title><link>https://notes.vinhnq.com/en/posts/join-algorithm-va-partition/</link><guid isPermaLink="true">https://notes.vinhnq.com/en/posts/join-algorithm-va-partition/</guid><description>The three join algorithms and when the database picks each one, hash joins spilling to disk, the LEFT JOIN plus WHERE trap, join decomposition, partitioning vs sharding, MySQL partitioning limits, and the escalation ladder for a table that has grown too big.</description><pubDate>Wed, 18 Nov 2026 00:00:00 GMT</pubDate></item><item><title>Evolving a schema: JSON columns, online DDL, data types and views</title><link>https://notes.vinhnq.com/en/posts/json-ddl-online-kieu-du-lieu-va-view/</link><guid isPermaLink="true">https://notes.vinhnq.com/en/posts/json-ddl-online-kieu-du-lieu-va-view/</guid><description>Why pre-created spare columns c1..c6 are obsolete, adding columns and indexes without downtime on MySQL 8.4 and PostgreSQL 16, indexing JSON fields, choosing types for strings, numbers, money and time, and MERGE, TEMPTABLE and materialized views with their performance and security traps, all with real measurements.</description><pubDate>Wed, 18 Nov 2026 00:00:00 GMT</pubDate></item><item><title>Inside Kafka consumer groups: rebalancing, assignors, static membership and liveness</title><link>https://notes.vinhnq.com/en/posts/kafka-consumer-group-rebalance-va-liveness/</link><guid isPermaLink="true">https://notes.vinhnq.com/en/posts/kafka-consumer-group-rebalance-va-liveness/</guid><description>Group coordinator and group leader, the JoinGroup/SyncGroup protocol, four assignment strategies measured on Kafka 4.3 (range, round-robin, cooperative-sticky, KIP-848), static membership for rolling deploys, heartbeats versus max.poll.interval.ms, the endless reprocessing loop, and poison pills at the client level.</description><pubDate>Wed, 18 Nov 2026 00:00:00 GMT</pubDate></item><item><title>Kafka in practice (2): dual writes, exactly-once and message ordering</title><link>https://notes.vinhnq.com/en/posts/kafka-dual-write-exactly-once-va-thu-tu/</link><guid isPermaLink="true">https://notes.vinhnq.com/en/posts/kafka-dual-write-exactly-once-va-thu-tu/</guid><description>Three correctness problems with Kafka: the dual write between a database and Kafka (why emitting first or wrapping in a DB transaction both fail, the transactional outbox with Debezium), exactly-once for Kafka-to-Kafka flows and for flows that write to a database, and keeping message order from producer to consumer.</description><pubDate>Wed, 18 Nov 2026 00:00:00 GMT</pubDate></item><item><title>Inside the Kafka producer: send(), batching, the partitioner and transactions</title><link>https://notes.vinhnq.com/en/posts/kafka-producer-ben-trong/</link><guid isPermaLink="true">https://notes.vinhnq.com/en/posts/kafka-producer-ben-trong/</guid><description>How a record travels from send() to the broker (RecordAccumulator, sender thread, buffer.memory, max.block.ms), measured effects of linger.ms and compression on Kafka 4.3, the uniform sticky partitioner, retrying the right way, and transactions from the inside: coordinator, control markers, LSO, fencing.</description><pubDate>Wed, 18 Nov 2026 00:00:00 GMT</pubDate></item><item><title>Case study: a synchronous fraud check over Kafka and Redis — good idea or not?</title><link>https://notes.vinhnq.com/en/posts/kafka-request-reply-case-study/</link><guid isPermaLink="true">https://notes.vinhnq.com/en/posts/kafka-request-reply-case-study/</guid><description>Reviewing a wallet service that waits for a fraud verdict over Kafka and uses Redis to match replies to requests: the message envelope, events vs commands, eight design problems, the alternatives (ReplyingKafkaTemplate, per-instance reply partitions, HTTP with a timeout, an asynchronous UX) and the transactional outbox.</description><pubDate>Wed, 18 Nov 2026 00:00:00 GMT</pubDate></item><item><title>Kafka serialization and Schema Registry: choosing a format, the wire format and compatibility modes</title><link>https://notes.vinhnq.com/en/posts/kafka-serialization-va-schema-registry/</link><guid isPermaLink="true">https://notes.vinhnq.com/en/posts/kafka-serialization-va-schema-registry/</guid><description>Serializers and deserializers in Kafka, the bytes → String → object mistake, JSON vs Avro vs Protobuf (85 bytes vs 29 bytes measured), how Schema Registry works (magic byte, schema id, subject), a compatibility-mode table checked with code, upgrade order, and the traps of Spring Kafka&apos;s JsonSerializer.</description><pubDate>Wed, 18 Nov 2026 00:00:00 GMT</pubDate></item><item><title>Kafka in practice (1): partition count, large messages, lag and long-running tasks</title><link>https://notes.vinhnq.com/en/posts/kafka-so-partition-lag-va-tac-vu-dai/</link><guid isPermaLink="true">https://notes.vinhnq.com/en/posts/kafka-so-partition-lag-va-tac-vu-dai/</guid><description>Common Kafka operating problems and the patterns that solve them: sizing partitions from write and read throughput, shrinking a topic, large messages with a claim check, measuring and fixing consumer lag, long-running tasks (async, liveness tuning, pipelines), poison pills with retry topics and a DLT, and hot partitions.</description><pubDate>Wed, 18 Nov 2026 00:00:00 GMT</pubDate></item><item><title>Why Kafka is fast and durable: the log, zero-copy, batching and replication</title><link>https://notes.vinhnq.com/en/posts/kafka-vi-sao-nhanh-va-ben/</link><guid isPermaLink="true">https://notes.vinhnq.com/en/posts/kafka-vi-sao-nhanh-va-ben/</guid><description>Kafka isn&apos;t &apos;fast&apos; in the low-latency sense; it&apos;s built for throughput: an append-only log with sequential I/O, zero-copy, writes to the page cache without fsync, cheap consumers thanks to offsets, client-side batching and compression, partitions and consumer groups. Then durability: replication, ISR, the high watermark, acks, min.insync.replicas and unclean leader election.</description><pubDate>Wed, 18 Nov 2026 00:00:00 GMT</pubDate></item><item><title>Discover the domain before you design: Event Storming, Domain Storytelling and pivotal events</title><link>https://notes.vinhnq.com/en/posts/kham-pha-domain-event-storming-domain-storytelling/</link><guid isPermaLink="true">https://notes.vinhnq.com/en/posts/kham-pha-domain-event-storming-domain-storytelling/</guid><description>How an architect learns a new business: the first meeting with Why/What/How questions, running workshops, Event Storming at Big Picture and Process level (events, commands, policies, read models, pivotal events), Domain Storytelling, and turning a wall of sticky notes into module boundaries and backend code.</description><pubDate>Wed, 18 Nov 2026 00:00:00 GMT</pubDate></item><item><title>Codebase architecture: layered, hexagonal, onion, clean and functional core</title><link>https://notes.vinhnq.com/en/posts/kien-truc-layered-hexagonal-clean/</link><guid isPermaLink="true">https://notes.vinhnq.com/en/posts/kien-truc-layered-hexagonal-clean/</guid><description>Five ways to organise backend code and the single idea behind them: dependency direction. Closed and open layers, ports and adapters, the domain at the centre, the dependency rule, DTOs at the boundary, repository interfaces on the inside, a pure core with I/O at the edges. Plus how to choose by project size and how to enforce it automatically with ArchUnit.</description><pubDate>Wed, 18 Nov 2026 00:00:00 GMT</pubDate></item><item><title>Pragmatic software architecture: architectural drivers, the architect&apos;s role and context-driven decisions</title><link>https://notes.vinhnq.com/en/posts/kien-truc-phan-mem-thuc-dung-architectural-driver/</link><guid isPermaLink="true">https://notes.vinhnq.com/en/posts/kien-truc-phan-mem-thuc-dung-architectural-driver/</guid><description>The four groups of architectural drivers (functional requirements, business constraints, technical constraints, quality attributes), why they pull on each other, how to stay pragmatic without closing doors, the modern architect&apos;s role, and a clinic SaaS case worked end to end.</description><pubDate>Wed, 18 Nov 2026 00:00:00 GMT</pubDate></item><item><title>Working with AI coding agents as a backend engineer: workflow, project rules and verification</title><link>https://notes.vinhnq.com/en/posts/lam-viec-voi-ai-coding-agent-cho-backend/</link><guid isPermaLink="true">https://notes.vinhnq.com/en/posts/lam-viec-voi-ai-coding-agent-cho-backend/</guid><description>Where AI is strong and weak, vibe coding versus a fundamentals-driven workflow, when not to use AI, project rules files per tool, writing prompts for backend work, tests as the oracle, security-sensitive code, privacy, and how to measure whether AI actually helps.</description><pubDate>Wed, 18 Nov 2026 00:00:00 GMT</pubDate></item><item><title>Linux for backend engineers: inodes, links, permissions and shell scripts</title><link>https://notes.vinhnq.com/en/posts/linux-file-system-va-shell/</link><guid isPermaLink="true">https://notes.vinhnq.com/en/posts/linux-file-system-va-shell/</guid><description>What a backend engineer needs from the Linux file system: everything is a file, inodes and directory entries, hard and soft links, deleted files that still fill the disk, log rotation, rwx permissions, umask, the sticky bit, non-root containers, everyday commands and safe shell scripting, with three exercises solved and run.</description><pubDate>Wed, 18 Nov 2026 00:00:00 GMT</pubDate></item><item><title>Common Spring Boot errors and how to debug them: from port conflicts to a 403 that became a 500</title><link>https://notes.vinhnq.com/en/posts/loi-thuong-gap-spring-boot-va-cach-debug/</link><guid isPermaLink="true">https://notes.vinhnq.com/en/posts/loi-thuong-gap-spring-boot-va-cach-debug/</guid><description>A symptom-first troubleshooting guide: port in use, ClassNotFound and dependency conflicts, reading the APPLICATION FAILED TO START block, LazyInitializationException, 401 vs 403 in a JWT API, @PreAuthorize turned into 500, CORS, JSON recursion, IDENTITY saves failing early, data.sql running before tables exist, and using the debugger.</description><pubDate>Wed, 18 Nov 2026 00:00:00 GMT</pubDate></item><item><title>Storing passwords and encrypting personal data: salts, Argon2id, AES-GCM and blind indexes</title><link>https://notes.vinhnq.com/en/posts/luu-mat-khau-va-ma-hoa-du-lieu-ca-nhan/</link><guid isPermaLink="true">https://notes.vinhnq.com/en/posts/luu-mat-khau-va-ma-hoa-du-lieu-ca-nhan/</guid><description>Two data-protection case studies for backends: storing passwords (rainbow tables, salt, pepper, Argon2id/bcrypt, upgrading legacy hashes) and encrypting personal data (where to encrypt, AES-GCM with nonces and AAD, envelope encryption, binary versus Base64, searching with a blind index).</description><pubDate>Wed, 18 Nov 2026 00:00:00 GMT</pubDate></item><item><title>Storing dates and times in PostgreSQL, MySQL and JSON: timestamptz, DATETIME, Jackson and the traps</title><link>https://notes.vinhnq.com/en/posts/luu-ngay-gio-trong-database-va-json/</link><guid isPermaLink="true">https://notes.vinhnq.com/en/posts/luu-ngay-gio-trong-database-va-json/</guid><description>Timestamps vs datetimes, PostgreSQL timestamptz vs timestamp, MySQL TIMESTAMP vs DATETIME (the 2038 limit, session conversion), rounded fractional seconds, why future appointments need a zone id, JDBC/Hibernate/Connector/J, and JSON traps: Jackson, ISO 8601, epoch numbers and JavaScript Date.</description><pubDate>Wed, 18 Nov 2026 00:00:00 GMT</pubDate></item><item><title>CCDAK practice part 2: 34 self-made questions on clients, Connect, Schema Registry and Streams</title><link>https://notes.vinhnq.com/en/posts/luyen-tap-ccdak-phan-2/</link><guid isPermaLink="true">https://notes.vinhnq.com/en/posts/luyen-tap-ccdak-phan-2/</guid><description>A set of multiple-choice questions I wrote to practise for CCDAK, complementing the 40-question post: CLI and security, producers, consumers and assignors, Avro and Schema Registry, REST Proxy, Kafka Connect, Kafka Streams and ksqlDB. Each question has a folded answer with an explanation, plus a table of wrong or outdated answers in the circulating question set.</description><pubDate>Wed, 18 Nov 2026 00:00:00 GMT</pubDate></item><item><title>Encoding, hashing, encryption and signatures: picking the right crypto tool as a backend engineer</title><link>https://notes.vinhnq.com/en/posts/ma-hoa-hash-va-chu-ky-so/</link><guid isPermaLink="true">https://notes.vinhnq.com/en/posts/ma-hoa-hash-va-chu-ky-so/</guid><description>Encoding, hashing, encryption, MACs and digital signatures: which question each one answers, HMAC versus signatures for APIs, symmetric versus asymmetric, what TLS does and doesn&apos;t protect, and secret management at the level a backend engineer needs.</description><pubDate>Wed, 18 Nov 2026 00:00:00 GMT</pubDate></item><item><title>Networking for backend engineers: DNS, TCP, TLS and debugging connections</title><link>https://notes.vinhnq.com/en/posts/mang-may-tinh-cho-backend-tcp-dns-tls/</link><guid isPermaLink="true">https://notes.vinhnq.com/en/posts/mang-may-tinh-cho-backend-tcp-dns-tls/</guid><description>What happens when you call an API (DNS and the JVM&apos;s DNS cache, the TCP handshake, TLS 1.3, keep-alive), the TCP details that bite (ephemeral ports, TIME_WAIT, Nagle, backlog, RST vs FIN), connect vs read timeouts, L4/L7 load balancers, NAT, MTU, mTLS, and a tested toolkit of dig, curl, ss, tcpdump and openssl.</description><pubDate>Wed, 18 Nov 2026 00:00:00 GMT</pubDate></item><item><title>Maven and the layout of a Spring Boot project</title><link>https://notes.vinhnq.com/en/posts/maven-va-cau-truc-du-an-spring-boot/</link><guid isPermaLink="true">https://notes.vinhnq.com/en/posts/maven-va-cau-truc-du-an-spring-boot/</guid><description>The POM and GAV coordinates, the lifecycle with phases and goals, scopes and transitive dependencies read with dependency:tree, the starter parent and BOM managing versions, the Maven wrapper, the ~/.m2 cache and mirrors, the folder layout, the fat jar and DevTools, with real output from Spring Boot 3.5.</description><pubDate>Wed, 18 Nov 2026 00:00:00 GMT</pubDate></item><item><title>Message brokers: four problems with request-response and how to choose a broker</title><link>https://notes.vinhnq.com/en/posts/message-broker-va-cach-chon/</link><guid isPermaLink="true">https://notes.vinhnq.com/en/posts/message-broker-va-cach-chon/</guid><description>Why you need a message broker: four problems synchronous calls can&apos;t solve (sending to many services, failing together, adding a consumer, traffic spikes), what it costs you, how an event differs from a response, and how to choose between a database-as-queue, Redis, RabbitMQ, NATS, Pulsar and Kafka.</description><pubDate>Wed, 18 Nov 2026 00:00:00 GMT</pubDate></item><item><title>Microservices: when to split, finding service boundaries, and carving up a monolith step by step</title><link>https://notes.vinhnq.com/en/posts/microservices-ranh-gioi-service/</link><guid isPermaLink="true">https://notes.vinhnq.com/en/posts/microservices-ranh-gioi-service/</guid><description>The pros and cons of microservices, the core components (API gateway, service discovery, load balancer) and the extras, the path from event storming to bounded contexts, six rules for splitting services, running old and new side by side, and data ownership.</description><pubDate>Wed, 18 Nov 2026 00:00:00 GMT</pubDate></item><item><title>Design principles: CAP, PACELC, scalability, performance and availability</title><link>https://notes.vinhnq.com/en/posts/nguyen-tac-scalability-performance-availability/</link><guid isPermaLink="true">https://notes.vinhnq.com/en/posts/nguyen-tac-scalability-performance-availability/</guid><description>The foundational principles of system design and the common trade-offs, CAP stated correctly (P is not optional) and PACELC, four scalability levers, performance tuning by p99 and by CPU- vs I/O-bound load, availability through MTBF/MTTR, failover, degradation, SLOs and error budgets, with an exercise computing the availability of a service chain.</description><pubDate>Wed, 18 Nov 2026 00:00:00 GMT</pubDate></item><item><title>Observer: from a listener list to Spring events and an outbox</title><link>https://notes.vinhnq.com/en/posts/observer-pattern-va-spring-event/</link><guid isPermaLink="true">https://notes.vinhnq.com/en/posts/observer-pattern-va-spring-event/</guid><description>Refactor a network manager that calls its subscriber directly into Observer, reproduce four ways a publisher breaks (self-unsubscribing listeners, exceptions, leaks, threads), write a sturdier publisher, then move to Spring: @EventListener, @TransactionalEventListener, and when you need a message broker with an outbox.</description><pubDate>Wed, 18 Nov 2026 00:00:00 GMT</pubDate></item><item><title>CCDAK review: 40 Kafka questions worth remembering</title><link>https://notes.vinhnq.com/en/posts/on-thi-ccdak/</link><guid isPermaLink="true">https://notes.vinhnq.com/en/posts/on-thi-ccdak/</guid><description>Forty self-written questions following the knowledge domains of the Confluent Certified Developer for Apache Kafka exam (cluster and KRaft, producers, consumers, topics, Streams, Schema Registry, Connect), with short answers, common traps and a table translating ZooKeeper-era answers to KRaft.</description><pubDate>Wed, 18 Nov 2026 00:00:00 GMT</pubDate></item><item><title>Optimistic or pessimistic locking: measured on a 100-seat booking</title><link>https://notes.vinhnq.com/en/posts/optimistic-va-pessimistic-locking/</link><guid isPermaLink="true">https://notes.vinhnq.com/en/posts/optimistic-va-pessimistic-locking/</guid><description>Pessimistic locking, optimistic locking (version), conditional updates and a Redis lock with a fencing token, measured on a 100-seat flight with 400 concurrent requests on MySQL 8.4: which are correct, which are fast, which turn people away for no reason; plus locking best practices and the four conditions for deadlock.</description><pubDate>Wed, 18 Nov 2026 00:00:00 GMT</pubDate></item><item><title>Performance testing: load, stress, spike, soak and coordinated omission</title><link>https://notes.vinhnq.com/en/posts/performance-test-load-stress-soak/</link><guid isPermaLink="true">https://notes.vinhnq.com/en/posts/performance-test-load-stress-soak/</guid><description>Load, stress, spike, soak and capacity tests told apart; goals derived from SLOs; open versus closed workload models, arrival rate, think time; coordinated omission measured with a JDK 21 experiment (p99 of 2.6 ms becomes 975 ms); throughput, percentiles, USE/RED; k6 and Gatling Java DSL scripts; data, warm-up, finding the bottleneck, reporting results, and when to use JMH.</description><pubDate>Wed, 18 Nov 2026 00:00:00 GMT</pubDate></item><item><title>Authorization, SSO and OAuth2: from RBAC to OpenID Connect</title><link>https://notes.vinhnq.com/en/posts/phan-quyen-rbac-sso-va-oauth2/</link><guid isPermaLink="true">https://notes.vinhnq.com/en/posts/phan-quyen-rbac-sso-va-oauth2/</guid><description>Two authorization case studies (RBAC and roles + permissions) with schemas and Spring Security, object-level checks, ABAC/ReBAC, an SSO case study built on parent-domain cookies and the standard alternative with an IdP + OpenID Connect, how OAuth2 differs from OIDC, and a JDK 21 solution to the JWT + permissions homework.</description><pubDate>Wed, 18 Nov 2026 00:00:00 GMT</pubDate></item><item><title>Analysing trade-offs like a senior: ideality, sweet spots, coupling and separation</title><link>https://notes.vinhnq.com/en/posts/phan-tich-trade-off-nhu-senior/</link><guid isPermaLink="true">https://notes.vinhnq.com/en/posts/phan-tich-trade-off-nhu-senior/</guid><description>Context-dependent dimensions, dimensional vs alternative trade-offs, the TRIZ ideality formula for scoring options, picking a sweet spot vs resolving the trade-off, boring technology, coupling as the root of trade-offs and the separation principles (sidecar, functional core/imperative shell, CQRS), plus a framework for system design interviews.</description><pubDate>Wed, 18 Nov 2026 00:00:00 GMT</pubDate></item><item><title>Pagination and dynamic filters in Spring: Pageable, Page, Slice and JPA Specifications</title><link>https://notes.vinhnq.com/en/posts/phan-trang-va-loc-dong-jpa-specification/</link><guid isPermaLink="true">https://notes.vinhnq.com/en/posts/phan-trang-va-loc-dong-jpa-specification/</guid><description>Paginating with Pageable and @PageableDefault, Page versus Slice, zero- or one-based pages, capping size and rejecting unknown sort fields; filtering products by brand, purpose and price range with Specifications and the JPA metamodel; grouping OR correctly, keeping filters in the URL, and the LIKE, count-query and fetch-join traps. With a Spring Boot 3 lab verified by tests.</description><pubDate>Wed, 18 Nov 2026 00:00:00 GMT</pubDate></item><item><title>Case study: fraud detection with Kafka and Redis — topics, keys, windows and failures</title><link>https://notes.vinhnq.com/en/posts/phat-hien-gian-lan-voi-kafka-redis/</link><guid isPermaLink="true">https://notes.vinhnq.com/en/posts/phat-hien-gian-lan-voi-kafka-redis/</guid><description>The Kafka angle of fraud detection for an e-wallet (the 100-transactions-in-5-minutes rule): topics and keys, partition count, event-time sliding windows in Redis, idempotent counting when Kafka redelivers, preventing alert storms, rebuilding state by replay, scaling the detector, and a comparison with Kafka Streams state stores.</description><pubDate>Wed, 18 Nov 2026 00:00:00 GMT</pubDate></item><item><title>The system design interview: a four-step process and clarifying requirements</title><link>https://notes.vinhnq.com/en/posts/phong-van-system-design-quy-trinh-va-yeu-cau/</link><guid isPermaLink="true">https://notes.vinhnq.com/en/posts/phong-van-system-design-quy-trinh-va-yeu-cau/</guid><description>What system design is and how it differs from architecture, what interviewers grade, four steps in 45 minutes, picking at most three functional requirements, turning non-functional requirements into numbers, and proving a design is good before writing code. With solutions for Tinder, DoorDash and Binance.</description><pubDate>Wed, 18 Nov 2026 00:00:00 GMT</pubDate></item><item><title>The data modeling process: access patterns, table types, foreign keys and table templates</title><link>https://notes.vinhnq.com/en/posts/quy-trinh-data-modeling-va-table-template/</link><guid isPermaLink="true">https://notes.vinhnq.com/en/posts/quy-trinh-data-modeling-va-table-template/</guid><description>Design a schema from its queries, not from boxes on a diagram: four kinds of tables, when to denormalize, whether to keep foreign keys (with parent-row locking measured on PostgreSQL 16 and MySQL 8.4), where the reference column goes, and a table template with technical columns.</description><pubDate>Wed, 18 Nov 2026 00:00:00 GMT</pubDate></item><item><title>Rate limiting: five algorithms, a token bucket on Redis, and designing a distributed limiter</title><link>https://notes.vinhnq.com/en/posts/rate-limiting-thuat-toan-va-redis/</link><guid isPermaLink="true">https://notes.vinhnq.com/en/posts/rate-limiting-thuat-toan-va-redis/</guid><description>Fixed window, sliding log, sliding window counter, leaky bucket and token bucket compared on one example; why token bucket is the usual pick; a token bucket in Redis Lua, fetching tokens in batches, and what to decide when Redis is slow or down.</description><pubDate>Wed, 18 Nov 2026 00:00:00 GMT</pubDate></item><item><title>Redis internals: why it is fast, how it stores data and how it removes expired keys</title><link>https://notes.vinhnq.com/en/posts/redis-ben-trong-vi-sao-nhanh/</link><guid isPermaLink="true">https://notes.vinhnq.com/en/posts/redis-ben-trong-vi-sao-nhanh/</guid><description>Redis runs commands on one thread and still handles hundreds of thousands of them per second: the event loop and I/O multiplexing, io-threads since version 6, a keyspace that is a hash table, compact encodings (listpack, intset, skiplist), SDS, and the two ways expired keys get removed. Plus a comparison with Memcached and the places where the slides get it wrong.</description><pubDate>Wed, 18 Nov 2026 00:00:00 GMT</pubDate></item><item><title>Redis: choosing data structures for real problems</title><link>https://notes.vinhnq.com/en/posts/redis-cau-truc-du-lieu-thuc-te/</link><guid isPermaLink="true">https://notes.vinhnq.com/en/posts/redis-cau-truc-du-lieu-thuc-te/</guid><description>A hash or a JSON string for an object, a shopping cart as a hash, a queue as a list or a stream, sets for likes and mutual friends, sorted sets for leaderboards, and a case study of a ZSET delay queue that auto-cancels ride requests: why read-then-delete processed 784 duplicates out of 2,000 rides.</description><pubDate>Wed, 18 Nov 2026 00:00:00 GMT</pubDate></item><item><title>Reviewing a Redis distributed lock: six common bugs</title><link>https://notes.vinhnq.com/en/posts/redis-distributed-lock-review/</link><guid isPermaLink="true">https://notes.vinhnq.com/en/posts/redis-distributed-lock-review/</guid><description>A close read of a sample Redis distributed lock: a constant lock value with a blind DEL, a TTL multiplied by 1000 twice, parallel multi-key acquisition, async unlock, a broken retry loop, and leases that expire during failover. The rewrite, fencing tokens, and when to use the database&apos;s locks instead.</description><pubDate>Wed, 18 Nov 2026 00:00:00 GMT</pubDate></item><item><title>Redis: persistence, replication, Sentinel and Cluster</title><link>https://notes.vinhnq.com/en/posts/redis-persistence-replication-cluster/</link><guid isPermaLink="true">https://notes.vinhnq.com/en/posts/redis-persistence-replication-cluster/</guid><description>How Redis keeps data across restarts with RDB, AOF or both; what asynchronous replication loses on failover; how Sentinel elects a new master; how Cluster splits data into 16,384 hash slots, redirects with MOVED/ASK and restricts multi-key commands. Plus how to choose a deployment mode.</description><pubDate>Wed, 18 Nov 2026 00:00:00 GMT</pubDate></item><item><title>ReDoS in Java: real outages, a home-made timeout and a defence checklist</title><link>https://notes.vinhnq.com/en/posts/redos-trong-java-su-co-va-phong-thu/</link><guid isPermaLink="true">https://notes.vinhnq.com/en/posts/redos-trong-java-su-co-va-phong-thu/</guid><description>Two famous ReDoS outages (Stack Overflow 2016, Cloudflare 2019) and the attack surface of a Java backend; how to defend when java.util.regex has no timeout: unambiguous patterns, input limits (and why @Size isn&apos;t enough), a deadline-aware CharSequence, RE2/J, StackOverflowError from alternation; then each of the slide&apos;s best practices re-examined with JDK 21 measurements.</description><pubDate>Wed, 18 Nov 2026 00:00:00 GMT</pubDate></item><item><title>Rotating refresh tokens and permission-based authorization in Spring Security</title><link>https://notes.vinhnq.com/en/posts/refresh-token-xoay-vong-va-phan-quyen-spring/</link><guid isPermaLink="true">https://notes.vinhnq.com/en/posts/refresh-token-xoay-vong-va-phan-quyen-spring/</guid><description>Hands-on Spring Boot 4: opaque refresh tokens stored as hashes, rotation with reuse detection, HttpOnly cookies, logout, purging expired tokens; then authorization: roles, authorities, permissions, URL rules with a custom AuthorizationManager, @PreAuthorize, and the bugs the lab ran into.</description><pubDate>Wed, 18 Nov 2026 00:00:00 GMT</pubDate></item><item><title>Regex by example: network configs, logs to CSV, lookbehind and duplicate lines</title><link>https://notes.vinhnq.com/en/posts/regex-bai-tap-log-lookbehind-dong-trung/</link><guid isPermaLink="true">https://notes.vinhnq.com/en/posts/regex-bai-tap-log-lookbehind-dong-trung/</guid><description>Four regex exercises with solutions run on JDK 21: parsing a switch config with named and optional groups, turning application logs into CSV with VS Code, Java, sed and awk, extracting only passport numbers with lookbehind, and handling duplicate lines with backreferences before switching to the right tool.</description><pubDate>Wed, 18 Nov 2026 00:00:00 GMT</pubDate></item><item><title>Regex: syntax, the Java API and basic validation exercises</title><link>https://notes.vinhnq.com/en/posts/regex-cu-phap-va-bai-tap/</link><guid isPermaLink="true">https://notes.vinhnq.com/en/posts/regex-cu-phap-va-bai-tap/</guid><description>Regex for Java backends: the core syntax (character classes, quantifiers, anchors, groups, lookaround, flags) with the spots slides often get wrong, Pattern/Matcher, the traps in String.replaceAll/split, why &quot;Java&apos;s regex engine doesn&apos;t work well&quot; is the wrong takeaway, and three validation exercises: image file names, numbers, email.</description><pubDate>Wed, 18 Nov 2026 00:00:00 GMT</pubDate></item><item><title>Inside Java&apos;s regex engine: backtracking, possessive quantifiers and catastrophic backtracking</title><link>https://notes.vinhnq.com/en/posts/regex-engine-backtracking-va-redos/</link><guid isPermaLink="true">https://notes.vinhnq.com/en/posts/regex-engine-backtracking-va-redos/</guid><description>How Java&apos;s regex engine runs (one character at a time, left to right, backtracking), why car|carpet doesn&apos;t match carpet, greedy, lazy, possessive and atomic groups, how backtracking engines differ from linear-time engines like RE2, and real catastrophic-backtracking measurements on JDK 21: which textbook examples are outdated and which patterns still blow up.</description><pubDate>Wed, 18 Nov 2026 00:00:00 GMT</pubDate></item><item><title>Advanced REST API design: async exports, Idempotency-Key and API documentation</title><link>https://notes.vinhnq.com/en/posts/rest-api-async-job-va-idempotency-key/</link><guid isPermaLink="true">https://notes.vinhnq.com/en/posts/rest-api-async-job-va-idempotency-key/</guid><description>Senior-level REST API design, part 2: exporting a 500 MB file with an async job (polling, signed webhooks, presigned URLs), handling duplicate payment requests with an Idempotency-Key, a response envelope with 6-digit error codes, and writing API docs plus an API map.</description><pubDate>Wed, 18 Nov 2026 00:00:00 GMT</pubDate></item><item><title>Reverse proxying with Nginx: path-based routing and X-Forwarded headers</title><link>https://notes.vinhnq.com/en/posts/reverse-proxy-nginx-routing/</link><guid isPermaLink="true">https://notes.vinhnq.com/en/posts/reverse-proxy-nginx-routing/</guid><description>Build an Nginx reverse proxy that routes /, /api and /blog to three services with Docker Compose and test every request: how location picks a block, the trailing-slash rule of proxy_pass, X-Forwarded headers and when to trust them, plus production settings such as timeouts, keepalive, buffering and retries.</description><pubDate>Wed, 18 Nov 2026 00:00:00 GMT</pubDate></item><item><title>Sharding in system design: choosing a shard key, four case studies and resharding</title><link>https://notes.vinhnq.com/en/posts/sharding-chon-shard-key-va-resharding/</link><guid isPermaLink="true">https://notes.vinhnq.com/en/posts/sharding-chon-shard-key-va-resharding/</guid><description>When you really need to shard, range vs hash vs consistent hashing, the three properties of a good shard key, four case studies (orders, payment transactions, device metrics, Discord messages), global IDs, cross-shard queries, and resharding without downtime using logical shards.</description><pubDate>Wed, 18 Nov 2026 00:00:00 GMT</pubDate></item><item><title>Spring Boot from the inside: auto-configuration, configuration, profiles and the startup lifecycle</title><link>https://notes.vinhnq.com/en/posts/spring-boot-auto-configuration-va-vong-doi/</link><guid isPermaLink="true">https://notes.vinhnq.com/en/posts/spring-boot-auto-configuration-va-vong-doi/</guid><description>How auto-configuration is found and switched on, @Conditional and backing off, writing your own auto-config with tests, configuration precedence, @ConfigurationProperties, profiles, the phases of SpringApplication.run, seed data and graceful shutdown on Spring Boot 4.</description><pubDate>Wed, 18 Nov 2026 00:00:00 GMT</pubDate></item><item><title>Spring MVC: DispatcherServlet, controllers and views</title><link>https://notes.vinhnq.com/en/posts/spring-mvc-dispatcherservlet-va-view/</link><guid isPermaLink="true">https://notes.vinhnq.com/en/posts/spring-mvc-dispatcherservlet-va-view/</guid><description>How a request travels through DispatcherServlet (HandlerMapping, HandlerAdapter, argument resolvers, ViewResolver), @Controller versus @RestController, the Model and view names, redirect, forward and PRG, Thymeleaf versus JSP, static files, why @EnableWebMvc turns off Boot&apos;s auto-configuration, and the &quot;//&quot; trap with Spring Security 6, with experiments that were actually run.</description><pubDate>Wed, 18 Nov 2026 00:00:00 GMT</pubDate></item><item><title>Form login with Spring Security: the filter chain, UserDetailsService and role-based access</title><link>https://notes.vinhnq.com/en/posts/spring-security-form-login/</link><guid isPermaLink="true">https://notes.vinhnq.com/en/posts/spring-security-form-login/</guid><description>How a request travels through DelegatingFilterProxy, FilterChainProxy and a dozen filters; the classes behind one login; writing your own UserDetailsService, a login page with CSRF, access rules, role-based redirects, logout and a 403 page, with a tested lab.</description><pubDate>Wed, 18 Nov 2026 00:00:00 GMT</pubDate></item><item><title>Spring Security for REST APIs: a stateless filter chain, login and JWT with the resource server</title><link>https://notes.vinhnq.com/en/posts/spring-security-rest-jwt-resource-server/</link><guid isPermaLink="true">https://notes.vinhnq.com/en/posts/spring-security-rest-jwt-resource-server/</guid><description>Hands-on Spring Boot 4 / Spring Security 7: a filter chain for a stateless API, password storage with DelegatingPasswordEncoder, a login endpoint with AuthenticationManager, issuing JWTs with NimbusJwtEncoder, validating them with the resource server, mapping a roles claim to ROLE_, JSON 401/403 and CORS for an SPA.</description><pubDate>Wed, 18 Nov 2026 00:00:00 GMT</pubDate></item><item><title>Sessions and remember-me in Spring: Spring Session JDBC, session limits and three ways to stay logged in</title><link>https://notes.vinhnq.com/en/posts/spring-session-va-remember-me/</link><guid isPermaLink="true">https://notes.vinhnq.com/en/posts/spring-session-va-remember-me/</guid><description>What Spring Security keeps in the session, changing the id on login, timeouts, limiting concurrent sessions, moving sessions into the database with Spring Session JDBC, the serialization error when storing objects, three remember-me styles compared and logging out everywhere, with a tested lab.</description><pubDate>Wed, 18 Nov 2026 00:00:00 GMT</pubDate></item><item><title>How SQL runs and how to read a PostgreSQL execution plan</title><link>https://notes.vinhnq.com/en/posts/sql-chay-the-nao-va-execution-plan/</link><guid isPermaLink="true">https://notes.vinhnq.com/en/posts/sql-chay-the-nao-va-execution-plan/</guid><description>How a query moves through the parser, planner and executor; the logical order of clauses; EXPLAIN ANALYZE and BUFFERS; scan types; reading cost, rows and loops; finding slow queries with pg_stat_statements.</description><pubDate>Wed, 18 Nov 2026 00:00:00 GMT</pubDate></item><item><title>Cache failures: avalanche, breakdown, penetration, hot keys and big keys</title><link>https://notes.vinhnq.com/en/posts/su-co-cache-avalanche-breakdown-penetration/</link><guid isPermaLink="true">https://notes.vinhnq.com/en/posts/su-co-cache-avalanche-breakdown-penetration/</guid><description>Six failures that turn the cache from a shield into a weak spot: the cache going down, many keys expiring at once, a hot key expiring, keys that don&apos;t exist, keys that are too hot, values that are too big. Causes, fixes (jitter, single-flight, null caching, Bloom filters, local caches) and eviction policies.</description><pubDate>Wed, 18 Nov 2026 00:00:00 GMT</pubDate></item><item><title>Architecture docs part 1: arc42, the C4 model, runtime/deployment views and docs-as-code</title><link>https://notes.vinhnq.com/en/posts/tai-lieu-kien-truc-c4-arc42-adr/</link><guid isPermaLink="true">https://notes.vinhnq.com/en/posts/tai-lieu-kien-truc-c4-arc42-adr/</guid><description>When architecture documentation is worth writing (the (Cx − Cy) &gt; Cmd rule), arc42&apos;s 12 sections and a trimmed template, the four levels of the C4 model, runtime views per use case including failure paths, deployment views per environment, and keeping docs alive with docs-as-code.</description><pubDate>Wed, 18 Nov 2026 00:00:00 GMT</pubDate></item><item><title>Web attacks and the OWASP Top 10: MITM, SQL injection, XSS, CSRF, DDoS</title><link>https://notes.vinhnq.com/en/posts/tan-cong-web-va-owasp-top-10/</link><guid isPermaLink="true">https://notes.vinhnq.com/en/posts/tan-cong-web-va-owasp-top-10/</guid><description>Five classic attacks seen from a Java backend: how they work and where the defenses belong (mTLS and replay protection, PreparedStatement and an ORDER BY allowlist, output encoding and nonce-based CSP, SameSite and CSRF tokens, rate limiting), the OWASP Top 10 mapped to Spring Security 6, and a controller review case study.</description><pubDate>Wed, 18 Nov 2026 00:00:00 GMT</pubDate></item><item><title>Template Method or composition: refactoring a booking flow from v0 to v2</title><link>https://notes.vinhnq.com/en/posts/template-method-va-composition/</link><guid isPermaLink="true">https://notes.vinhnq.com/en/posts/template-method-va-composition/</guid><description>Three versions of a homestay booking flow: one transactional method that does everything, steps with if-checks on the listing type, then Template Method with a hook. Three rules that keep Template Method safe, the traps inside Spring (constructor injection, @SneakyThrows, self-invocation), and when to switch to composition.</description><pubDate>Wed, 18 Nov 2026 00:00:00 GMT</pubDate></item><item><title>Testing Spring Boot: slice tests, integration tests and Testcontainers</title><link>https://notes.vinhnq.com/en/posts/test-spring-boot-slice-va-testcontainers/</link><guid isPermaLink="true">https://notes.vinhnq.com/en/posts/test-spring-boot-slice-va-testcontainers/</guid><description>What @WebMvcTest, @DataJpaTest and other slices load, @SpringBootTest with MockMvc or a real server, the @Transactional-in-tests traps, context caching, Testcontainers with @ServiceConnection, testing security with real JWTs, and the Spring Boot 4 testing changes, through a working lab.</description><pubDate>Wed, 18 Nov 2026 00:00:00 GMT</pubDate></item><item><title>Payments after the integration: late IPNs, reconciliation and a failure-mode table</title><link>https://notes.vinhnq.com/en/posts/thanh-toan-ipn-muon-va-doi-soat/</link><guid isPermaLink="true">https://notes.vinhnq.com/en/posts/thanh-toan-ipn-muon-va-doi-soat/</guid><description>The operations side of integrating a VNPay-style gateway: a case study of a successful IPN arriving after inventory was released, the transaction-query job, reconciling the gateway statement with the database and the ledger, BDD-style sandbox testing, and a complete failure-mode table.</description><pubDate>Wed, 18 Nov 2026 00:00:00 GMT</pubDate></item><item><title>Designing an airline booking database: relationships, seat inventory and overbooking</title><link>https://notes.vinhnq.com/en/posts/thiet-ke-database-dat-ve-may-bay/</link><guid isPermaLink="true">https://notes.vinhnq.com/en/posts/thiet-ke-database-dat-ve-may-bay/</guid><description>Airline data-model case study, part 1: writing relationships as sentences, the ER model, evolving v1 into v2, reference data, per-seat rows versus a counter for seat inventory, the correct overbooking formula, and indexes for the main queries.</description><pubDate>Wed, 18 Nov 2026 00:00:00 GMT</pubDate></item><item><title>Designing a Discord-style chat system: WebSocket gateways, message storage and fan-out for huge servers</title><link>https://notes.vinhnq.com/en/posts/thiet-ke-he-thong-chat-discord/</link><guid isPermaLink="true">https://notes.vinhnq.com/en/posts/thiet-ke-he-thong-chat-discord/</guid><description>A worked solution to the homework &apos;design a messaging system like Discord&apos;: requirements, estimates with the arithmetic, a WebSocket gateway, a message data model on ScyllaDB keyed by channel and time bucket, ordering with Snowflake ids, delivering to a server with a million members, presence, read states, reconnects, and how to present it in 45 minutes.</description><pubDate>Wed, 18 Nov 2026 00:00:00 GMT</pubDate></item><item><title>Case study: designing a liveness system for 1 million IoT devices sending heartbeats</title><link>https://notes.vinhnq.com/en/posts/thiet-ke-he-thong-liveness-heartbeat/</link><guid isPermaLink="true">https://notes.vinhnq.com/en/posts/thiet-ke-he-thong-liveness-heartbeat/</guid><description>A system design exercise for detecting disconnected devices: requirements with numbers, an estimate of 333K heartbeats/s, four options (a last_seen column, Redis ZSET, a timing wheel in workers per Kafka partition, delay messages), how to prevent false alarms when consumers lag or a whole region goes dark, and how to present it in 45 minutes.</description><pubDate>Wed, 18 Nov 2026 00:00:00 GMT</pubDate></item><item><title>Designing a Threads-style news feed: push, pull, hybrid and celebrities</title><link>https://notes.vinhnq.com/en/posts/thiet-ke-news-feed-threads/</link><guid isPermaLink="true">https://notes.vinhnq.com/en/posts/thiet-ke-news-feed-threads/</guid><description>A microblogging case study for 500 million users: requirements, estimates with the arithmetic (and fixing the slides&apos; wrong numbers), API, data model on ScyllaDB, fan-out on write versus on read, the hybrid model for celebrities, tracking active users, reaction counters, trending posts, and how to present it in 45 minutes.</description><pubDate>Wed, 18 Nov 2026 00:00:00 GMT</pubDate></item><item><title>Advanced REST API design: idempotent methods, gateway URLs, pagination and sorting</title><link>https://notes.vinhnq.com/en/posts/thiet-ke-rest-api-nang-cao/</link><guid isPermaLink="true">https://notes.vinhnq.com/en/posts/thiet-ke-rest-api-nang-cao/</guid><description>Senior-level REST API design, part 1: the design-first mindset, getting safe and idempotent right, URL conventions behind an API gateway, offset/cursor/deferred-join pagination with real PostgreSQL measurements, sort allowlists and modelling N-N relationships.</description><pubDate>Wed, 18 Nov 2026 00:00:00 GMT</pubDate></item><item><title>Designing a URL shortener: short codes, Base62, token ranges and redirects</title><link>https://notes.vinhnq.com/en/posts/thiet-ke-url-shortener/</link><guid isPermaLink="true">https://notes.vinhnq.com/en/posts/thiet-ke-url-shortener/</guid><description>A full system design case study for a Bitly-style link shortener: requirements, estimates with the arithmetic, API, data model on ScyllaDB and PostgreSQL, four ways to generate codes, token ranges that neither collide nor leak order, 301 versus 302, caching, analytics, and how to present it in 45 minutes.</description><pubDate>Wed, 18 Nov 2026 00:00:00 GMT</pubDate></item><item><title>Third-party integration: choosing a provider, sync versus async, webhooks and an anti-corruption layer</title><link>https://notes.vinhnq.com/en/posts/tich-hop-api-ben-thu-ba/</link><guid isPermaLink="true">https://notes.vinhnq.com/en/posts/tich-hop-api-ben-thu-ba/</guid><description>A common playbook for integrating payment gateways, SMS, eKYC or shipping providers: the order to evaluate requirements in, provider selection criteria, picking an integration style, receiving webhooks safely, hiding the provider behind your own interface, logging and testing.</description><pubDate>Wed, 18 Nov 2026 00:00:00 GMT</pubDate></item><item><title>Integrating a VNPay-style payment gateway: redirect, signatures and IPN</title><link>https://notes.vinhnq.com/en/posts/tich-hop-cong-thanh-toan-vnpay/</link><guid isPermaLink="true">https://notes.vinhnq.com/en/posts/tich-hop-cong-thanh-toan-vnpay/</guid><description>The full redirect payment flow from step 1 to 9.2.3: the parties and how far to trust each, the payment-attempt model and state machines, signing the URL with HMAC-SHA512 and the usual checksum bugs, an idempotent IPN handler with its reply codes, the return URL, and security.</description><pubDate>Wed, 18 Nov 2026 00:00:00 GMT</pubDate></item><item><title>Timeouts, retries, circuit breakers and bulkheads for third-party calls</title><link>https://notes.vinhnq.com/en/posts/timeout-retry-va-circuit-breaker/</link><guid isPermaLink="true">https://notes.vinhnq.com/en/posts/timeout-retry-va-circuit-breaker/</guid><description>Keeping a slow or dead third party from taking your system down: three kinds of timeout, safe retries with idempotency keys, backoff and jitter, retry storms, circuit breakers, bulkheads, business-driven fallbacks and Resilience4j configuration in Spring Boot 3.</description><pubDate>Wed, 18 Nov 2026 00:00:00 GMT</pubDate></item><item><title>Transactions from the inside: WAL, MVCC and the undo log</title><link>https://notes.vinhnq.com/en/posts/transaction-ben-trong-mvcc-undo-log/</link><guid isPermaLink="true">https://notes.vinhnq.com/en/posts/transaction-ben-trong-mvcc-undo-log/</guid><description>Replaying all four isolation levels on MySQL 8.4 and PostgreSQL 16, how a write travels through the redo log, InnoDB&apos;s MVCC (undo log, read view, purge, and history list length measured in numbers) versus PostgreSQL&apos;s (xmin/xmax, dead tuples, VACUUM).</description><pubDate>Wed, 18 Nov 2026 00:00:00 GMT</pubDate></item><item><title>Harmful transactions: too large, long-running, stalled, abandoned</title><link>https://notes.vinhnq.com/en/posts/transaction-gay-hai-va-cach-tim/</link><guid isPermaLink="true">https://notes.vinhnq.com/en/posts/transaction-gay-hai-va-cach-tim/</guid><description>The four kinds of transaction that slow down or freeze a production database: symptoms, queries to find them on MySQL 8.4 and PostgreSQL 16 (tested), fixes in the code, the pool and the database, plus the details people get wrong about SET TRANSACTION and autocommit.</description><pubDate>Wed, 18 Nov 2026 00:00:00 GMT</pubDate></item><item><title>The Twelve-Factor App: 12 principles for cloud-ready services, applied to Spring Boot and Kubernetes</title><link>https://notes.vinhnq.com/en/posts/twelve-factor-app/</link><guid isPermaLink="true">https://notes.vinhnq.com/en/posts/twelve-factor-app/</guid><description>A walk through the twelve factors from 12factor.net with Java 21, Spring Boot 3, Docker and Kubernetes: config in the environment, build/release/run, stateless processes, graceful shutdown tested with SIGTERM, logs to stdout, migrations as admin processes, and what has aged after more than a decade.</description><pubDate>Wed, 18 Nov 2026 00:00:00 GMT</pubDate></item><item><title>Unit testing with JUnit 5 and Mockito: test decisions, not wiring</title><link>https://notes.vinhnq.com/en/posts/unit-test-junit-5-va-mockito/</link><guid isPermaLink="true">https://notes.vinhnq.com/en/posts/unit-test-junit-5-va-mockito/</guid><description>Why developers write their own tests, the test pyramid and its critics, what to unit-test, AAA, JUnit 5/6 (@Nested, @ParameterizedTest, AssertJ), Mockito (mocks, stubs, spies, fakes, verify, InOrder, ArgumentCaptor, strict stubs), injecting a Clock, reviewing AI-written tests and mutation testing.</description><pubDate>Wed, 18 Nov 2026 00:00:00 GMT</pubDate></item><item><title>Back-of-the-envelope estimation: numbers to know and how to calculate fast</title><link>https://notes.vinhnq.com/en/posts/uoc-luong-back-of-the-envelope/</link><guid isPermaLink="true">https://notes.vinhnq.com/en/posts/uoc-luong-back-of-the-envelope/</guid><description>What estimation is for in system design, the numbers to memorise (seconds per day, data type sizes, the availability nines, latencies), grouping powers of ten, Little&apos;s Law, the rule of 72, and the URL shortener redone step by step with the places where the slides overestimate, then using the numbers to decide on servers, caching and sharding.</description><pubDate>Wed, 18 Nov 2026 00:00:00 GMT</pubDate></item><item><title>File upload in Spring MVC: receive, check, store and serve files safely</title><link>https://notes.vinhnq.com/en/posts/upload-file-spring-mvc/</link><guid isPermaLink="true">https://notes.vinhnq.com/en/posts/upload-file-spring-mvc/</guid><description>multipart/form-data and MultipartFile, size limits, where to store files (disk, database, object storage), five bugs in the common way of saving uploads, a FileStorageService that checks magic bytes and blocks path traversal, and serving files without opening an XSS hole.</description><pubDate>Wed, 18 Nov 2026 00:00:00 GMT</pubDate></item><item><title>Authentication: Basic, API keys, session cookies and JWT</title><link>https://notes.vinhnq.com/en/posts/xac-thuc-session-cookie-va-jwt/</link><guid isPermaLink="true">https://notes.vinhnq.com/en/posts/xac-thuc-session-cookie-va-jwt/</guid><description>Basic auth, API keys, session cookies with the right security flags, where to keep tokens in a browser, JWT anatomy and pitfalls, refresh token rotation, token revocation and Spring Security 6.</description><pubDate>Wed, 18 Nov 2026 00:00:00 GMT</pubDate></item><item><title>Object-oriented programming: abstract classes, interfaces and initialization order</title><link>https://notes.vinhnq.com/en/posts/abstract-class-va-interface/</link><guid isPermaLink="true">https://notes.vinhnq.com/en/posts/abstract-class-va-interface/</guid><description>Abstraction with abstract classes and interfaces (default, static and private methods, sealed types), default-method conflicts, static/instance/constructor initialization order and the overridable-call-in-constructor trap, plus Lab 06 and a hotel management exercise.</description><pubDate>Tue, 17 Nov 2026 00:00:00 GMT</pubDate></item><item><title>Algorithm practice: recursion, sorting and turning recursion into loops</title><link>https://notes.vinhnq.com/en/posts/bai-tap-de-quy-va-sap-xep/</link><guid isPermaLink="true">https://notes.vinhnq.com/en/posts/bai-tap-de-quy-va-sap-xep/</guid><description>A review of complexity classes and sorting/searching, analysing recursive functions, memoization, replacing recursion with an explicit stack, plus solutions to the recursion and alternating-sort exercises.</description><pubDate>Tue, 17 Nov 2026 00:00:00 GMT</pubDate></item><item><title>SQL exercises on the E-Learning database: ratings, lesson progress and a schema review</title><link>https://notes.vinhnq.com/en/posts/bai-tap-sql-e-learning/</link><guid isPermaLink="true">https://notes.vinhnq.com/en/posts/bai-tap-sql-e-learning/</guid><description>Nine SQL queries on the real schema of the online-course pet project (separate Teacher/Admin tables, ratings on the enrolment, START/PROCESSING/DONE progress), with the fan-out and LEFT JOIN traps and a PR-style schema review.</description><pubDate>Tue, 17 Nov 2026 00:00:00 GMT</pubDate></item><item><title>SQL practice: joins, GROUP BY and normalization in 15 library-database queries</title><link>https://notes.vinhnq.com/en/posts/bai-tap-sql-join-group-by/</link><guid isPermaLink="true">https://notes.vinhnq.com/en/posts/bai-tap-sql-join-group-by/</guid><description>A review of ERDs, join types, GROUP BY/HAVING, SELECT evaluation order and normalization, then 15 SQL exercises on a library database with the LEFT JOIN, COUNT and non-sargable traps.</description><pubDate>Tue, 17 Nov 2026 00:00:00 GMT</pubDate></item><item><title>Object-oriented programming: immutable objects, equals/hashCode and final</title><link>https://notes.vinhnq.com/en/posts/bat-bien-equals-hashcode-va-final/</link><guid isPermaLink="true">https://notes.vinhnq.com/en/posts/bat-bien-equals-hashcode-va-final/</guid><description>Writing immutable classes and records, defensive copies, the toString/equals/hashCode contract, final on variables, fields, methods and classes, and why static final constants get inlined into other classes, plus a fraction class exercise.</description><pubDate>Tue, 17 Nov 2026 00:00:00 GMT</pubDate></item><item><title>Java basics: variables, data types and casting</title><link>https://notes.vinhnq.com/en/posts/bien-va-kieu-du-lieu-java/</link><guid isPermaLink="true">https://notes.vinhnq.com/en/posts/bien-va-kieu-du-lieu-java/</guid><description>The 8 primitive types, primitives vs references in memory, wrapper classes, naming rules, casting and overflow.</description><pubDate>Tue, 17 Nov 2026 00:00:00 GMT</pubDate></item><item><title>Java I/O: byte streams, buffering and serialization</title><link>https://notes.vinhnq.com/en/posts/byte-stream-va-serialization/</link><guid isPermaLink="true">https://notes.vinhnq.com/en/posts/byte-stream-va-serialization/</guid><description>InputStream/OutputStream vs Reader/Writer, Decorator-style wrapping, why buffering is fast, copying files properly, Serializable, serialVersionUID and deserialization risks.</description><pubDate>Tue, 17 Nov 2026 00:00:00 GMT</pubDate></item><item><title>Linear data structures: arrays, linked lists, stacks and queues</title><link>https://notes.vinhnq.com/en/posts/cau-truc-du-lieu/</link><guid isPermaLink="true">https://notes.vinhnq.com/en/posts/cau-truc-du-lieu/</guid><description>Arrays, linked lists, stacks and queues: how they sit in memory, what each operation costs, when to pick which, and the usual bugs when you build them yourself.</description><pubDate>Tue, 17 Nov 2026 00:00:00 GMT</pubDate></item><item><title>Cron jobs: cron expressions and @Scheduled in Spring Boot</title><link>https://notes.vinhnq.com/en/posts/cron-job/</link><guid isPermaLink="true">https://notes.vinhnq.com/en/posts/cron-job/</guid><description>How Unix, Spring and Quartz cron syntax differ, fixedRate vs fixedDelay, and the traps in @Scheduled: one shared thread, swallowed exceptions, no catch-up, multiple instances with ShedLock, time zones and DST.</description><pubDate>Tue, 17 Nov 2026 00:00:00 GMT</pubDate></item><item><title>Databases: tables, data types, primary keys and basic SQL</title><link>https://notes.vinhnq.com/en/posts/database/</link><guid isPermaLink="true">https://notes.vinhnq.com/en/posts/database/</guid><description>Why a database beats plain files, what a DBMS does, tables, data types, primary keys, the SQL command groups, NULL, and how to change a schema safely once a table is big.</description><pubDate>Tue, 17 Nov 2026 00:00:00 GMT</pubDate></item><item><title>Databases: designing and querying a library system (exercise)</title><link>https://notes.vinhnq.com/en/posts/database-bai-tap-thu-vien/</link><guid isPermaLink="true">https://notes.vinhnq.com/en/posts/database-bai-tap-thu-vien/</guid><description>A complete exercise: analyse and fix the brief, draw the ERD, create tables with the right constraints, emulate a partial unique index on MySQL, then write 30 queries from basics to GROUP BY, EXISTS and ROLLUP.</description><pubDate>Tue, 17 Nov 2026 00:00:00 GMT</pubDate></item><item><title>Databases: ERDs, foreign keys, JOINs and GROUP BY</title><link>https://notes.vinhnq.com/en/posts/database-erd-join-group-by/</link><guid isPermaLink="true">https://notes.vinhnq.com/en/posts/database-erd-join-group-by/</guid><description>Designing an ERD, implementing 1-1, 1-n and n-n relationships with foreign keys, ON DELETE, writing JOINs, GROUP BY and HAVING, and the logical order a SELECT runs in.</description><pubDate>Tue, 17 Nov 2026 00:00:00 GMT</pubDate></item><item><title>Databases: normalization from 1NF to 5NF, and denormalization</title><link>https://notes.vinhnq.com/en/posts/database-phan-2/</link><guid isPermaLink="true">https://notes.vinhnq.com/en/posts/database-phan-2/</guid><description>Functional dependencies, the three kinds of anomaly, the normal forms from 1NF, 2NF, 3NF and BCNF up to 4NF and 5NF, and when to denormalize on purpose.</description><pubDate>Tue, 17 Nov 2026 00:00:00 GMT</pubDate></item><item><title>Databases: indexes, EXPLAIN, N+1, pagination and soft delete</title><link>https://notes.vinhnq.com/en/posts/database-phan-3/</link><guid isPermaLink="true">https://notes.vinhnq.com/en/posts/database-phan-3/</guid><description>Why a correct SQL query can still be slow: B+trees, clustered and composite indexes, covering indexes, sargability, reading EXPLAIN, the N+1 problem, keyset pagination and the real cost of soft delete.</description><pubDate>Tue, 17 Nov 2026 00:00:00 GMT</pubDate></item><item><title>Recursion, binary search and a few classic algorithms</title><link>https://notes.vinhnq.com/en/posts/de-quy-va-tim-kiem-nhi-phan/</link><guid isPermaLink="true">https://notes.vinhnq.com/en/posts/de-quy-va-tim-kiem-nhi-phan/</guid><description>Recursion and the JVM call stack, memoization, linear and binary search with their classic bugs, primality, Fibonacci and palindromes, plus recursion exercises with solutions.</description><pubDate>Tue, 17 Nov 2026 00:00:00 GMT</pubDate></item><item><title>Java basics: console I/O and text files</title><link>https://notes.vinhnq.com/en/posts/doc-ghi-file-java/</link><guid isPermaLink="true">https://notes.vinhnq.com/en/posts/doc-ghi-file-java/</guid><description>printf, Scanner and the nextLine trap, reading and writing text files with Scanner, PrintWriter, FileWriter and BufferedReader, try-with-resources and java.nio.file.Files.</description><pubDate>Tue, 17 Nov 2026 00:00:00 GMT</pubDate></item><item><title>Enums in production: EnumSet, EnumMap, singletons, databases and API evolution</title><link>https://notes.vinhnq.com/en/posts/enum-trong-database-va-api/</link><guid isPermaLink="true">https://notes.vinhnq.com/en/posts/enum-trong-database-va-api/</guid><description>What EnumSet and EnumMap are under the hood, the enum singleton, persisting enums with JPA (ORDINAL, STRING or stable codes), adding enum values to an API without breaking clients, enum serialization, plus a permissions exercise with EnumSet and bitmasks.</description><pubDate>Tue, 17 Nov 2026 00:00:00 GMT</pubDate></item><item><title>Enums in Java: from constants to classes, strategies and exhaustive switches</title><link>https://notes.vinhnq.com/en/posts/enum-va-nested-class/</link><guid isPermaLink="true">https://notes.vinhnq.com/en/posts/enum-va-nested-class/</guid><description>Why enums beat static final constants, enums as classes (fields, constructors, constant-specific bodies, strategies), the traps in valueOf/values/ordinal, exhaustive switches, and when to move to a sealed interface with records.</description><pubDate>Tue, 17 Nov 2026 00:00:00 GMT</pubDate></item><item><title>Java exceptions: checked vs unchecked, try-catch-finally and the call stack</title><link>https://notes.vinhnq.com/en/posts/exception-trong-java/</link><guid isPermaLink="true">https://notes.vinhnq.com/en/posts/exception-trong-java/</guid><description>The Throwable hierarchy, checked vs unchecked, throw/throws, try-catch-finally, try-with-resources, how exceptions travel up the call stack, when to use exceptions and what they cost.</description><pubDate>Tue, 17 Nov 2026 00:00:00 GMT</pubDate></item><item><title>ExecutorService, thread pools and virtual threads in Java</title><link>https://notes.vinhnq.com/en/posts/executorservice-va-virtual-thread/</link><guid isPermaLink="true">https://notes.vinhnq.com/en/posts/executorservice-va-virtual-thread/</guid><description>How ThreadPoolExecutor really works, bounded queues and rejection policies, sizing a pool, shutting it down properly, Java 21 virtual threads, pinning and ThreadLocal leaks.</description><pubDate>Tue, 17 Nov 2026 00:00:00 GMT</pubDate></item><item><title>Java generics: generic classes, generic methods, bounded types and invariance</title><link>https://notes.vinhnq.com/en/posts/generics-trong-java/</link><guid isPermaLink="true">https://notes.vinhnq.com/en/posts/generics-trong-java/</guid><description>What generics solve, how to write generic classes and methods, naming conventions, bounded type parameters, and why List&lt;Integer&gt; isn&apos;t a List&lt;Number&gt; while Integer[] is a Number[].</description><pubDate>Tue, 17 Nov 2026 00:00:00 GMT</pubDate></item><item><title>Java generics: type erasure, raw types and type tokens</title><link>https://notes.vinhnq.com/en/posts/generics-type-erasure/</link><guid isPermaLink="true">https://notes.vinhnq.com/en/posts/generics-type-erasure/</guid><description>What the compiler does with generics, the consequences of type erasure, bridge methods, heap pollution and @SafeVarargs, raw types, reifiable types, type tokens like Jackson&apos;s TypeReference, and generics with records and sealed interfaces.</description><pubDate>Tue, 17 Nov 2026 00:00:00 GMT</pubDate></item><item><title>Java generics: wildcards and the PECS rule</title><link>https://notes.vinhnq.com/en/posts/generics-wildcard-va-pecs/</link><guid isPermaLink="true">https://notes.vinhnq.com/en/posts/generics-wildcard-va-pecs/</guid><description>Unbounded, upper bounded and lower bounded wildcards, the PECS rule through real JDK APIs, wildcard capture, when to use a wildcard instead of a type parameter, plus Lab 10 (InventoryItem) with a full solution.</description><pubDate>Tue, 17 Nov 2026 00:00:00 GMT</pubDate></item><item><title>Git: version control, the staging area, the object model and commit conventions</title><link>https://notes.vinhnq.com/en/posts/git/</link><guid isPermaLink="true">https://notes.vinhnq.com/en/posts/git/</guid><description>What version control is, Git&apos;s three areas, the object model (blobs, trees, commits), Conventional Commits, commit hygiene, and everyday undo with restore and amend.</description><pubDate>Tue, 17 Nov 2026 00:00:00 GMT</pubDate></item><item><title>Git: branching, merge vs rebase, conflicts, reflog and the pull request flow</title><link>https://notes.vinhnq.com/en/posts/git-branching-merge-rebase/</link><guid isPermaLink="true">https://notes.vinhnq.com/en/posts/git-branching-merge-rebase/</guid><description>Branches and fast-forwards, resolving merge conflicts, merge or rebase, interactive rebase, cherry-pick, revert, reset, Git Flow vs trunk-based, reflog, bisect and code review through pull requests.</description><pubDate>Tue, 17 Nov 2026 00:00:00 GMT</pubDate></item><item><title>Git: remotes, cloning, release tags and a daily push habit</title><link>https://notes.vinhnq.com/en/posts/git-remote-tag-va-backup/</link><guid isPermaLink="true">https://notes.vinhnq.com/en/posts/git-remote-tag-va-backup/</guid><description>Working with remotes and GitHub, cloning a repo onto a new machine, a commit-and-push habit that makes Git a real backup, Semantic Versioning, and marking releases with tags.</description><pubDate>Tue, 17 Nov 2026 00:00:00 GMT</pubDate></item><item><title>Java basics: Hello World, compiling, the three kinds of errors and the first exercises</title><link>https://notes.vinhnq.com/en/posts/hello-world-va-ba-loai-loi-java/</link><guid isPermaLink="true">https://notes.vinhnq.com/en/posts/hello-world-va-ba-loai-loi-java/</guid><description>Your first Java program, the minimum syntax, javac vs java, compile/runtime/logic errors, and a set of exercises that use only print statements and expressions.</description><pubDate>Tue, 17 Nov 2026 00:00:00 GMT</pubDate></item><item><title>IoC and Dependency Injection: how the Spring container works</title><link>https://notes.vinhnq.com/en/posts/ioc-va-dependency-injection/</link><guid isPermaLink="true">https://notes.vinhnq.com/en/posts/ioc-va-dependency-injection/</guid><description>From coupling, IoC and DI to ApplicationContext, creating and injecting beans, the bean lifecycle, scopes, proxies and circular dependencies in Spring.</description><pubDate>Tue, 17 Nov 2026 00:00:00 GMT</pubDate></item><item><title>Java basics: the JVM, the JDK, LTS releases and where Java is used</title><link>https://notes.vinhnq.com/en/posts/java-co-ban/</link><guid isPermaLink="true">https://notes.vinhnq.com/en/posts/java-co-ban/</guid><description>How Java runs, JDK vs JRE vs JVM, the LTS releases from 8 to 25, where Java is used and how to set up your environment.</description><pubDate>Tue, 17 Nov 2026 00:00:00 GMT</pubDate></item><item><title>Java basics: loops, methods, the call stack and pass-by-value</title><link>https://notes.vinhnq.com/en/posts/java-co-ban-phan-2/</link><guid isPermaLink="true">https://notes.vinhnq.com/en/posts/java-co-ban-phan-2/</guid><description>while, do-while, for, break/continue and labels, methods, the call stack, variable scope and why Java is always pass-by-value.</description><pubDate>Tue, 17 Nov 2026 00:00:00 GMT</pubDate></item><item><title>Inside Java Collections: ArrayList, LinkedList, ArrayDeque and HashMap</title><link>https://notes.vinhnq.com/en/posts/java-collections-ben-trong-jdk/</link><guid isPermaLink="true">https://notes.vinhnq.com/en/posts/java-collections-ben-trong-jdk/</guid><description>How ArrayList grows, why LinkedList and Stack are rarely the right choice, how HashMap hashes, treeifies and resizes, Java 21 Sequenced Collections, a Big-O cheat sheet, and building ArrayList and LinkedList yourself.</description><pubDate>Tue, 17 Nov 2026 00:00:00 GMT</pubDate></item><item><title>Java Collections: List, Set and Map</title><link>https://notes.vinhnq.com/en/posts/java-collections-list-set-map/</link><guid isPermaLink="true">https://notes.vinhnq.com/en/posts/java-collections-list-set-map/</guid><description>The part of the Java Collections Framework you use every day: choosing List, Set, Map or Queue, ArrayList, the Collections utility class, HashSet and how it spots duplicates, and HashMap with modern Map methods like merge and computeIfAbsent.</description><pubDate>Tue, 17 Nov 2026 00:00:00 GMT</pubDate></item><item><title>ORM and JPA: mapping the E-Learning schema, DTOs and JSON recursion</title><link>https://notes.vinhnq.com/en/posts/jpa-anh-xa-e-learning-va-json/</link><guid isPermaLink="true">https://notes.vinhnq.com/en/posts/jpa-anh-xa-e-learning-va-json/</guid><description>Rebuilding the course&apos;s E-Learning schema (user, full_name, course, chapter, lesson, user_course, user_course_lesson, address), mapping every relationship to JPA with @EmbeddedId and composite foreign keys, then fixing JSON recursion when returning bidirectional entities: @JsonIgnore, @JsonBackReference, @JsonIdentityInfo and DTOs.</description><pubDate>Tue, 17 Nov 2026 00:00:00 GMT</pubDate></item><item><title>ORM and JPA: the persistence context, dirty checking and N+1</title><link>https://notes.vinhnq.com/en/posts/jpa-persistence-context-va-n-plus-1/</link><guid isPermaLink="true">https://notes.vinhnq.com/en/posts/jpa-persistence-context-va-n-plus-1/</guid><description>The persistence context and first-level cache, the four entity states, persist vs merge, dirty checking and flushing, lazy vs eager loading, the N+1 problem and four ways to fix it: fetch joins, entity graphs, batch fetching and DTO projections.</description><pubDate>Tue, 17 Nov 2026 00:00:00 GMT</pubDate></item><item><title>ORM and JPA: entity relationships, owning sides and mappedBy</title><link>https://notes.vinhnq.com/en/posts/jpa-quan-he-va-persistence-context/</link><guid isPermaLink="true">https://notes.vinhnq.com/en/posts/jpa-quan-he-va-persistence-context/</guid><description>Mapping one-to-one, one-to-many and many-to-many in JPA: where the foreign key goes, owning sides and mappedBy, @MapsId, cascades and orphanRemoval, Set instead of List for @ManyToMany, and when a join table needs its own entity.</description><pubDate>Tue, 17 Nov 2026 00:00:00 GMT</pubDate></item><item><title>Object-oriented programming: inheritance, encapsulation and polymorphism</title><link>https://notes.vinhnq.com/en/posts/ke-thua-dong-goi-va-da-hinh/</link><guid isPermaLink="true">https://notes.vinhnq.com/en/posts/ke-thua-dong-goi-va-da-hinh/</guid><description>Inheritance with extends and super, why composition usually wins, real encapsulation, overloading versus overriding, dynamic dispatch, upcasts, downcasts and pattern-matching instanceof, plus Lab 05 Person → Employee → Manager.</description><pubDate>Tue, 17 Nov 2026 00:00:00 GMT</pubDate></item><item><title>Object-oriented programming: classes, objects, constructors, static and access modifiers</title><link>https://notes.vinhnq.com/en/posts/lap-trinh-huong-doi-tuong/</link><guid isPermaLink="true">https://notes.vinhnq.com/en/posts/lap-trinh-huong-doi-tuong/</guid><description>Classes and objects, constructors and this, static, packages and imports, access modifiers, plus a Student class exercise and Lab 04 on encapsulation and access across packages.</description><pubDate>Tue, 17 Nov 2026 00:00:00 GMT</pubDate></item><item><title>Object-oriented programming: UML class diagrams and the six class relationships</title><link>https://notes.vinhnq.com/en/posts/lap-trinh-huong-doi-tuong-phan-2/</link><guid isPermaLink="true">https://notes.vinhnq.com/en/posts/lap-trinh-huong-doi-tuong-phan-2/</guid><description>Reading and drawing UML class diagrams, and the six relationships between classes (inheritance, realization, composition, aggregation, association, dependency) and how they look in code.</description><pubDate>Tue, 17 Nov 2026 00:00:00 GMT</pubDate></item><item><title>Java basics: arrays and strings</title><link>https://notes.vinhnq.com/en/posts/mang-va-chuoi-java/</link><guid isPermaLink="true">https://notes.vinhnq.com/en/posts/mang-va-chuoi-java/</guid><description>One-dimensional, two-dimensional and jagged arrays, the Arrays utilities, everyday String methods, comparing strings and StringBuilder.</description><pubDate>Tue, 17 Nov 2026 00:00:00 GMT</pubDate></item><item><title>Nested classes in Java: static nested, inner, local and anonymous classes, and lambdas</title><link>https://notes.vinhnq.com/en/posts/nested-class-va-lambda/</link><guid isPermaLink="true">https://notes.vinhnq.com/en/posts/nested-class-va-lambda/</guid><description>The four kinds of nested class and when to use each, the hidden outer reference that leaks memory, effectively final, how anonymous classes really differ from lambdas, records instead of nested classes, plus a complete Lab 07, a builder and a memory-leak hunt.</description><pubDate>Tue, 17 Nov 2026 00:00:00 GMT</pubDate></item><item><title>ORM and JPA: JDBC, Hibernate, entities and repositories</title><link>https://notes.vinhnq.com/en/posts/orm-va-jpa/</link><guid isPermaLink="true">https://notes.vinhnq.com/en/posts/orm-va-jpa/</guid><description>Why ORM exists, what JDBC, JPA, Hibernate and Spring Data JPA are, how to define entities, repositories and services, how to size the connection pool, manage the schema with Flyway and write equals/hashCode for entities.</description><pubDate>Tue, 17 Nov 2026 00:00:00 GMT</pubDate></item><item><title>ORM and JPA: JPQL, native queries, @Transactional and locking</title><link>https://notes.vinhnq.com/en/posts/orm-va-jpa-phan-2/</link><guid isPermaLink="true">https://notes.vinhnq.com/en/posts/orm-va-jpa-phan-2/</guid><description>Where derived queries fall short, JPQL and native queries with @Query and @Modifying, dynamic queries, @Transactional pitfalls, optimistic vs pessimistic locking and open-session-in-view.</description><pubDate>Tue, 17 Nov 2026 00:00:00 GMT</pubDate></item><item><title>The hotel booking example: APIs, preventing overbooking and the Spring Boot plan</title><link>https://notes.vinhnq.com/en/posts/pet-project-api-va-trien-khai/</link><guid isPermaLink="true">https://notes.vinhnq.com/en/posts/pet-project-api-va-trien-khai/</guid><description>The API list, preventing overbooking with a conditional update, idempotency keys, package layout, controller, service, the search query, milestones and a testing strategy with Testcontainers.</description><pubDate>Tue, 17 Nov 2026 00:00:00 GMT</pubDate></item><item><title>Requirements analysis and data design through a hotel booking example</title><link>https://notes.vinhnq.com/en/posts/pet-project-thuc-hanh/</link><guid isPermaLink="true">https://notes.vinhnq.com/en/posts/pet-project-thuc-hanh/</guid><description>Using the instructor&apos;s hotel booking example to turn a vague brief into a verifiable spec (open questions, scope, BDD, measurable NFRs), then designing the entities, reviewing the design, the ERD and the DDL, seen through a senior engineer&apos;s eyes, then applying the method to the E-Learning pet project.</description><pubDate>Tue, 17 Nov 2026 00:00:00 GMT</pubDate></item><item><title>Backend interview review: Java Core, Spring Boot and the web</title><link>https://notes.vinhnq.com/en/posts/pet-project-thuc-hanh-phan-2/</link><guid isPermaLink="true">https://notes.vinhnq.com/en/posts/pet-project-thuc-hanh-phan-2/</guid><description>A quick pre-interview review of the fundamentals: JDK/JRE/JVM, the four OOP pillars, == vs equals, final, overloading vs overriding, pass-by-value, data structures, IoC/DI, URL parameters and HTTPS.</description><pubDate>Tue, 17 Nov 2026 00:00:00 GMT</pubDate></item><item><title>Java concurrency: race conditions, volatile and deadlocks</title><link>https://notes.vinhnq.com/en/posts/race-condition-volatile-deadlock/</link><guid isPermaLink="true">https://notes.vinhnq.com/en/posts/race-condition-volatile-deadlock/</guid><description>Why count++ loses increments, synchronized vs AtomicInteger vs LongAdder, visibility and happens-before with volatile, and deadlocks: detecting them with thread dumps and preventing them.</description><pubDate>Tue, 17 Nov 2026 00:00:00 GMT</pubDate></item><item><title>REST APIs: REST constraints, API design conventions and Spring Boot project structure</title><link>https://notes.vinhnq.com/en/posts/thiet-ke-rest-api-spring-boot/</link><guid isPermaLink="true">https://notes.vinhnq.com/en/posts/thiet-ke-rest-api-spring-boot/</guid><description>What Spring Boot adds, the six REST constraints, URL conventions, pagination, versioning, error format, HTTP caching, REST vs gRPC/GraphQL and how to lay out a Spring Boot project.</description><pubDate>Tue, 17 Nov 2026 00:00:00 GMT</pubDate></item><item><title>Threads in Java: creating threads, the lifecycle and interruption</title><link>https://notes.vinhnq.com/en/posts/thread-va-concurrency-co-ban/</link><guid isPermaLink="true">https://notes.vinhnq.com/en/posts/thread-va-concurrency-co-ban/</guid><description>Processes vs threads, concurrency vs parallelism, Thread/Runnable/Callable, start vs run, the six thread states, sleep/join and stopping a thread with interruption.</description><pubDate>Tue, 17 Nov 2026 00:00:00 GMT</pubDate></item><item><title>Basic algorithms: Big-O and the three O(n²) sorts</title><link>https://notes.vinhnq.com/en/posts/thuat-toan-co-ban/</link><guid isPermaLink="true">https://notes.vinhnq.com/en/posts/thuat-toan-co-ban/</guid><description>Measuring complexity with Big-O, reading it off loops, the doubling test, and the three basic sorts (insertion, bubble, selection): how they work, whether they&apos;re stable, and when they&apos;re still useful.</description><pubDate>Tue, 17 Nov 2026 00:00:00 GMT</pubDate></item><item><title>Basic Algorithms: Merge Sort, Quicksort and How Java Really Sorts</title><link>https://notes.vinhnq.com/en/posts/thuat-toan-co-ban-phan-2/</link><guid isPermaLink="true">https://notes.vinhnq.com/en/posts/thuat-toan-co-ban-phan-2/</guid><description>Two O(n log n) divide-and-conquer sorts, how to defuse quicksort&apos;s worst case, and why Arrays.sort uses dual-pivot quicksort for primitives but TimSort for objects.</description><pubDate>Tue, 17 Nov 2026 00:00:00 GMT</pubDate></item><item><title>Java basics: operators, if and switch</title><link>https://notes.vinhnq.com/en/posts/toan-tu-va-re-nhanh-java/</link><guid isPermaLink="true">https://notes.vinhnq.com/en/posts/toan-tu-va-re-nhanh-java/</guid><description>Binary and two&apos;s complement, arithmetic, comparison, logical and bitwise operators, prefix vs postfix, precedence, if/else, the ternary, classic switch, switch expressions and pattern matching.</description><pubDate>Tue, 17 Nov 2026 00:00:00 GMT</pubDate></item><item><title>Databases: transactions, isolation levels and locking</title><link>https://notes.vinhnq.com/en/posts/transaction-isolation-locking/</link><guid isPermaLink="true">https://notes.vinhnq.com/en/posts/transaction-isolation-locking/</guid><description>Why correct code goes wrong under concurrency: ACID and how InnoDB implements it, isolation levels and anomalies (lost update, write skew), locks, gap locks, deadlocks, MVCC, SKIP LOCKED and retrying the right way.</description><pubDate>Tue, 17 Nov 2026 00:00:00 GMT</pubDate></item><item><title>Java Collections: TreeSet, TreeMap, Comparator and iterators</title><link>https://notes.vinhnq.com/en/posts/treemap-comparator-va-iterator/</link><guid isPermaLink="true">https://notes.vinhnq.com/en/posts/treemap-comparator-va-iterator/</guid><description>Ordered data in Java: TreeSet/TreeMap and NavigableMap for nearest-key and range queries; Comparable and Comparator; Iterator, ListIterator, fail-fast and concurrent iterators; plus Lab 09 with a full solution.</description><pubDate>Tue, 17 Nov 2026 00:00:00 GMT</pubDate></item><item><title>The web and HTTP: the Internet, HTTPS, methods, status codes and HTTP versions</title><link>https://notes.vinhnq.com/en/posts/web-va-rest-api/</link><guid isPermaLink="true">https://notes.vinhnq.com/en/posts/web-va-rest-api/</guid><description>How the Internet and the web work, HTTPS and TLS, HTTP method semantics, idempotency, status codes, HTTP/2, HTTP/3, timeouts and CORS.</description><pubDate>Tue, 17 Nov 2026 00:00:00 GMT</pubDate></item><item><title>Object-oriented programming: wrapper classes, BigInteger/BigDecimal and String</title><link>https://notes.vinhnq.com/en/posts/wrapper-bigdecimal-va-string/</link><guid isPermaLink="true">https://notes.vinhnq.com/en/posts/wrapper-bigdecimal-va-string/</guid><description>Wrapper classes and autoboxing, the shared numeric-wrapper API, the deprecated wrapper constructors, BigInteger/BigDecimal for money, immutable String and StringBuilder.</description><pubDate>Tue, 17 Nov 2026 00:00:00 GMT</pubDate></item><item><title>Cleanup cron jobs: batched deletes, archiving and partitions</title><link>https://notes.vinhnq.com/en/posts/xoa-du-lieu-cu-an-toan/</link><guid isPermaLink="true">https://notes.vinhnq.com/en/posts/xoa-du-lieu-cu-an-toan/</guid><description>Why one DELETE of millions of rows hurts the database, deleting in batches with one transaction each, archiving before deleting, DROP PARTITION, observing the job, and a complete purge job in Spring.</description><pubDate>Tue, 17 Nov 2026 00:00:00 GMT</pubDate></item><item><title>Custom exceptions and centralized error handling in Spring Boot: @RestControllerAdvice, ProblemDetail, validation</title><link>https://notes.vinhnq.com/en/posts/xu-ly-loi-spring-boot/</link><guid isPermaLink="true">https://notes.vinhnq.com/en/posts/xu-ly-loi-spring-boot/</guid><description>Designing custom exceptions with error codes, why try-catch in every controller is a bad idea, @RestControllerAdvice and @ExceptionHandler, ProblemDetail (RFC 9457), designing error responses, and DTO validation with Bean Validation.</description><pubDate>Tue, 17 Nov 2026 00:00:00 GMT</pubDate></item></channel></rss>