<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"><channel><title>Ghi chép của Vinh</title><description>Ghi chép mỗi ngày về system design, Java và các công nghệ backend của Nguyễn Quang Vinh.</description><link>https://notes.vinhnq.com/</link><item><title>Adapter và Factory: tích hợp cổng thanh toán và chọn đúng implementation</title><link>https://notes.vinhnq.com/posts/adapter-va-factory-pattern/</link><guid isPermaLink="true">https://notes.vinhnq.com/posts/adapter-va-factory-pattern/</guid><description>Review một Adapter cho cổng thanh toán nhận VND (ép kiểu làm mất tiền lẻ, double cho tiền, tràn int) và viết lại với Money, sealed result và làm tròn theo tiền tệ. Sau đó phân biệt simple factory, Factory Method và Abstract Factory, registry bean trong Spring, và hai bẫy wiring: @RequiredArgsConstructor với field không final và inject theo class cha.</description><pubDate>Wed, 18 Nov 2026 00:00:00 GMT</pubDate></item><item><title>Tài liệu kiến trúc phần 2: ADR, quality requirement, sổ rủi ro và ví dụ address component</title><link>https://notes.vinhnq.com/posts/adr-va-quality-requirement/</link><guid isPermaLink="true">https://notes.vinhnq.com/posts/adr-va-quality-requirement/</guid><description>Ghi quyết định bằng ADR có phương án bị loại và hệ quả, biến &apos;nhanh, ổn định&apos; thành quality requirement đo được, sổ rủi ro và nợ kỹ thuật, và một solution design mẫu cho address component với schema PostgreSQL đã chạy thử và các lỗi cần review.</description><pubDate>Wed, 18 Nov 2026 00:00:00 GMT</pubDate></item><item><title>Bộ nhớ ảo, page cache, swap và JVM trong container</title><link>https://notes.vinhnq.com/posts/bo-nho-ao-page-cache-va-jvm/</link><guid isPermaLink="true">https://notes.vinhnq.com/posts/bo-nho-ao-page-cache-va-jvm/</guid><description>Bộ nhớ ảo, bảng trang, TLB và page fault; overcommit, swap và OOM killer; vì sao RSS của JVM lớn hơn heap và cách tính memory limit cho container; page cache và mmap; cache của CPU, cache line, false sharing và lý do Java Memory Model tồn tại.</description><pubDate>Wed, 18 Nov 2026 00:00:00 GMT</pubDate></item><item><title>Các loại index ngoài B-tree: hash, GIN, GiST, bitmap và LSM-tree</title><link>https://notes.vinhnq.com/posts/cac-loai-index-gin-gist-lsm-bitmap/</link><guid isPermaLink="true">https://notes.vinhnq.com/posts/cac-loai-index-gin-gist-lsm-bitmap/</guid><description>Khi nào B-tree không đủ: hash và adaptive hash index, GIN cho mảng, jsonb và full-text, GiST cho khoảng thời gian, toạ độ và exclusion constraint chống đặt trùng, bitmap index so với bitmap scan, và LSM-tree cho hệ thống ghi nhiều. Có số đo trên PostgreSQL 16 và MySQL 8.4.</description><pubDate>Wed, 18 Nov 2026 00:00:00 GMT</pubDate></item><item><title>Cache-aside, write-around và bài toán lệch dữ liệu cache–DB</title><link>https://notes.vinhnq.com/posts/cache-aside-va-invalidation/</link><guid isPermaLink="true">https://notes.vinhnq.com/posts/cache-aside-va-invalidation/</guid><description>Cache nằm ở đâu, đo bằng gì, các chiến lược đọc/ghi, vì sao invalidation khó, và case study ba lần thử: update hay delete cache, thứ tự nào, race nào còn sót và cách đóng nó bằng TTL, retry, CDC, version.</description><pubDate>Wed, 18 Nov 2026 00:00:00 GMT</pubDate></item><item><title>Cache trong system design: các tầng cache, giới hạn của Redis và case study bộ đếm 1 triệu QPS</title><link>https://notes.vinhnq.com/posts/cache-nhieu-tang-va-bo-dem-quy-mo-lon/</link><guid isPermaLink="true">https://notes.vinhnq.com/posts/cache-nhieu-tang-va-bo-dem-quy-mo-lon/</guid><description>Cache nằm ở đâu từ client tới database, ba công dụng (tăng tốc, đệm, chia sẻ dữ liệu), con số giới hạn của một Redis, thiết kế bộ đếm like/view cho mạng xã hội 1 triệu QPS, bộ đếm thông báo broadcast chưa đọc bằng con trỏ, và năm bài toán nhỏ giải bằng cấu trúc dữ liệu Redis.</description><pubDate>Wed, 18 Nov 2026 00:00:00 GMT</pubDate></item><item><title>Cấu hình Kafka theo mục tiêu: throughput, latency, durability, availability</title><link>https://notes.vinhnq.com/posts/cau-hinh-kafka-theo-muc-tieu/</link><guid isPermaLink="true">https://notes.vinhnq.com/posts/cau-hinh-kafka-theo-muc-tieu/</guid><description>Không cấu hình nào tối đa được cả bốn mục tiêu: xếp hạng throughput, latency, durability, availability trước (hệ thống tài chính khác hệ thống ingestion), rồi chọn giá trị cho producer, consumer, topic và broker; kèm Spring Boot 3, bẫy auto-commit, CooperativeSticky, số partition và lab docker compose 3 broker KRaft.</description><pubDate>Wed, 18 Nov 2026 00:00:00 GMT</pubDate></item><item><title>Chiến lược deploy: rolling, blue-green, canary, feature flag và zero-downtime trên Kubernetes</title><link>https://notes.vinhnq.com/posts/chien-luoc-deploy-rolling-blue-green-canary/</link><guid isPermaLink="true">https://notes.vinhnq.com/posts/chien-luoc-deploy-rolling-blue-green-canary/</guid><description>So sánh recreate, rolling, blue-green, canary, shadow và feature flag theo rollback, chi phí và tương thích database; migration expand/contract để hai phiên bản chạy song song; Kubernetes tối thiểu cho backend dev (probe, maxSurge/maxUnavailable, resources, PodDisruptionBudget), graceful shutdown và health group của Spring Boot, và cần nhìn gì khi chạy canary.</description><pubDate>Wed, 18 Nov 2026 00:00:00 GMT</pubDate></item><item><title>Chọn database trong system design: SQL, NoSQL, NewSQL, columnar và time-series</title><link>https://notes.vinhnq.com/posts/chon-database-sql-nosql-newsql/</link><guid isPermaLink="true">https://notes.vinhnq.com/posts/chon-database-sql-nosql-newsql/</guid><description>Giới hạn của một database quan hệ tính bằng số, vì sao RDBMS khó scale ngang, năm họ NoSQL và NewSQL chấm điểm theo cùng một thước, columnar cho OLAP, time-series cho metric, và cách chọn theo mức tranh chấp (contention).</description><pubDate>Wed, 18 Nov 2026 00:00:00 GMT</pubDate></item><item><title>CI/CD cho backend Spring Boot: pipeline GitHub Actions từ commit tới production</title><link>https://notes.vinhnq.com/posts/ci-cd-pipeline-cho-backend/</link><guid isPermaLink="true">https://notes.vinhnq.com/posts/ci-cd-pipeline-cho-backend/</guid><description>CI, continuous delivery và continuous deployment khác nhau thế nào; một workflow GitHub Actions đầy đủ cho service Spring Boot (build, unit test, Testcontainers, static analysis, build và quét image, deploy); cache Maven, branching, tag image, secrets và OIDC, quality gate, Flyway trong pipeline, promote artifact qua các môi trường, tăng tốc pipeline và rollback.</description><pubDate>Wed, 18 Nov 2026 00:00:00 GMT</pubDate></item><item><title>Clean code: vì sao, đặt tên, hàm và luồng điều khiển</title><link>https://notes.vinhnq.com/posts/clean-code-dat-ten-ham-va-luong-dieu-khien/</link><guid isPermaLink="true">https://notes.vinhnq.com/posts/clean-code-dat-ten-ham-va-luong-dieu-khien/</guid><description>Clean code nhìn từ góc chi phí thay đổi: ba triệu chứng của độ phức tạp theo Ousterhout, cách đặt tên, viết hàm nhỏ và có một việc, thiết kế class theo SRP/OCP bằng sealed interface, giữ một mức trừu tượng, guard clause và giảm cognitive complexity.</description><pubDate>Wed, 18 Nov 2026 00:00:00 GMT</pubDate></item><item><title>Clean code: xử lý lỗi, boundary, test và refactor một đoạn code thật</title><link>https://notes.vinhnq.com/posts/clean-code-loi-boundary-va-refactor/</link><guid isPermaLink="true">https://notes.vinhnq.com/posts/clean-code-loi-boundary-va-refactor/</guid><description>Phần thực hành của clean code: quy tắc xử lý lỗi và checked/unchecked exception, comment và format, test không lạm dụng mock, bọc thư viện bên thứ ba sau adapter, danh mục refactoring, và một buổi refactor hàm checkout có golden master test bắt được lỗi làm tròn.</description><pubDate>Wed, 18 Nov 2026 00:00:00 GMT</pubDate></item><item><title>Code review: giải quyết bất đồng và hai buổi review mẫu trên code thật</title><link>https://notes.vinhnq.com/posts/code-review-bat-dong-va-review-mau/</link><guid isPermaLink="true">https://notes.vinhnq.com/posts/code-review-bat-dong-va-review-mau/</guid><description>Khi reviewer và tác giả không đồng ý: các bước từ lắng nghe, xác lập bối cảnh, đo bằng PoC đến leo thang và disagree-and-commit, qua case study chờ kiểm tra gian lận 5 phút. Sau đó là hai buổi review mẫu viết thành comment có nhãn: luồng đặt phòng Spring Boot và distributed lock bằng Redis.</description><pubDate>Wed, 18 Nov 2026 00:00:00 GMT</pubDate></item><item><title>Code review: mục tiêu, checklist, quy trình và cách viết comment</title><link>https://notes.vinhnq.com/posts/code-review-hieu-qua/</link><guid isPermaLink="true">https://notes.vinhnq.com/posts/code-review-hieu-qua/</guid><description>Code review cho backend: review để làm gì, checklist cho Java/Spring, quy trình peer và group review, kích thước PR (và con số hay bị trích sai), cách viết comment có nhãn TODO/NIT/OPTIONAL/FYI, và những gì nên để CI tự kiểm tra.</description><pubDate>Wed, 18 Nov 2026 00:00:00 GMT</pubDate></item><item><title>Connection pool và HikariCP: bên trong, cấu hình và chọn kích thước</title><link>https://notes.vinhnq.com/posts/connection-pool-hikaricp/</link><guid isPermaLink="true">https://notes.vinhnq.com/posts/connection-pool-hikaricp/</guid><description>Vì sao cần connection pool, HikariCP chờ connection thế nào (ConcurrentBag), các tham số quan trọng (maximumPoolSize, connectionTimeout, maxLifetime, keepaliveTime, leakDetectionThreshold), chọn kích thước bằng công thức và Little&apos;s Law, PgBouncer transaction pooling, @Transactional giữ connection, virtual thread, pool của HTTP client và metric cần theo dõi, kèm thí nghiệm JDK 21 đo bằng số.</description><pubDate>Wed, 18 Nov 2026 00:00:00 GMT</pubDate></item><item><title>Đặt vé máy bay: booking chiều đi/về, ledger double-entry và lịch sử thay đổi</title><link>https://notes.vinhnq.com/posts/dat-ve-may-bay-booking-ledger-lich-su/</link><guid isPermaLink="true">https://notes.vinhnq.com/posts/dat-ve-may-bay-booking-ledger-lich-su/</guid><description>Case study hãng bay phần 3: tách booking thành chiều bay và dòng tiền, lưu tiền đúng cách, vé và hành khách, sổ cái ghi kép với ràng buộc cân bằng trong PostgreSQL, khoá lạc quan bằng version và bảng booking_history, cùng các cách ghi lịch sử khác.</description><pubDate>Wed, 18 Nov 2026 00:00:00 GMT</pubDate></item><item><title>Đặt vé máy bay: giữ ghế đúng khi nhiều người cùng đặt</title><link>https://notes.vinhnq.com/posts/dat-ve-may-bay-giu-ghe-dong-thoi/</link><guid isPermaLink="true">https://notes.vinhnq.com/posts/dat-ve-may-bay-giu-ghe-dong-thoi/</guid><description>Case study hãng bay phần 2: vì sao check-then-act gây bán trùng, conditional update cho bộ đếm và trần thông lượng của dòng nóng, SKIP LOCKED để tự xếp ghế và cái bẫy báo hết chỗ oan, deadlock khi khách chọn ghế và cách khoá theo thứ tự, hết hạn giữ chỗ, code Spring Boot 3 và khác biệt MySQL 8.</description><pubDate>Wed, 18 Nov 2026 00:00:00 GMT</pubDate></item><item><title>Case study data modeling: đa ngôn ngữ, sắp xếp, lịch phòng, lịch hẹn, tag và báo cáo</title><link>https://notes.vinhnq.com/posts/data-modeling-case-study-da-ngon-ngu-sap-xep-lich/</link><guid isPermaLink="true">https://notes.vinhnq.com/posts/data-modeling-case-study-da-ngon-ngu-sap-xep-lich/</guid><description>Sáu bài toán mô hình hoá dữ liệu hay gặp, mỗi bài có ràng buộc, phương án, lựa chọn và lỗi thường gặp, kèm SQL đã chạy trên PostgreSQL 16 và MySQL 8.4: bản dịch, thứ tự kéo thả, lịch trống homestay, sự kiện lặp qua DST, tag và đếm click.</description><pubDate>Wed, 18 Nov 2026 00:00:00 GMT</pubDate></item><item><title>Ngày giờ trong backend: epoch, UTC, timezone, ISO 8601 và java.time</title><link>https://notes.vinhnq.com/posts/datetime-timezone-cho-backend/</link><guid isPermaLink="true">https://notes.vinhnq.com/posts/datetime-timezone-cho-backend/</guid><description>Máy tính lưu thời gian thế nào (epoch giây và mili giây, Y2038), UTC khác GMT ra sao, ISO 8601 / RFC 3339 / RFC 1123, vì sao phải dùng zone id IANA chứ không dùng offset cố định (DST), chọn đúng kiểu trong java.time, timezone của JVM, và case study tính số đêm và &apos;hôm nay&apos; sai khi đặt phòng.</description><pubDate>Wed, 18 Nov 2026 00:00:00 GMT</pubDate></item><item><title>DDD và cấu trúc package: bounded context, aggregate và khung codebase đặt vé máy bay</title><link>https://notes.vinhnq.com/posts/ddd-va-cau-truc-package/</link><guid isPermaLink="true">https://notes.vinhnq.com/posts/ddd-va-cau-truc-package/</guid><description>Chia codebase theo nghiệp vụ thay vì theo kỹ thuật: package-by-layer và package-by-feature, bounded context và ubiquitous language, entity, value object, aggregate, domain service, repository, các tầng của DDD, rồi dựng khung codebase đặt vé máy bay theo clean architecture + DDD và kiểm tra ranh giới bằng ArchUnit.</description><pubDate>Wed, 18 Nov 2026 00:00:00 GMT</pubDate></item><item><title>Design pattern qua refactor: Strategy</title><link>https://notes.vinhnq.com/posts/design-pattern-qua-refactor/</link><guid isPermaLink="true">https://notes.vinhnq.com/posts/design-pattern-qua-refactor/</guid><description>Học Strategy bằng cách refactor một bộ đồng bộ dữ liệu đầy if/else: smell ban đầu, từng bước tách interface, strategy bằng lambda và functional interface, chọn strategy trong Spring bằng registry, và các bẫy về state, thread-safety và làm tròn tiền.</description><pubDate>Wed, 18 Nov 2026 00:00:00 GMT</pubDate></item><item><title>Distributed tracing với OpenTelemetry: trace, span, traceparent và sampling</title><link>https://notes.vinhnq.com/posts/distributed-tracing-opentelemetry/</link><guid isPermaLink="true">https://notes.vinhnq.com/posts/distributed-tracing-opentelemetry/</guid><description>Một request đi qua gateway, booking, payment và Kafka thì debug thế nào: trace và span, header W3C traceparent (viết lại cho đúng định dạng), Java agent, OTLP và Collector, lưu trữ kiểu SigNoz/ClickHouse, head và tail sampling có cấu hình Collector đã chạy thử, nối log với trace.</description><pubDate>Wed, 18 Nov 2026 00:00:00 GMT</pubDate></item><item><title>Distributed transaction: 2PC, TCC, saga, pivot transaction và transactional outbox</title><link>https://notes.vinhnq.com/posts/distributed-transaction-saga-2pc-outbox/</link><guid isPermaLink="true">https://notes.vinhnq.com/posts/distributed-transaction-saga-2pc-outbox/</guid><description>Vì sao transaction xuyên service không có strong consistency thật, thang mức nhất quán từ 2PC, AT, TCC, 2-phase message tới saga, orchestration vs choreography, pivot transaction, cách bù cho việc saga thiếu isolation, và hai hiểu lầm: distributed transaction tăng TPS, outbox giải quyết distributed transaction.</description><pubDate>Wed, 18 Nov 2026 00:00:00 GMT</pubDate></item><item><title>Docker cho Spring Boot: image, Dockerfile nhiều stage, JVM trong container và Compose</title><link>https://notes.vinhnq.com/posts/docker-cho-spring-boot/</link><guid isPermaLink="true">https://notes.vinhnq.com/posts/docker-cho-spring-boot/</guid><description>Container là gì (namespace, cgroup), layer và cache khi build, Dockerfile nhiều stage với layered jar hoặc buildpacks, chọn base image JRE, distroless hay Alpine, memory của JVM, non-root, PID 1 và graceful shutdown, healthcheck, Docker Compose cho máy dev và quét lỗ hổng image.</description><pubDate>Wed, 18 Nov 2026 00:00:00 GMT</pubDate></item><item><title>DTO, response và validation cho REST API Spring Boot</title><link>https://notes.vinhnq.com/posts/dto-response-va-validation-rest-spring/</link><guid isPermaLink="true">https://notes.vinhnq.com/posts/dto-response-va-validation-rest-spring/</guid><description>ResponseEntity với 201 + Location và 204, chọn envelope hay body trần cho response thành công, DTO record thay cho entity, map entity sang DTO, PUT và PATCH, quan hệ gửi theo id, custom constraint, chuẩn hoá trước khi kiểm trùng, Swagger và phân trang, kèm code chạy được trên Spring Boot 4.</description><pubDate>Wed, 18 Nov 2026 00:00:00 GMT</pubDate></item><item><title>Elasticsearch: analyzer, inverted index, doc values và mapping cho tìm kiếm homestay</title><link>https://notes.vinhnq.com/posts/elasticsearch-indexing-co-ban/</link><guid isPermaLink="true">https://notes.vinhnq.com/posts/elasticsearch-indexing-co-ban/</guid><description>Elasticsearch lưu một document thế nào (analyzer, inverted index, _source, doc values, BKD tree), thiết kế mapping cho tìm kiếm homestay đã chạy thử trên Elasticsearch 8.15: bỏ dấu tiếng Việt, object và nested, range field dùng sai, shard và đồng bộ dữ liệu từ PostgreSQL.</description><pubDate>Wed, 18 Nov 2026 00:00:00 GMT</pubDate></item><item><title>Lab index PostgreSQL trên dataset hãng bay: B-tree, hash, LIKE, composite và covering</title><link>https://notes.vinhnq.com/posts/explain-analyze-postgres-thuc-hanh/</link><guid isPermaLink="true">https://notes.vinhnq.com/posts/explain-analyze-postgres-thuc-hanh/</guid><description>Thực hành từng bước với EXPLAIN ANALYZE trên 2 triệu booking: có và không có index, B-tree và hash, LIKE với collation và pg_trgm, khi nào planner bỏ index, thứ tự cột composite, ORDER BY và covering index INCLUDE.</description><pubDate>Wed, 18 Nov 2026 00:00:00 GMT</pubDate></item><item><title>Form binding và validation trong Spring MVC</title><link>https://notes.vinhnq.com/posts/form-binding-va-validation-spring-mvc/</link><guid isPermaLink="true">https://notes.vinhnq.com/posts/form-binding-va-validation-spring-mvc/</guid><description>Dữ liệu form đi vào object thế nào, vì sao không bind thẳng entity, Bean Validation với BindingResult, hiện lỗi trên Thymeleaf, custom validator mức field và mức class, và lab CRUD user có PRG, flash attribute, xoá bằng POST.</description><pubDate>Wed, 18 Nov 2026 00:00:00 GMT</pubDate></item><item><title>Giải quyết vấn đề như senior: định nghĩa, causal diagram, 5 Whys và checklist</title><link>https://notes.vinhnq.com/posts/giai-quyet-van-de-va-trade-off/</link><guid isPermaLink="true">https://notes.vinhnq.com/posts/giai-quyet-van-de-va-trade-off/</guid><description>Vấn đề là khoảng cách giữa thực tế cảm nhận và kỳ vọng của một stakeholder; case study thang máy với causal diagram, quy trình bảy bước, checklist tư duy phản biện, 5 Whys, Seven-So-What, 80/20 và checklist order, duplication, relationship, direction, consistency cho hệ phân tán.</description><pubDate>Wed, 18 Nov 2026 00:00:00 GMT</pubDate></item><item><title>Giao tiếp trong system design, phần 1: đường đi của một message, Protobuf, REST hay gRPC</title><link>https://notes.vinhnq.com/posts/giao-tiep-dong-bo-rest-grpc-http2/</link><guid isPermaLink="true">https://notes.vinhnq.com/posts/giao-tiep-dong-bo-rest-grpc-http2/</guid><description>Năm điều cần cân nhắc khi các thành phần nói chuyện với nhau, đường đi của một message qua serialization, protocol, mô hình xử lý và network I/O, Reactor pattern (không phải Actor model), HTTP/2, JSON hay Protobuf và luật tương thích, REST hay gRPC giữa backend, và cái bẫy cân bằng tải gRPC trên Kubernetes.</description><pubDate>Wed, 18 Nov 2026 00:00:00 GMT</pubDate></item><item><title>Giao tiếp trong system design, phần 2: Kafka hay RabbitMQ, đẩy realtime và case study phát hiện gian lận</title><link>https://notes.vinhnq.com/posts/giao-tiep-realtime-va-message-broker/</link><guid isPermaLink="true">https://notes.vinhnq.com/posts/giao-tiep-realtime-va-message-broker/</guid><description>Chọn Kafka hay RabbitMQ cho giao tiếp bất đồng bộ (sửa chỗ slide thiếu), bốn cách server đẩy dữ liệu xuống client (polling, long polling, SSE, WebSocket), MQTT cho hàng triệu thiết bị và order book, QUIC nói cho đúng, và một case study đầy đủ: thiết kế hệ thống phát hiện gian lận thanh toán trong 45 phút.</description><pubDate>Wed, 18 Nov 2026 00:00:00 GMT</pubDate></item><item><title>Giỏ hàng và đặt hàng với Spring: mô hình, transaction và chống bán quá kho</title><link>https://notes.vinhnq.com/posts/gio-hang-va-dat-hang-spring/</link><guid isPermaLink="true">https://notes.vinhnq.com/posts/gio-hang-va-dat-hang-spring/</guid><description>Thiết kế Cart, CartItem, Order, OrderLine; gộp dòng khi thêm cùng sản phẩm; tiền bằng BigDecimal; đặt hàng trong một transaction có requestId chống bấm hai lần, trừ kho nguyên tử, rollback khi hết hàng; trạng thái đơn và lịch sử mua không N+1. Kèm lab Spring Boot 3 chạy bằng test.</description><pubDate>Wed, 18 Nov 2026 00:00:00 GMT</pubDate></item><item><title>Hệ điều hành cho backend: kernel, system call, process và thread</title><link>https://notes.vinhnq.com/posts/he-dieu-hanh-kernel-process-thread/</link><guid isPermaLink="true">https://notes.vinhnq.com/posts/he-dieu-hanh-kernel-process-thread/</guid><description>Kernel và system call, user mode và kernel mode, process, thread và PCB, context switch, scheduler của Linux, và cách chúng hiện ra trong JVM và container: thread 1:1, virtual thread, CPU quota, PID 1 và SIGTERM.</description><pubDate>Wed, 18 Nov 2026 00:00:00 GMT</pubDate></item><item><title>Hệ thống liveness: từ Redis sorted set đến timing wheel và LMAX Disruptor</title><link>https://notes.vinhnq.com/posts/he-thong-liveness-timing-wheel-va-disruptor/</link><guid isPermaLink="true">https://notes.vinhnq.com/posts/he-thong-liveness-timing-wheel-va-disruptor/</guid><description>Case study 1 triệu thiết bị IoT gửi heartbeat mỗi 3 giây: chọn cấu trúc dữ liệu cho timer (Redis ZSET hay timing wheel), xử lý bucket lớn bằng nhiều thread, và vì sao hàng đợi giữa các thread lại là nút cổ chai mà Disruptor giải quyết.</description><pubDate>Wed, 18 Nov 2026 00:00:00 GMT</pubDate></item><item><title>Idempotency phần 2: consumer Kafka, idempotent producer và IPN cổng thanh toán</title><link>https://notes.vinhnq.com/posts/idempotency-kafka-va-ipn-thanh-toan/</link><guid isPermaLink="true">https://notes.vinhnq.com/posts/idempotency-kafka-va-ipn-thanh-toan/</guid><description>Idempotency ở tầng messaging và thanh toán: consumer Kafka khử trùng bằng bảng processed_message, idempotent producer (PID, sequence, max.in.flight ≤ 5) và giới hạn của nó, handler IPN kiểu VNPay theo state machine, đối soát, và bảng tổng hợp lưu gì, giữ bao lâu ở từng tầng.</description><pubDate>Wed, 18 Nov 2026 00:00:00 GMT</pubDate></item><item><title>Idempotency phần 1: at-least-once, unique constraint và Idempotency-Key trên PostgreSQL</title><link>https://notes.vinhnq.com/posts/idempotency-trong-he-thong-phan-tan/</link><guid isPermaLink="true">https://notes.vinhnq.com/posts/idempotency-trong-he-thong-phan-tan/</guid><description>Vì sao mọi hệ thống phân tán đều là at-least-once, ba cách làm một thao tác idempotent, cài đặt Idempotency-Key có chạy thử với 20 request đồng thời trên PostgreSQL, case study booking trùng vì request_id không UNIQUE, và vì sao distributed lock không thay được idempotency.</description><pubDate>Wed, 18 Nov 2026 00:00:00 GMT</pubDate></item><item><title>Index bên trong: B-tree, B+tree, clustered, heap và chọn khoá chính</title><link>https://notes.vinhnq.com/posts/index-ben-trong-b-tree-clustered-heap/</link><guid isPermaLink="true">https://notes.vinhnq.com/posts/index-ben-trong-b-tree-clustered-heap/</guid><description>Vì sao database dùng B+tree, InnoDB clustered index khác heap của PostgreSQL ra sao, unique index đối xử với NULL thế nào, composite index với điều kiện range, chọn bigint hay UUIDv4 hay UUIDv7 làm khoá chính, và bảo trì index khi bị phình.</description><pubDate>Wed, 18 Nov 2026 00:00:00 GMT</pubDate></item><item><title>Lock trong InnoDB: từ global lock tới gap lock, đọc bằng data_locks</title><link>https://notes.vinhnq.com/posts/innodb-lock-va-data-locks/</link><guid isPermaLink="true">https://notes.vinhnq.com/posts/innodb-lock-va-data-locks/</guid><description>Bài toán chuyển tiền bị âm số dư, các loại lock của MySQL từ global tới row (intention, AUTO-INC, record, gap, next-key, insert intention), và performance_schema.data_locks cho từng kiểu câu lệnh ở REPEATABLE READ và READ COMMITTED, đo trên MySQL 8.4.</description><pubDate>Wed, 18 Nov 2026 00:00:00 GMT</pubDate></item><item><title>I/O model: blocking, non-blocking, epoll và file descriptor</title><link>https://notes.vinhnq.com/posts/io-model-epoll-va-file-descriptor/</link><guid isPermaLink="true">https://notes.vinhnq.com/posts/io-model-epoll-va-file-descriptor/</guid><description>I/O chạy thế nào từ system call tới DMA và interrupt, bốn nhóm nút thắt và cách đo, năm mô hình I/O của Unix, select/poll/epoll, Java NIO, Tomcat, Netty, virtual thread, I/O tuần tự và ngẫu nhiên, fsync, và lỗi Too many open files.</description><pubDate>Wed, 18 Nov 2026 00:00:00 GMT</pubDate></item><item><title>JOIN chạy thế nào (nested loop, hash join, merge join) và khi nào partition bảng</title><link>https://notes.vinhnq.com/posts/join-algorithm-va-partition/</link><guid isPermaLink="true">https://notes.vinhnq.com/posts/join-algorithm-va-partition/</guid><description>Ba thuật toán join và khi nào database chọn từng cái, hash join tràn đĩa, bẫy LEFT JOIN với WHERE, join decomposition, partition khác sharding ra sao, giới hạn của MySQL partitioning, và các bậc xử lý một bảng quá lớn.</description><pubDate>Wed, 18 Nov 2026 00:00:00 GMT</pubDate></item><item><title>Schema thay đổi theo thời gian: cột JSON, DDL online, kiểu dữ liệu và view</title><link>https://notes.vinhnq.com/posts/json-ddl-online-kieu-du-lieu-va-view/</link><guid isPermaLink="true">https://notes.vinhnq.com/posts/json-ddl-online-kieu-du-lieu-va-view/</guid><description>Vì sao cột dự phòng c1..c6 đã lỗi thời, thêm cột và index không downtime trên MySQL 8.4 và PostgreSQL 16, index trường JSON, chọn kiểu chuỗi, số, tiền, thời gian, và view MERGE, TEMPTABLE, materialized cùng các bẫy hiệu năng và bảo mật, kèm số đo thật.</description><pubDate>Wed, 18 Nov 2026 00:00:00 GMT</pubDate></item><item><title>Kafka consumer group bên trong: rebalance, assignor, static membership và liveness</title><link>https://notes.vinhnq.com/posts/kafka-consumer-group-rebalance-va-liveness/</link><guid isPermaLink="true">https://notes.vinhnq.com/posts/kafka-consumer-group-rebalance-va-liveness/</guid><description>Group coordinator và group leader, giao thức JoinGroup/SyncGroup, đo bốn cách gán partition (range, round-robin, cooperative-sticky, KIP-848) trên Kafka 4.3, static membership khi rolling deploy, heartbeat với max.poll.interval.ms, vòng lặp xử lý lại vô tận và poison pill ở mức client.</description><pubDate>Wed, 18 Nov 2026 00:00:00 GMT</pubDate></item><item><title>Kafka trong thực tế (2): dual write, exactly-once và thứ tự message</title><link>https://notes.vinhnq.com/posts/kafka-dual-write-exactly-once-va-thu-tu/</link><guid isPermaLink="true">https://notes.vinhnq.com/posts/kafka-dual-write-exactly-once-va-thu-tu/</guid><description>Ba bài toán về tính đúng khi dùng Kafka: dual write giữa database và Kafka (vì sao emit trước hay bọc transaction đều hỏng, transactional outbox với Debezium), exactly-once cho luồng Kafka sang Kafka và luồng ghi ra database, và giữ thứ tự message từ producer tới consumer.</description><pubDate>Wed, 18 Nov 2026 00:00:00 GMT</pubDate></item><item><title>Kafka producer bên trong: send(), batching, partitioner và transaction</title><link>https://notes.vinhnq.com/posts/kafka-producer-ben-trong/</link><guid isPermaLink="true">https://notes.vinhnq.com/posts/kafka-producer-ben-trong/</guid><description>Đường đi của một record từ send() tới broker (RecordAccumulator, sender thread, buffer.memory, max.block.ms), số đo linger.ms và nén trên Kafka 4.3, uniform sticky partitioner, retry đúng cách, và transaction từ bên trong: coordinator, control marker, LSO, fencing.</description><pubDate>Wed, 18 Nov 2026 00:00:00 GMT</pubDate></item><item><title>Case study: gọi fraud-check đồng bộ qua Kafka và Redis — nên hay không?</title><link>https://notes.vinhnq.com/posts/kafka-request-reply-case-study/</link><guid isPermaLink="true">https://notes.vinhnq.com/posts/kafka-request-reply-case-study/</guid><description>Review một service ví điện tử chờ kết quả chống gian lận qua Kafka và dùng Redis làm nơi ghép cặp request-reply: message envelope, event khác command, tám lỗi thiết kế, các phương án thay thế (ReplyingKafkaTemplate, reply partition, HTTP có timeout, UX bất đồng bộ) và transactional outbox.</description><pubDate>Wed, 18 Nov 2026 00:00:00 GMT</pubDate></item><item><title>Kafka serialization và Schema Registry: chọn format, wire format và compatibility mode</title><link>https://notes.vinhnq.com/posts/kafka-serialization-va-schema-registry/</link><guid isPermaLink="true">https://notes.vinhnq.com/posts/kafka-serialization-va-schema-registry/</guid><description>Serializer/deserializer trong Kafka, lỗi bytes → String → object, JSON hay Avro hay Protobuf (đo 85 byte so với 29 byte), Schema Registry hoạt động thế nào (magic byte, schema id, subject), bảng compatibility mode đã kiểm bằng code, thứ tự nâng cấp, và các bẫy của JsonSerializer trong Spring Kafka.</description><pubDate>Wed, 18 Nov 2026 00:00:00 GMT</pubDate></item><item><title>Kafka trong thực tế (1): số partition, message lớn, lag và tác vụ chạy lâu</title><link>https://notes.vinhnq.com/posts/kafka-so-partition-lag-va-tac-vu-dai/</link><guid isPermaLink="true">https://notes.vinhnq.com/posts/kafka-so-partition-lag-va-tac-vu-dai/</guid><description>Các bài toán vận hành Kafka hay gặp và pattern xử lý: tính số partition theo throughput ghi và đọc, thu nhỏ topic, message lớn với claim check, đo và xử lý consumer lag, tác vụ chạy lâu (async, chỉnh liveness, pipeline), poison pill với retry topic và DLT, hot partition.</description><pubDate>Wed, 18 Nov 2026 00:00:00 GMT</pubDate></item><item><title>Vì sao Kafka nhanh và bền: log, zero-copy, batching, replication</title><link>https://notes.vinhnq.com/posts/kafka-vi-sao-nhanh-va-ben/</link><guid isPermaLink="true">https://notes.vinhnq.com/posts/kafka-vi-sao-nhanh-va-ben/</guid><description>Kafka không &apos;nhanh&apos; theo nghĩa latency thấp mà tối ưu cho throughput: log append-only và I/O tuần tự, zero-copy, ghi vào page cache không fsync, consumer rẻ nhờ offset, batching và nén ở client, partition và consumer group. Phần bền: replication, ISR, high watermark, acks, min.insync.replicas và unclean leader election.</description><pubDate>Wed, 18 Nov 2026 00:00:00 GMT</pubDate></item><item><title>Khám phá domain trước khi thiết kế: Event Storming, Domain Storytelling và pivotal event</title><link>https://notes.vinhnq.com/posts/kham-pha-domain-event-storming-domain-storytelling/</link><guid isPermaLink="true">https://notes.vinhnq.com/posts/kham-pha-domain-event-storming-domain-storytelling/</guid><description>Cách một kiến trúc sư hiểu nghiệp vụ mới: buổi họp đầu với câu hỏi Why/What/How, tổ chức workshop, Event Storming mức Big Picture và Process (event, command, policy, read model, pivotal event), Domain Storytelling, và cách biến tường giấy dán thành ranh giới module và code backend.</description><pubDate>Wed, 18 Nov 2026 00:00:00 GMT</pubDate></item><item><title>Kiến trúc codebase: layered, hexagonal, onion, clean và functional core</title><link>https://notes.vinhnq.com/posts/kien-truc-layered-hexagonal-clean/</link><guid isPermaLink="true">https://notes.vinhnq.com/posts/kien-truc-layered-hexagonal-clean/</guid><description>Năm cách tổ chức code backend và một ý chung đứng sau: hướng phụ thuộc. Layered đóng/mở, port và adapter, domain ở tâm, dependency rule, DTO ở ranh giới, repository interface bên trong, pure core với I/O ở rìa. Kèm cách chọn theo quy mô dự án và cách kiểm tra tự động bằng ArchUnit.</description><pubDate>Wed, 18 Nov 2026 00:00:00 GMT</pubDate></item><item><title>Kiến trúc phần mềm thực dụng: architectural driver, vai trò kiến trúc sư và quyết định theo bối cảnh</title><link>https://notes.vinhnq.com/posts/kien-truc-phan-mem-thuc-dung-architectural-driver/</link><guid isPermaLink="true">https://notes.vinhnq.com/posts/kien-truc-phan-mem-thuc-dung-architectural-driver/</guid><description>Bốn nhóm architectural driver (functional requirement, business constraint, technical constraint, quality attribute), vì sao chúng kéo nhau, cách giữ thực dụng mà không đóng cửa tương lai, vai trò kiến trúc sư hiện đại, và một case SaaS phòng khám áp dụng từ đầu đến cuối.</description><pubDate>Wed, 18 Nov 2026 00:00:00 GMT</pubDate></item><item><title>Làm việc với AI coding agent cho backend: quy trình, project rules và cách kiểm chứng</title><link>https://notes.vinhnq.com/posts/lam-viec-voi-ai-coding-agent-cho-backend/</link><guid isPermaLink="true">https://notes.vinhnq.com/posts/lam-viec-voi-ai-coding-agent-cho-backend/</guid><description>AI giỏi và dở ở đâu, vibe coding khác cách làm dựa trên nền tảng thế nào, khi nào không nên dùng AI, file project rules cho từng công cụ, cách viết prompt cho việc backend, test là trọng tài, code bảo mật, quyền riêng tư và cách đo xem AI có thật sự giúp.</description><pubDate>Wed, 18 Nov 2026 00:00:00 GMT</pubDate></item><item><title>Linux cho backend: inode, link, phân quyền và shell script</title><link>https://notes.vinhnq.com/posts/linux-file-system-va-shell/</link><guid isPermaLink="true">https://notes.vinhnq.com/posts/linux-file-system-va-shell/</guid><description>Những gì một backend engineer cần về file system Linux: mọi thứ là file, inode và directory entry, hard link và soft link, file đã xoá vẫn chiếm đĩa, log rotation, phân quyền rwx, umask, sticky bit, chạy container không phải root, các lệnh hay dùng và cách viết shell script an toàn, kèm ba bài tập có lời giải đã chạy.</description><pubDate>Wed, 18 Nov 2026 00:00:00 GMT</pubDate></item><item><title>Lỗi thường gặp trong Spring Boot và cách debug: từ trùng port tới 403 thành 500</title><link>https://notes.vinhnq.com/posts/loi-thuong-gap-spring-boot-va-cach-debug/</link><guid isPermaLink="true">https://notes.vinhnq.com/posts/loi-thuong-gap-spring-boot-va-cach-debug/</guid><description>Sổ tay xử lý lỗi theo triệu chứng: trùng port, ClassNotFound và xung đột dependency, đọc khối APPLICATION FAILED TO START, LazyInitializationException, 401 và 403 trong API JWT, @PreAuthorize bị biến thành 500, CORS, vòng lặp JSON, lỗi khi save với IDENTITY, data.sql chạy trước bảng, và kỹ năng dùng debugger.</description><pubDate>Wed, 18 Nov 2026 00:00:00 GMT</pubDate></item><item><title>Lưu mật khẩu và mã hoá dữ liệu cá nhân: salt, Argon2id, AES-GCM và blind index</title><link>https://notes.vinhnq.com/posts/luu-mat-khau-va-ma-hoa-du-lieu-ca-nhan/</link><guid isPermaLink="true">https://notes.vinhnq.com/posts/luu-mat-khau-va-ma-hoa-du-lieu-ca-nhan/</guid><description>Hai case study bảo mật dữ liệu của backend: lưu mật khẩu (rainbow table, salt, pepper, Argon2id/bcrypt, nâng cấp hash cũ) và mã hoá dữ liệu cá nhân (mã hoá ở đâu, AES-GCM với nonce và AAD, envelope encryption, nhị phân hay Base64, tìm kiếm bằng blind index).</description><pubDate>Wed, 18 Nov 2026 00:00:00 GMT</pubDate></item><item><title>Lưu ngày giờ trong PostgreSQL, MySQL và JSON: timestamptz, DATETIME, Jackson và các bẫy</title><link>https://notes.vinhnq.com/posts/luu-ngay-gio-trong-database-va-json/</link><guid isPermaLink="true">https://notes.vinhnq.com/posts/luu-ngay-gio-trong-database-va-json/</guid><description>Timestamp khác datetime thế nào, PostgreSQL timestamptz vs timestamp, MySQL TIMESTAMP vs DATETIME (giới hạn 2038, chuyển đổi theo session), phần lẻ của giây bị làm tròn, lịch hẹn tương lai cần zone id, JDBC/Hibernate/Connector/J, và các bẫy JSON: Jackson, ISO 8601, epoch, JavaScript Date.</description><pubDate>Wed, 18 Nov 2026 00:00:00 GMT</pubDate></item><item><title>Luyện CCDAK phần 2: 34 câu tự luyện về client, Connect, Schema Registry và Streams</title><link>https://notes.vinhnq.com/posts/luyen-tap-ccdak-phan-2/</link><guid isPermaLink="true">https://notes.vinhnq.com/posts/luyen-tap-ccdak-phan-2/</guid><description>Bộ câu hỏi trắc nghiệm mình tự soạn để luyện CCDAK, bổ sung cho bài 40 câu: CLI và bảo mật, producer, consumer và assignor, Avro và Schema Registry, REST Proxy, Kafka Connect, Kafka Streams và ksqlDB. Mỗi câu có đáp án gấp lại và lời giải, kèm bảng các đáp án sai hoặc lỗi thời trong bộ câu hỏi lưu hành.</description><pubDate>Wed, 18 Nov 2026 00:00:00 GMT</pubDate></item><item><title>Encoding, hash, mã hoá và chữ ký: chọn đúng công cụ mật mã cho backend</title><link>https://notes.vinhnq.com/posts/ma-hoa-hash-va-chu-ky-so/</link><guid isPermaLink="true">https://notes.vinhnq.com/posts/ma-hoa-hash-va-chu-ky-so/</guid><description>Phân biệt encoding, hashing, encryption, MAC và chữ ký số: mỗi cái trả lời câu hỏi gì, HMAC hay chữ ký số cho API, đối xứng hay bất đối xứng, TLS bảo vệ được gì và quản lý secret ở mức đủ dùng cho backend.</description><pubDate>Wed, 18 Nov 2026 00:00:00 GMT</pubDate></item><item><title>Mạng máy tính cho backend: DNS, TCP, TLS và cách debug kết nối</title><link>https://notes.vinhnq.com/posts/mang-may-tinh-cho-backend-tcp-dns-tls/</link><guid isPermaLink="true">https://notes.vinhnq.com/posts/mang-may-tinh-cho-backend-tcp-dns-tls/</guid><description>Chuyện gì xảy ra khi gọi một API (DNS và cache DNS của JVM, bắt tay TCP, TLS 1.3, keep-alive), những điều TCP phải biết (ephemeral port, TIME_WAIT, Nagle, backlog, RST và FIN), connect timeout và read timeout, load balancer L4/L7, NAT, MTU, mTLS, và bộ công cụ dig, curl, ss, tcpdump, openssl đã chạy thử.</description><pubDate>Wed, 18 Nov 2026 00:00:00 GMT</pubDate></item><item><title>Maven và cấu trúc dự án Spring Boot</title><link>https://notes.vinhnq.com/posts/maven-va-cau-truc-du-an-spring-boot/</link><guid isPermaLink="true">https://notes.vinhnq.com/posts/maven-va-cau-truc-du-an-spring-boot/</guid><description>POM và toạ độ GAV, lifecycle với phase và goal, scope và phụ thuộc bắc cầu đọc bằng dependency:tree, starter parent và BOM quản lý version, Maven wrapper, kho ~/.m2 và mirror, bố cục thư mục, fat jar và DevTools, kèm output chạy thật trên Spring Boot 3.5.</description><pubDate>Wed, 18 Nov 2026 00:00:00 GMT</pubDate></item><item><title>Message broker: 4 bài toán của request-response và cách chọn broker</title><link>https://notes.vinhnq.com/posts/message-broker-va-cach-chon/</link><guid isPermaLink="true">https://notes.vinhnq.com/posts/message-broker-va-cach-chon/</guid><description>Vì sao cần message broker: bốn bài toán mà gọi đồng bộ không giải được (gửi nhiều nơi, phụ thuộc lẫn nhau, thêm consumer mới, traffic tăng đột biến), cái giá phải trả, event khác response thế nào, và cách chọn giữa database-as-queue, Redis, RabbitMQ, NATS, Pulsar và Kafka.</description><pubDate>Wed, 18 Nov 2026 00:00:00 GMT</pubDate></item><item><title>Microservices: khi nào nên tách, tìm ranh giới service và tách dần từ monolith</title><link>https://notes.vinhnq.com/posts/microservices-ranh-gioi-service/</link><guid isPermaLink="true">https://notes.vinhnq.com/posts/microservices-ranh-gioi-service/</guid><description>Lợi và hại của microservices, các thành phần bắt buộc (API gateway, service discovery, load balancer) và mở rộng, quy trình tìm ranh giới từ event storming tới bounded context, sáu nguyên tắc tách service, chạy song song bản cũ và mới, và quyền sở hữu dữ liệu.</description><pubDate>Wed, 18 Nov 2026 00:00:00 GMT</pubDate></item><item><title>Nguyên tắc thiết kế: CAP, PACELC, scalability, performance và availability</title><link>https://notes.vinhnq.com/posts/nguyen-tac-scalability-performance-availability/</link><guid isPermaLink="true">https://notes.vinhnq.com/posts/nguyen-tac-scalability-performance-availability/</guid><description>Các nguyên tắc nền của system design và những trade-off hay gặp, CAP cho đúng (P không phải lựa chọn) và PACELC, bốn đòn bẩy scalability, tối ưu performance theo p99 và loại tải CPU hay I/O, availability bằng MTBF/MTTR, failover, degrade, SLO và error budget, kèm bài tập tính availability của một chuỗi service.</description><pubDate>Wed, 18 Nov 2026 00:00:00 GMT</pubDate></item><item><title>Observer: từ danh sách listener đến Spring event và outbox</title><link>https://notes.vinhnq.com/posts/observer-pattern-va-spring-event/</link><guid isPermaLink="true">https://notes.vinhnq.com/posts/observer-pattern-va-spring-event/</guid><description>Refactor một lớp quản lý mạng gọi thẳng subscriber sang Observer, chạy thử bốn cách publisher vỡ (listener tự huỷ đăng ký, exception, leak, thread), viết một publisher cứng cáp hơn, rồi chuyển sang Spring: @EventListener, @TransactionalEventListener, và khi nào phải dùng message broker với outbox.</description><pubDate>Wed, 18 Nov 2026 00:00:00 GMT</pubDate></item><item><title>Ôn CCDAK: 40 câu hỏi Kafka đáng nhớ</title><link>https://notes.vinhnq.com/posts/on-thi-ccdak/</link><guid isPermaLink="true">https://notes.vinhnq.com/posts/on-thi-ccdak/</guid><description>Bốn mươi câu hỏi tự viết theo các mảng kiến thức của kỳ thi Confluent Certified Developer for Apache Kafka (cluster và KRaft, producer, consumer, topic, Streams, Schema Registry, Connect), kèm đáp án ngắn, bẫy thường gặp và bảng đổi đáp án thời ZooKeeper sang KRaft.</description><pubDate>Wed, 18 Nov 2026 00:00:00 GMT</pubDate></item><item><title>Optimistic hay pessimistic locking: đo trên bài đặt vé 100 ghế</title><link>https://notes.vinhnq.com/posts/optimistic-va-pessimistic-locking/</link><guid isPermaLink="true">https://notes.vinhnq.com/posts/optimistic-va-pessimistic-locking/</guid><description>Pessimistic, optimistic (version), conditional update và Redis lock kèm fencing token, đo trên bài đặt vé 100 ghế với 400 request đồng thời trên MySQL 8.4: cái nào đúng, cái nào nhanh, cái nào từ chối oan; kèm best practice khoá và bốn điều kiện deadlock.</description><pubDate>Wed, 18 Nov 2026 00:00:00 GMT</pubDate></item><item><title>Performance test: load, stress, spike, soak và coordinated omission</title><link>https://notes.vinhnq.com/posts/performance-test-load-stress-soak/</link><guid isPermaLink="true">https://notes.vinhnq.com/posts/performance-test-load-stress-soak/</guid><description>Phân biệt load, stress, spike, soak và capacity test; đặt mục tiêu từ SLO; mô hình tải open và closed, arrival rate, think time; coordinated omission đo bằng thí nghiệm JDK 21 (p99 2,6 ms thành 975 ms); throughput, percentile, USE/RED; script k6 và Gatling Java DSL; dữ liệu, warm-up, tìm bottleneck, báo cáo kết quả và khi nào dùng JMH.</description><pubDate>Wed, 18 Nov 2026 00:00:00 GMT</pubDate></item><item><title>Phân quyền, SSO và OAuth2: từ RBAC tới OpenID Connect</title><link>https://notes.vinhnq.com/posts/phan-quyen-rbac-sso-va-oauth2/</link><guid isPermaLink="true">https://notes.vinhnq.com/posts/phan-quyen-rbac-sso-va-oauth2/</guid><description>Hai case study phân quyền (RBAC và role + permission) với schema và Spring Security, kiểm tra quyền sở hữu, ABAC/ReBAC, case study SSO bằng cookie domain cha và cách làm chuẩn với IdP + OpenID Connect, OAuth2 khác OIDC thế nào, và lời giải bài tập JWT + permission bằng JDK 21.</description><pubDate>Wed, 18 Nov 2026 00:00:00 GMT</pubDate></item><item><title>Phân tích trade-off như senior: ideality, sweet spot, coupling và nguyên lý tách</title><link>https://notes.vinhnq.com/posts/phan-tich-trade-off-nhu-senior/</link><guid isPermaLink="true">https://notes.vinhnq.com/posts/phan-tich-trade-off-nhu-senior/</guid><description>Chiều đánh giá theo bối cảnh, dimensional vs alternative trade-off, công thức ideality của TRIZ để chấm phương án, chọn sweet spot hay giải trade-off, boring technology, coupling là gốc của trade-off và các nguyên lý tách (sidecar, functional core/imperative shell, CQRS), kèm khung trả lời phỏng vấn system design.</description><pubDate>Wed, 18 Nov 2026 00:00:00 GMT</pubDate></item><item><title>Phân trang và lọc động trong Spring: Pageable, Page, Slice và JPA Specification</title><link>https://notes.vinhnq.com/posts/phan-trang-va-loc-dong-jpa-specification/</link><guid isPermaLink="true">https://notes.vinhnq.com/posts/phan-trang-va-loc-dong-jpa-specification/</guid><description>Phân trang với Pageable và @PageableDefault, Page so với Slice, page bắt đầu từ 0 hay 1, chặn size và sort lạ; lọc sản phẩm theo hãng, mục đích, khoảng giá bằng Specification và JPA metamodel; gộp OR đúng cách, giữ filter trên URL, và các bẫy LIKE, count query, fetch join. Kèm lab Spring Boot 3 chạy bằng test.</description><pubDate>Wed, 18 Nov 2026 00:00:00 GMT</pubDate></item><item><title>Case study: phát hiện gian lận với Kafka và Redis — topic, key, cửa sổ và hỏng hóc</title><link>https://notes.vinhnq.com/posts/phat-hien-gian-lan-voi-kafka-redis/</link><guid isPermaLink="true">https://notes.vinhnq.com/posts/phat-hien-gian-lan-voi-kafka-redis/</guid><description>Góc nhìn Kafka của bài toán phát hiện gian lận cho ví điện tử (luật 100 giao dịch trong 5 phút): topic và key, số partition, cửa sổ trượt theo event time trong Redis, đếm idempotent khi Kafka giao lại, chống bão cảnh báo, dựng lại state bằng replay, scale detector, và so sánh với state store của Kafka Streams.</description><pubDate>Wed, 18 Nov 2026 00:00:00 GMT</pubDate></item><item><title>Phỏng vấn system design: quy trình 4 bước và cách làm rõ yêu cầu</title><link>https://notes.vinhnq.com/posts/phong-van-system-design-quy-trinh-va-yeu-cau/</link><guid isPermaLink="true">https://notes.vinhnq.com/posts/phong-van-system-design-quy-trinh-va-yeu-cau/</guid><description>System design là gì, khác kiến trúc ở đâu, người phỏng vấn chấm gì, bốn bước trong 45 phút, cách chọn tối đa ba functional requirement, biến non-functional requirement thành con số, và cách chứng minh một thiết kế tốt khi chưa code. Kèm lời giải cho Tinder, DoorDash và Binance.</description><pubDate>Wed, 18 Nov 2026 00:00:00 GMT</pubDate></item><item><title>Quy trình data modeling: access pattern, loại bảng, khoá ngoại và table template</title><link>https://notes.vinhnq.com/posts/quy-trinh-data-modeling-va-table-template/</link><guid isPermaLink="true">https://notes.vinhnq.com/posts/quy-trinh-data-modeling-va-table-template/</guid><description>Thiết kế schema bắt đầu từ truy vấn chứ không từ bảng: bốn loại bảng, khi nào phi chuẩn hoá, giữ hay bỏ khoá ngoại (kèm thí nghiệm khoá dòng cha trên PostgreSQL 16 và MySQL 8.4), đặt cột tham chiếu ở đâu và một table template với cột kỹ thuật.</description><pubDate>Wed, 18 Nov 2026 00:00:00 GMT</pubDate></item><item><title>Rate limiting: năm thuật toán, token bucket trên Redis và thiết kế bộ giới hạn phân tán</title><link>https://notes.vinhnq.com/posts/rate-limiting-thuat-toan-va-redis/</link><guid isPermaLink="true">https://notes.vinhnq.com/posts/rate-limiting-thuat-toan-va-redis/</guid><description>Fixed window, sliding log, sliding window counter, leaky bucket và token bucket so trên cùng một ví dụ; vì sao token bucket thường được chọn; cài token bucket bằng Redis Lua, mẹo lấy token theo lô, và các quyết định khi Redis chậm hay chết.</description><pubDate>Wed, 18 Nov 2026 00:00:00 GMT</pubDate></item><item><title>Redis bên trong: vì sao nhanh, lưu dữ liệu thế nào và xoá key hết hạn ra sao</title><link>https://notes.vinhnq.com/posts/redis-ben-trong-vi-sao-nhanh/</link><guid isPermaLink="true">https://notes.vinhnq.com/posts/redis-ben-trong-vi-sao-nhanh/</guid><description>Redis đơn luồng mà vẫn xử lý hàng trăm nghìn lệnh mỗi giây: event loop và I/O multiplexing, io-threads từ bản 6, keyspace là một hash table, encoding nhỏ gọn (listpack, intset, skiplist), SDS, và hai cơ chế xoá key hết hạn. Kèm so sánh với Memcached và những chỗ slide nói chưa đúng.</description><pubDate>Wed, 18 Nov 2026 00:00:00 GMT</pubDate></item><item><title>Redis: chọn cấu trúc dữ liệu cho bài toán thật</title><link>https://notes.vinhnq.com/posts/redis-cau-truc-du-lieu-thuc-te/</link><guid isPermaLink="true">https://notes.vinhnq.com/posts/redis-cau-truc-du-lieu-thuc-te/</guid><description>Hash hay chuỗi JSON cho một object, giỏ hàng bằng hash, hàng đợi bằng list hay stream, set cho like và bạn chung, sorted set cho bảng xếp hạng, và case study hàng đợi trễ tự huỷ cuốc xe bằng ZSET: vì sao cách đọc rồi xoá cho ra 784 lần xử lý trùng trên 2.000 cuốc.</description><pubDate>Wed, 18 Nov 2026 00:00:00 GMT</pubDate></item><item><title>Review code distributed lock bằng Redis: 6 lỗi thường gặp</title><link>https://notes.vinhnq.com/posts/redis-distributed-lock-review/</link><guid isPermaLink="true">https://notes.vinhnq.com/posts/redis-distributed-lock-review/</guid><description>Đọc lại một cài đặt distributed lock bằng Redis từ code mẫu: giá trị khoá hằng số và DEL mù, TTL nhân 1000 hai lần, lấy nhiều khoá song song, unlock bất đồng bộ, vòng retry, và lease hết hạn khi failover. Viết lại cho đúng, fencing token, và khi nào nên dùng lock của database.</description><pubDate>Wed, 18 Nov 2026 00:00:00 GMT</pubDate></item><item><title>Redis: persistence, replication, Sentinel và Cluster</title><link>https://notes.vinhnq.com/posts/redis-persistence-replication-cluster/</link><guid isPermaLink="true">https://notes.vinhnq.com/posts/redis-persistence-replication-cluster/</guid><description>Redis giữ dữ liệu qua restart bằng RDB, AOF hay cả hai; replication bất đồng bộ mất gì khi failover; Sentinel bầu master mới ra sao; Cluster chia 16.384 hash slot, chuyển hướng MOVED/ASK và giới hạn lệnh nhiều key. Kèm cách chọn chế độ triển khai.</description><pubDate>Wed, 18 Nov 2026 00:00:00 GMT</pubDate></item><item><title>ReDoS trong Java: sự cố thật, timeout tự làm và checklist phòng thủ</title><link>https://notes.vinhnq.com/posts/redos-trong-java-su-co-va-phong-thu/</link><guid isPermaLink="true">https://notes.vinhnq.com/posts/redos-trong-java-su-co-va-phong-thu/</guid><description>Hai sự cố ReDoS nổi tiếng (Stack Overflow 2016, Cloudflare 2019) và bề mặt tấn công ở backend Java; cách phòng thủ khi java.util.regex không có timeout: viết pattern không mơ hồ, giới hạn input (và vì sao @Size không đủ), CharSequence có deadline, RE2/J, StackOverflowError với alternation; rồi xét lại từng best practice của slide bằng số đo trên JDK 21.</description><pubDate>Wed, 18 Nov 2026 00:00:00 GMT</pubDate></item><item><title>Refresh token xoay vòng và phân quyền theo permission trong Spring Security</title><link>https://notes.vinhnq.com/posts/refresh-token-xoay-vong-va-phan-quyen-spring/</link><guid isPermaLink="true">https://notes.vinhnq.com/posts/refresh-token-xoay-vong-va-phan-quyen-spring/</guid><description>Thực hành Spring Boot 4: refresh token opaque lưu dạng hash, xoay vòng có phát hiện dùng lại, cookie HttpOnly, logout, dọn token hết hạn; rồi phân quyền: role, authority, permission, quy tắc URL với AuthorizationManager tự viết, @PreAuthorize, và các lỗi gặp khi chạy lab.</description><pubDate>Wed, 18 Nov 2026 00:00:00 GMT</pubDate></item><item><title>Regex qua bài tập: cấu hình mạng, log sang CSV, lookbehind và dòng trùng</title><link>https://notes.vinhnq.com/posts/regex-bai-tap-log-lookbehind-dong-trung/</link><guid isPermaLink="true">https://notes.vinhnq.com/posts/regex-bai-tap-log-lookbehind-dong-trung/</guid><description>Bốn bài regex có lời giải chạy trên JDK 21: tách cấu hình switch bằng named group và nhóm tuỳ chọn, chuyển log ứng dụng thành CSV bằng VS Code, Java, sed và awk, lấy đúng số hộ chiếu bằng lookbehind, và xử lý dòng trùng bằng backreference trước khi chuyển sang công cụ đúng.</description><pubDate>Wed, 18 Nov 2026 00:00:00 GMT</pubDate></item><item><title>Regex: cú pháp, Java API và các bài tập validate cơ bản</title><link>https://notes.vinhnq.com/posts/regex-cu-phap-va-bai-tap/</link><guid isPermaLink="true">https://notes.vinhnq.com/posts/regex-cu-phap-va-bai-tap/</guid><description>Regex cho backend Java: cú pháp cốt lõi (lớp ký tự, quantifier, anchor, group, lookaround, flag) kèm những chỗ slide hay viết sai, Pattern/Matcher, các bẫy của String.replaceAll/split, vì sao &quot;engine regex của Java không tốt&quot; là nhận định sai, và ba bài tập validate: tên file ảnh, số, email.</description><pubDate>Wed, 18 Nov 2026 00:00:00 GMT</pubDate></item><item><title>Regex engine trong Java: backtracking, possessive quantifier và catastrophic backtracking</title><link>https://notes.vinhnq.com/posts/regex-engine-backtracking-va-redos/</link><guid isPermaLink="true">https://notes.vinhnq.com/posts/regex-engine-backtracking-va-redos/</guid><description>Engine regex của Java chạy thế nào (từng ký tự, trái sang phải, backtracking), vì sao car|carpet không khớp carpet, greedy, lazy, possessive và atomic group, engine backtracking khác engine thời gian tuyến tính RE2 ra sao, và số đo catastrophic backtracking thật trên JDK 21: ví dụ nào trong sách đã lỗi thời, pattern nào vẫn nổ.</description><pubDate>Wed, 18 Nov 2026 00:00:00 GMT</pubDate></item><item><title>REST API nâng cao: export bất đồng bộ, Idempotency-Key và tài liệu API</title><link>https://notes.vinhnq.com/posts/rest-api-async-job-va-idempotency-key/</link><guid isPermaLink="true">https://notes.vinhnq.com/posts/rest-api-async-job-va-idempotency-key/</guid><description>Thiết kế REST API ở mức senior, phần 2: case study export file 500 MB bằng async job (polling, webhook có chữ ký, presigned URL), case study request thanh toán bị trùng với Idempotency-Key, response envelope với mã lỗi 6 chữ số, và cách viết tài liệu API cùng API map.</description><pubDate>Wed, 18 Nov 2026 00:00:00 GMT</pubDate></item><item><title>Reverse proxy với Nginx: định tuyến theo path và các header X-Forwarded</title><link>https://notes.vinhnq.com/posts/reverse-proxy-nginx-routing/</link><guid isPermaLink="true">https://notes.vinhnq.com/posts/reverse-proxy-nginx-routing/</guid><description>Dựng một reverse proxy Nginx route /, /api, /blog tới ba service bằng Docker Compose, chạy thử từng request: cách location chọn khối, quy tắc dấu / của proxy_pass, các header X-Forwarded và khi nào được tin chúng, cùng các cấu hình production như timeout, keepalive, buffering, retry.</description><pubDate>Wed, 18 Nov 2026 00:00:00 GMT</pubDate></item><item><title>Sharding trong system design: chọn shard key, bốn case study và resharding</title><link>https://notes.vinhnq.com/posts/sharding-chon-shard-key-va-resharding/</link><guid isPermaLink="true">https://notes.vinhnq.com/posts/sharding-chon-shard-key-va-resharding/</guid><description>Khi nào thật sự cần shard, range vs hash vs consistent hashing, ba tính chất của shard key tốt, bốn case study (đơn hàng, giao dịch thanh toán, metric thiết bị, tin nhắn Discord), ID toàn cục, truy vấn xuyên shard và cách resharding không downtime bằng logical shard.</description><pubDate>Wed, 18 Nov 2026 00:00:00 GMT</pubDate></item><item><title>Spring Boot từ bên trong: auto-configuration, cấu hình, profile và vòng đời khởi động</title><link>https://notes.vinhnq.com/posts/spring-boot-auto-configuration-va-vong-doi/</link><guid isPermaLink="true">https://notes.vinhnq.com/posts/spring-boot-auto-configuration-va-vong-doi/</guid><description>Auto-configuration được tìm và bật thế nào, @Conditional và cơ chế lùi lại, tự viết một auto-config có test, thứ tự ưu tiên cấu hình, @ConfigurationProperties, profile, các pha của SpringApplication.run, seed data và graceful shutdown trên Spring Boot 4.</description><pubDate>Wed, 18 Nov 2026 00:00:00 GMT</pubDate></item><item><title>Spring MVC: DispatcherServlet, controller và view</title><link>https://notes.vinhnq.com/posts/spring-mvc-dispatcherservlet-va-view/</link><guid isPermaLink="true">https://notes.vinhnq.com/posts/spring-mvc-dispatcherservlet-va-view/</guid><description>Đường đi của một request qua DispatcherServlet (HandlerMapping, HandlerAdapter, argument resolver, ViewResolver), @Controller so với @RestController, Model và tên view, redirect, forward và PRG, Thymeleaf so với JSP, file tĩnh, vì sao @EnableWebMvc tắt auto-config của Boot, và bẫy chuỗi &quot;//&quot; với Spring Security 6, có thí nghiệm chạy thật.</description><pubDate>Wed, 18 Nov 2026 00:00:00 GMT</pubDate></item><item><title>Form login với Spring Security: filter chain, UserDetailsService và phân quyền theo role</title><link>https://notes.vinhnq.com/posts/spring-security-form-login/</link><guid isPermaLink="true">https://notes.vinhnq.com/posts/spring-security-form-login/</guid><description>Request đi qua DelegatingFilterProxy, FilterChainProxy và mười mấy filter thế nào; các class tham gia một lần đăng nhập; tự viết UserDetailsService, trang login có CSRF, luật phân quyền, chuyển hướng theo role, logout và trang 403, kèm lab có test.</description><pubDate>Wed, 18 Nov 2026 00:00:00 GMT</pubDate></item><item><title>Spring Security cho REST API: filter chain stateless, đăng nhập và JWT với resource server</title><link>https://notes.vinhnq.com/posts/spring-security-rest-jwt-resource-server/</link><guid isPermaLink="true">https://notes.vinhnq.com/posts/spring-security-rest-jwt-resource-server/</guid><description>Thực hành Spring Boot 4 / Spring Security 7: filter chain cho API stateless, lưu mật khẩu bằng DelegatingPasswordEncoder, endpoint đăng nhập với AuthenticationManager, phát JWT bằng NimbusJwtEncoder, kiểm JWT bằng resource server, đổi claim roles thành ROLE_, trả 401/403 dạng JSON và CORS cho SPA.</description><pubDate>Wed, 18 Nov 2026 00:00:00 GMT</pubDate></item><item><title>Session và remember-me trong Spring: Spring Session JDBC, giới hạn phiên và ba kiểu ghi nhớ đăng nhập</title><link>https://notes.vinhnq.com/posts/spring-session-va-remember-me/</link><guid isPermaLink="true">https://notes.vinhnq.com/posts/spring-session-va-remember-me/</guid><description>Session của Spring Security chứa gì, đổi id khi đăng nhập, timeout, giới hạn số phiên đồng thời, đưa session vào database bằng Spring Session JDBC, lỗi serialize object, so sánh ba kiểu remember-me và đăng xuất mọi thiết bị, kèm lab có test.</description><pubDate>Wed, 18 Nov 2026 00:00:00 GMT</pubDate></item><item><title>SQL chạy thế nào và cách đọc execution plan PostgreSQL</title><link>https://notes.vinhnq.com/posts/sql-chay-the-nao-va-execution-plan/</link><guid isPermaLink="true">https://notes.vinhnq.com/posts/sql-chay-the-nao-va-execution-plan/</guid><description>Một câu SQL đi qua parser, planner, executor ra sao; thứ tự logic của mệnh đề; EXPLAIN ANALYZE và BUFFERS; các kiểu scan; đọc cost, rows, loops; tìm query chậm bằng pg_stat_statements.</description><pubDate>Wed, 18 Nov 2026 00:00:00 GMT</pubDate></item><item><title>Các sự cố cache: avalanche, breakdown, penetration, hot key, big key</title><link>https://notes.vinhnq.com/posts/su-co-cache-avalanche-breakdown-penetration/</link><guid isPermaLink="true">https://notes.vinhnq.com/posts/su-co-cache-avalanche-breakdown-penetration/</guid><description>Sáu sự cố làm cache thành điểm yếu thay vì tấm khiên: cache sập, hàng loạt key hết hạn, key nóng hết hạn, key không tồn tại, key quá nóng, value quá to. Nguyên nhân, cách chữa (jitter, single-flight, null caching, Bloom filter, local cache) và chính sách eviction.</description><pubDate>Wed, 18 Nov 2026 00:00:00 GMT</pubDate></item><item><title>Tài liệu kiến trúc phần 1: arc42, C4 model, runtime/deployment view và docs-as-code</title><link>https://notes.vinhnq.com/posts/tai-lieu-kien-truc-c4-arc42-adr/</link><guid isPermaLink="true">https://notes.vinhnq.com/posts/tai-lieu-kien-truc-c4-arc42-adr/</guid><description>Khi nào đáng viết tài liệu kiến trúc (quy tắc (Cx − Cy) &gt; Cmd), 12 mục của arc42 và một template rút gọn, bốn mức của C4 model, runtime view theo use case kèm nhánh lỗi, deployment view theo môi trường, và cách giữ tài liệu sống bằng docs-as-code.</description><pubDate>Wed, 18 Nov 2026 00:00:00 GMT</pubDate></item><item><title>Tấn công web và OWASP Top 10: MITM, SQL injection, XSS, CSRF, DDoS</title><link>https://notes.vinhnq.com/posts/tan-cong-web-va-owasp-top-10/</link><guid isPermaLink="true">https://notes.vinhnq.com/posts/tan-cong-web-va-owasp-top-10/</guid><description>Năm kiểu tấn công kinh điển nhìn từ phía backend Java: cơ chế, phòng thủ đúng chỗ (mTLS và chống replay, PreparedStatement và whitelist ORDER BY, output encoding và CSP nonce, SameSite và CSRF token, rate limiting), bảng OWASP Top 10 ánh xạ sang Spring Security 6 và một case study review controller.</description><pubDate>Wed, 18 Nov 2026 00:00:00 GMT</pubDate></item><item><title>Template Method hay composition: refactor luồng đặt phòng v0 đến v2</title><link>https://notes.vinhnq.com/posts/template-method-va-composition/</link><guid isPermaLink="true">https://notes.vinhnq.com/posts/template-method-va-composition/</guid><description>Đi qua ba phiên bản luồng đặt phòng homestay: một method transactional làm tất cả, các bước có if theo loại chỗ ở, rồi Template Method với hook. Ba quy tắc giữ Template Method an toàn, các bẫy khi chạy trong Spring (constructor injection, @SneakyThrows, self-invocation), và khi nào chuyển sang composition.</description><pubDate>Wed, 18 Nov 2026 00:00:00 GMT</pubDate></item><item><title>Test Spring Boot: slice test, integration test và Testcontainers</title><link>https://notes.vinhnq.com/posts/test-spring-boot-slice-va-testcontainers/</link><guid isPermaLink="true">https://notes.vinhnq.com/posts/test-spring-boot-slice-va-testcontainers/</guid><description>@WebMvcTest, @DataJpaTest và các slice nạp gì, @SpringBootTest với MockMvc hay server thật, bẫy @Transactional trong test, context caching, Testcontainers với @ServiceConnection, test security bằng JWT thật, và các thay đổi test trong Spring Boot 4, qua lab chạy được.</description><pubDate>Wed, 18 Nov 2026 00:00:00 GMT</pubDate></item><item><title>Thanh toán sau khi tích hợp: IPN tới muộn, đối soát và bảng failure mode</title><link>https://notes.vinhnq.com/posts/thanh-toan-ipn-muon-va-doi-soat/</link><guid isPermaLink="true">https://notes.vinhnq.com/posts/thanh-toan-ipn-muon-va-doi-soat/</guid><description>Phần vận hành của tích hợp cổng thanh toán kiểu VNPay: case study IPN thành công tới sau khi đã nhả chỗ, job truy vấn giao dịch, đối soát sao kê với DB và sổ cái, test trên sandbox theo BDD, và bảng failure mode đầy đủ.</description><pubDate>Wed, 18 Nov 2026 00:00:00 GMT</pubDate></item><item><title>Thiết kế database đặt vé máy bay: quan hệ, ghế trống và overbooking</title><link>https://notes.vinhnq.com/posts/thiet-ke-database-dat-ve-may-bay/</link><guid isPermaLink="true">https://notes.vinhnq.com/posts/thiet-ke-database-dat-ve-may-bay/</guid><description>Case study mô hình dữ liệu hãng bay phần 1: viết quan hệ bằng câu, ER, tiến hoá từ v1 lên v2, dữ liệu tham chiếu, bảng ghế trống theo từng ghế hay bộ đếm, công thức overbooking đúng và index cho các truy vấn chính.</description><pubDate>Wed, 18 Nov 2026 00:00:00 GMT</pubDate></item><item><title>Thiết kế hệ thống chat kiểu Discord: WebSocket gateway, lưu tin nhắn và fan-out cho server lớn</title><link>https://notes.vinhnq.com/posts/thiet-ke-he-thong-chat-discord/</link><guid isPermaLink="true">https://notes.vinhnq.com/posts/thiet-ke-he-thong-chat-discord/</guid><description>Lời giải bài tập về nhà &apos;thiết kế hệ thống nhắn tin như Discord&apos;: yêu cầu, ước lượng có phép tính, WebSocket gateway, data model tin nhắn trên ScyllaDB theo kênh và bucket thời gian, thứ tự bằng Snowflake, giao tin cho server một triệu thành viên, presence, trạng thái đã đọc, kết nối lại và cách trình bày trong 45 phút.</description><pubDate>Wed, 18 Nov 2026 00:00:00 GMT</pubDate></item><item><title>Case study: thiết kế hệ thống liveness cho 1 triệu thiết bị IoT gửi heartbeat</title><link>https://notes.vinhnq.com/posts/thiet-ke-he-thong-liveness-heartbeat/</link><guid isPermaLink="true">https://notes.vinhnq.com/posts/thiet-ke-he-thong-liveness-heartbeat/</guid><description>Bài tập thiết kế hệ thống phát hiện thiết bị mất kết nối: yêu cầu có số, ước lượng 333K heartbeat/s, bốn phương án (cột last_seen, Redis ZSET, timing wheel trong worker theo partition Kafka, delay message), cách chống báo động giả khi consumer bị trễ hay cả vùng mất mạng, và cách trình bày trong 45 phút.</description><pubDate>Wed, 18 Nov 2026 00:00:00 GMT</pubDate></item><item><title>Thiết kế news feed kiểu Threads: push, pull, hybrid và người nổi tiếng</title><link>https://notes.vinhnq.com/posts/thiet-ke-news-feed-threads/</link><guid isPermaLink="true">https://notes.vinhnq.com/posts/thiet-ke-news-feed-threads/</guid><description>Case study mạng xã hội microblogging 500 triệu user: yêu cầu, ước lượng có phép tính (và sửa số liệu sai trong slide), API, data model trên ScyllaDB, so sánh fan-out khi ghi và khi đọc, mô hình lai cho celebrity, theo dõi user hoạt động, bộ đếm reaction, bài trending và cách trình bày trong 45 phút.</description><pubDate>Wed, 18 Nov 2026 00:00:00 GMT</pubDate></item><item><title>REST API nâng cao: method idempotent, URL qua gateway, phân trang và sắp xếp</title><link>https://notes.vinhnq.com/posts/thiet-ke-rest-api-nang-cao/</link><guid isPermaLink="true">https://notes.vinhnq.com/posts/thiet-ke-rest-api-nang-cao/</guid><description>Thiết kế REST API ở mức senior, phần 1: tư duy design-first, safe và idempotent cho đúng, quy ước URL khi route qua API gateway, phân trang offset/cursor/deferred join có số đo thật trên PostgreSQL, whitelist sort và mô hình hoá quan hệ N-N.</description><pubDate>Wed, 18 Nov 2026 00:00:00 GMT</pubDate></item><item><title>Thiết kế URL shortener: sinh mã ngắn, Base62, token range và chuyển hướng</title><link>https://notes.vinhnq.com/posts/thiet-ke-url-shortener/</link><guid isPermaLink="true">https://notes.vinhnq.com/posts/thiet-ke-url-shortener/</guid><description>Case study system design đầy đủ cho dịch vụ rút gọn link kiểu Bitly: yêu cầu, ước lượng có phép tính, API, data model trên ScyllaDB và PostgreSQL, so sánh bốn cách sinh mã, token range không trùng và không đoán được, 301 hay 302, cache, analytics và cách trình bày trong 45 phút.</description><pubDate>Wed, 18 Nov 2026 00:00:00 GMT</pubDate></item><item><title>Tích hợp bên thứ ba: chọn nhà cung cấp, đồng bộ hay bất đồng bộ, webhook và lớp chống ăn mòn</title><link>https://notes.vinhnq.com/posts/tich-hop-api-ben-thu-ba/</link><guid isPermaLink="true">https://notes.vinhnq.com/posts/tich-hop-api-ben-thu-ba/</guid><description>Khuôn chung khi tích hợp cổng thanh toán, SMS, eKYC hay vận chuyển: thứ tự đánh giá yêu cầu, tiêu chí chọn nhà cung cấp, chọn kiểu tích hợp, nhận webhook an toàn, bọc nhà cung cấp sau interface của mình, log và test.</description><pubDate>Wed, 18 Nov 2026 00:00:00 GMT</pubDate></item><item><title>Tích hợp cổng thanh toán kiểu VNPay: redirect, chữ ký và IPN</title><link>https://notes.vinhnq.com/posts/tich-hop-cong-thanh-toan-vnpay/</link><guid isPermaLink="true">https://notes.vinhnq.com/posts/tich-hop-cong-thanh-toan-vnpay/</guid><description>Đi trọn luồng thanh toán redirect từ bước 1 đến 9.2.3: các bên và mức tin cậy, mô hình payment attempt và state machine, ký URL bằng HMAC-SHA512 và các lỗi checksum hay gặp, handler IPN idempotent với mã phản hồi, return URL, và bảo mật.</description><pubDate>Wed, 18 Nov 2026 00:00:00 GMT</pubDate></item><item><title>Timeout, retry, circuit breaker và bulkhead khi gọi bên thứ ba</title><link>https://notes.vinhnq.com/posts/timeout-retry-va-circuit-breaker/</link><guid isPermaLink="true">https://notes.vinhnq.com/posts/timeout-retry-va-circuit-breaker/</guid><description>Giữ cho một bên thứ ba chậm hoặc chết không kéo sập hệ thống: ba loại timeout, retry an toàn với idempotency key, backoff và jitter, retry storm, circuit breaker, bulkhead, fallback theo nghiệp vụ và cấu hình Resilience4j trong Spring Boot 3.</description><pubDate>Wed, 18 Nov 2026 00:00:00 GMT</pubDate></item><item><title>Transaction từ bên trong: WAL, MVCC và undo log</title><link>https://notes.vinhnq.com/posts/transaction-ben-trong-mvcc-undo-log/</link><guid isPermaLink="true">https://notes.vinhnq.com/posts/transaction-ben-trong-mvcc-undo-log/</guid><description>Chạy lại bốn isolation level trên MySQL 8.4 và PostgreSQL 16, đường đi của một lần ghi qua redo log, MVCC của InnoDB (undo log, read view, purge, history list length đo bằng số) so với PostgreSQL (xmin/xmax, dead tuple, VACUUM).</description><pubDate>Wed, 18 Nov 2026 00:00:00 GMT</pubDate></item><item><title>Transaction gây hại: quá lớn, chạy lâu, treo giữa chừng, bị bỏ rơi</title><link>https://notes.vinhnq.com/posts/transaction-gay-hai-va-cach-tim/</link><guid isPermaLink="true">https://notes.vinhnq.com/posts/transaction-gay-hai-va-cach-tim/</guid><description>Bốn kiểu transaction làm chậm hoặc treo database trong production: triệu chứng, truy vấn để tìm ra chúng trên MySQL 8.4 và PostgreSQL 16 (đã chạy thử), cách sửa ở code, ở pool và ở database, kèm các chi tiết hay nhầm về SET TRANSACTION và autocommit.</description><pubDate>Wed, 18 Nov 2026 00:00:00 GMT</pubDate></item><item><title>12-Factor App: 12 nguyên tắc cho ứng dụng chạy trên cloud, áp dụng với Spring Boot và Kubernetes</title><link>https://notes.vinhnq.com/posts/twelve-factor-app/</link><guid isPermaLink="true">https://notes.vinhnq.com/posts/twelve-factor-app/</guid><description>Đi qua 12 yếu tố của 12factor.net với Java 21, Spring Boot 3, Docker và Kubernetes: config qua biến môi trường, build/release/run, process không trạng thái, graceful shutdown có chạy thử với SIGTERM, log ra stdout, migration là admin process, và những chỗ đã lỗi thời sau hơn mười năm.</description><pubDate>Wed, 18 Nov 2026 00:00:00 GMT</pubDate></item><item><title>Unit test với JUnit 5 và Mockito: test quyết định, không test dây nối</title><link>https://notes.vinhnq.com/posts/unit-test-junit-5-va-mockito/</link><guid isPermaLink="true">https://notes.vinhnq.com/posts/unit-test-junit-5-va-mockito/</guid><description>Vì sao developer phải tự viết test, kim tự tháp test và các phản biện, test cái gì ở mức unit, AAA, JUnit 5/6 (@Nested, @ParameterizedTest, AssertJ), Mockito (mock, stub, spy, fake, verify, InOrder, ArgumentCaptor, strict stubs), inject Clock, checklist review test do AI viết và mutation testing.</description><pubDate>Wed, 18 Nov 2026 00:00:00 GMT</pubDate></item><item><title>Ước lượng back-of-the-envelope: con số phải thuộc và cách tính nhanh</title><link>https://notes.vinhnq.com/posts/uoc-luong-back-of-the-envelope/</link><guid isPermaLink="true">https://notes.vinhnq.com/posts/uoc-luong-back-of-the-envelope/</guid><description>Ước lượng trong system design để làm gì, các con số cần thuộc (giây trong ngày, kích thước kiểu dữ liệu, bảng số 9 của availability, latency), mẹo gom luỹ thừa 10, Little&apos;s Law, quy tắc 72, và bài URL shortener tính lại từng bước kèm chỗ slide tính thừa, rồi dùng con số để ra quyết định số server, cache, sharding.</description><pubDate>Wed, 18 Nov 2026 00:00:00 GMT</pubDate></item><item><title>Upload file trong Spring MVC: nhận, kiểm, lưu và trả file an toàn</title><link>https://notes.vinhnq.com/posts/upload-file-spring-mvc/</link><guid isPermaLink="true">https://notes.vinhnq.com/posts/upload-file-spring-mvc/</guid><description>multipart/form-data và MultipartFile, giới hạn kích thước, chọn chỗ lưu (đĩa, database, object storage), năm lỗi của cách lưu file phổ biến, một FileStorageService kiểm magic bytes và chống path traversal, trả file mà không mở đường cho XSS.</description><pubDate>Wed, 18 Nov 2026 00:00:00 GMT</pubDate></item><item><title>Xác thực: Basic, API key, session cookie và JWT</title><link>https://notes.vinhnq.com/posts/xac-thuc-session-cookie-va-jwt/</link><guid isPermaLink="true">https://notes.vinhnq.com/posts/xac-thuc-session-cookie-va-jwt/</guid><description>Basic auth, API key, session cookie với đủ cờ bảo mật, lưu token ở đâu trên trình duyệt, cấu tạo và bẫy của JWT, refresh token xoay vòng, thu hồi token và Spring Security 6.</description><pubDate>Wed, 18 Nov 2026 00:00:00 GMT</pubDate></item><item><title>Lập trình hướng đối tượng: abstract class, interface và thứ tự khởi tạo</title><link>https://notes.vinhnq.com/posts/abstract-class-va-interface/</link><guid isPermaLink="true">https://notes.vinhnq.com/posts/abstract-class-va-interface/</guid><description>Tính trừu tượng với abstract class và interface (default, static, private method, sealed), xung đột default method, thứ tự khởi tạo static/instance/constructor và bẫy gọi method override trong constructor, kèm Lab 06 và bài quản lý khách sạn.</description><pubDate>Tue, 17 Nov 2026 00:00:00 GMT</pubDate></item><item><title>Thực hành thuật toán: đệ quy, sắp xếp và cách khử đệ quy</title><link>https://notes.vinhnq.com/posts/bai-tap-de-quy-va-sap-xep/</link><guid isPermaLink="true">https://notes.vinhnq.com/posts/bai-tap-de-quy-va-sap-xep/</guid><description>Ôn độ phức tạp và các thuật toán sắp xếp, tìm kiếm; phân tích độ phức tạp hàm đệ quy, memoization, khử đệ quy bằng stack tường minh, cùng lời giải bài đệ quy và bài sắp xếp xen kẽ.</description><pubDate>Tue, 17 Nov 2026 00:00:00 GMT</pubDate></item><item><title>Bài tập SQL trên database E-Learning: rating, tiến độ học và review schema</title><link>https://notes.vinhnq.com/posts/bai-tap-sql-e-learning/</link><guid isPermaLink="true">https://notes.vinhnq.com/posts/bai-tap-sql-e-learning/</guid><description>Chín câu SQL trên schema thật của pet project khoá học online (Teacher/Admin tách bảng, rating trên lượt đăng ký, tiến độ START/PROCESSING/DONE), kèm các bẫy fan-out, LEFT JOIN và một bài review schema như review PR.</description><pubDate>Tue, 17 Nov 2026 00:00:00 GMT</pubDate></item><item><title>Thực hành SQL: JOIN, GROUP BY và chuẩn hoá qua 15 câu trên database thư viện</title><link>https://notes.vinhnq.com/posts/bai-tap-sql-join-group-by/</link><guid isPermaLink="true">https://notes.vinhnq.com/posts/bai-tap-sql-join-group-by/</guid><description>Ôn ERD, các loại JOIN, GROUP BY/HAVING, thứ tự thực thi SELECT và chuẩn hoá, rồi giải 15 câu SQL trên database thư viện kèm các bẫy LEFT JOIN, COUNT và điều kiện non-sargable.</description><pubDate>Tue, 17 Nov 2026 00:00:00 GMT</pubDate></item><item><title>Lập trình hướng đối tượng: object bất biến, equals/hashCode và final</title><link>https://notes.vinhnq.com/posts/bat-bien-equals-hashcode-va-final/</link><guid isPermaLink="true">https://notes.vinhnq.com/posts/bat-bien-equals-hashcode-va-final/</guid><description>Cách viết class bất biến và record, defensive copy, hợp đồng toString/equals/hashCode, final ở biến, field, method, class, và vì sao hằng static final bị inline sang class khác, kèm bài tập class phân số.</description><pubDate>Tue, 17 Nov 2026 00:00:00 GMT</pubDate></item><item><title>Java cơ bản: biến, kiểu dữ liệu và ép kiểu</title><link>https://notes.vinhnq.com/posts/bien-va-kieu-du-lieu-java/</link><guid isPermaLink="true">https://notes.vinhnq.com/posts/bien-va-kieu-du-lieu-java/</guid><description>8 kiểu nguyên thuỷ, primitive và reference trong bộ nhớ, wrapper class, quy tắc đặt tên, ép kiểu và tràn số.</description><pubDate>Tue, 17 Nov 2026 00:00:00 GMT</pubDate></item><item><title>Java I/O: byte stream, buffer và serialization</title><link>https://notes.vinhnq.com/posts/byte-stream-va-serialization/</link><guid isPermaLink="true">https://notes.vinhnq.com/posts/byte-stream-va-serialization/</guid><description>InputStream/OutputStream và Reader/Writer, bọc lồng kiểu Decorator, vì sao buffer nhanh, copy file đúng cách, Serializable, serialVersionUID và rủi ro deserialization.</description><pubDate>Tue, 17 Nov 2026 00:00:00 GMT</pubDate></item><item><title>Cấu trúc dữ liệu tuyến tính: Array, Linked List, Stack và Queue</title><link>https://notes.vinhnq.com/posts/cau-truc-du-lieu/</link><guid isPermaLink="true">https://notes.vinhnq.com/posts/cau-truc-du-lieu/</guid><description>Mảng, danh sách liên kết, stack và queue: chúng nằm trong bộ nhớ ra sao, mỗi thao tác tốn bao nhiêu, khi nào chọn cái nào và các lỗi hay gặp khi tự cài đặt.</description><pubDate>Tue, 17 Nov 2026 00:00:00 GMT</pubDate></item><item><title>Cron job: biểu thức cron và @Scheduled trong Spring Boot</title><link>https://notes.vinhnq.com/posts/cron-job/</link><guid isPermaLink="true">https://notes.vinhnq.com/posts/cron-job/</guid><description>Cú pháp cron của Unix, Spring và Quartz khác nhau ra sao, fixedRate vs fixedDelay, các bẫy của @Scheduled: một thread, exception bị nuốt, không chạy bù, nhiều instance với ShedLock, timezone và DST.</description><pubDate>Tue, 17 Nov 2026 00:00:00 GMT</pubDate></item><item><title>Database: bảng, kiểu dữ liệu, khoá chính và SQL cơ bản</title><link>https://notes.vinhnq.com/posts/database/</link><guid isPermaLink="true">https://notes.vinhnq.com/posts/database/</guid><description>Vì sao cần database thay vì file, DBMS là gì, bảng, kiểu dữ liệu, khoá chính, các nhóm lệnh SQL, NULL, và cách thay đổi schema an toàn khi bảng đã lớn.</description><pubDate>Tue, 17 Nov 2026 00:00:00 GMT</pubDate></item><item><title>Database: bài tập thiết kế và truy vấn hệ thống thư viện</title><link>https://notes.vinhnq.com/posts/database-bai-tap-thu-vien/</link><guid isPermaLink="true">https://notes.vinhnq.com/posts/database-bai-tap-thu-vien/</guid><description>Bài tập trọn vẹn: phân tích và sửa đề, vẽ ERD, tạo bảng với ràng buộc đúng, giả lập partial unique index trên MySQL, rồi viết 30 câu truy vấn từ cơ bản đến GROUP BY, EXISTS, ROLLUP.</description><pubDate>Tue, 17 Nov 2026 00:00:00 GMT</pubDate></item><item><title>Database: ERD, khoá ngoại, JOIN và GROUP BY</title><link>https://notes.vinhnq.com/posts/database-erd-join-group-by/</link><guid isPermaLink="true">https://notes.vinhnq.com/posts/database-erd-join-group-by/</guid><description>Thiết kế ERD, cài đặt quan hệ 1-1, 1-n, n-n bằng khoá ngoại, ON DELETE, viết JOIN, GROUP BY, HAVING và hiểu thứ tự thực thi logic của một câu SELECT.</description><pubDate>Tue, 17 Nov 2026 00:00:00 GMT</pubDate></item><item><title>Database: chuẩn hoá dữ liệu 1NF–5NF và phi chuẩn hoá</title><link>https://notes.vinhnq.com/posts/database-phan-2/</link><guid isPermaLink="true">https://notes.vinhnq.com/posts/database-phan-2/</guid><description>Hiểu phụ thuộc hàm, ba loại anomaly, các dạng chuẩn từ 1NF, 2NF, 3NF, BCNF đến 4NF, 5NF, và khi nào nên cố ý phi chuẩn hoá.</description><pubDate>Tue, 17 Nov 2026 00:00:00 GMT</pubDate></item><item><title>Database: index, EXPLAIN, N+1, phân trang và soft delete</title><link>https://notes.vinhnq.com/posts/database-phan-3/</link><guid isPermaLink="true">https://notes.vinhnq.com/posts/database-phan-3/</guid><description>Vì sao một câu SQL đúng vẫn chậm: B+tree, clustered và composite index, covering index, sargable, đọc EXPLAIN, bài toán N+1, phân trang keyset và cái giá của soft delete.</description><pubDate>Tue, 17 Nov 2026 00:00:00 GMT</pubDate></item><item><title>Đệ quy, tìm kiếm nhị phân và các thuật toán thông dụng</title><link>https://notes.vinhnq.com/posts/de-quy-va-tim-kiem-nhi-phan/</link><guid isPermaLink="true">https://notes.vinhnq.com/posts/de-quy-va-tim-kiem-nhi-phan/</guid><description>Đệ quy và call stack trong JVM, memoization, tìm kiếm tuyến tính và nhị phân cùng các bug kinh điển, số nguyên tố, Fibonacci, palindrome, kèm các bài tập đệ quy có lời giải.</description><pubDate>Tue, 17 Nov 2026 00:00:00 GMT</pubDate></item><item><title>Java cơ bản: nhập xuất console và đọc ghi file text</title><link>https://notes.vinhnq.com/posts/doc-ghi-file-java/</link><guid isPermaLink="true">https://notes.vinhnq.com/posts/doc-ghi-file-java/</guid><description>printf, Scanner và bẫy nextLine, đọc ghi file text bằng Scanner, PrintWriter, FileWriter, BufferedReader, try-with-resources và java.nio.file.Files.</description><pubDate>Tue, 17 Nov 2026 00:00:00 GMT</pubDate></item><item><title>Enum ở production: EnumSet, EnumMap, singleton, lưu database và tiến hoá API</title><link>https://notes.vinhnq.com/posts/enum-trong-database-va-api/</link><guid isPermaLink="true">https://notes.vinhnq.com/posts/enum-trong-database-va-api/</guid><description>EnumSet và EnumMap bên trong là gì, enum singleton, lưu enum với JPA (ORDINAL, STRING hay mã ổn định), thêm giá trị enum vào API mà không làm hỏng client, serialization của enum, kèm bài tập phân quyền bằng EnumSet và bitmask.</description><pubDate>Tue, 17 Nov 2026 00:00:00 GMT</pubDate></item><item><title>Enum trong Java: từ hằng số tới class, strategy và switch đủ trường hợp</title><link>https://notes.vinhnq.com/posts/enum-va-nested-class/</link><guid isPermaLink="true">https://notes.vinhnq.com/posts/enum-va-nested-class/</guid><description>Vì sao enum tốt hơn hằng static final, enum là một class (field, constructor, thân riêng từng hằng, strategy), bẫy của valueOf/values/ordinal, switch exhaustive và khi nào chuyển sang sealed interface cộng record.</description><pubDate>Tue, 17 Nov 2026 00:00:00 GMT</pubDate></item><item><title>Exception trong Java: checked/unchecked, try-catch-finally và call stack</title><link>https://notes.vinhnq.com/posts/exception-trong-java/</link><guid isPermaLink="true">https://notes.vinhnq.com/posts/exception-trong-java/</guid><description>Cây kế thừa Throwable, checked vs unchecked, throw/throws, try-catch-finally, try-with-resources, exception lan truyền qua call stack, khi nào nên dùng exception và chi phí của nó.</description><pubDate>Tue, 17 Nov 2026 00:00:00 GMT</pubDate></item><item><title>ExecutorService, thread pool và virtual thread trong Java</title><link>https://notes.vinhnq.com/posts/executorservice-va-virtual-thread/</link><guid isPermaLink="true">https://notes.vinhnq.com/posts/executorservice-va-virtual-thread/</guid><description>ThreadPoolExecutor thật sự hoạt động thế nào, hàng đợi có giới hạn và rejection policy, chọn số thread, tắt pool đúng cách, virtual thread Java 21, pinning và rò rỉ ThreadLocal.</description><pubDate>Tue, 17 Nov 2026 00:00:00 GMT</pubDate></item><item><title>Generics trong Java: generic class, generic method, bounded type và invariance</title><link>https://notes.vinhnq.com/posts/generics-trong-java/</link><guid isPermaLink="true">https://notes.vinhnq.com/posts/generics-trong-java/</guid><description>Generics giải quyết vấn đề gì, cách viết generic class và generic method, quy ước đặt tên, bounded type parameter và vì sao List&lt;Integer&gt; không phải List&lt;Number&gt; trong khi Integer[] lại là Number[].</description><pubDate>Tue, 17 Nov 2026 00:00:00 GMT</pubDate></item><item><title>Generics trong Java: type erasure, raw type và type token</title><link>https://notes.vinhnq.com/posts/generics-type-erasure/</link><guid isPermaLink="true">https://notes.vinhnq.com/posts/generics-type-erasure/</guid><description>Compiler làm gì với generics, hệ quả của type erasure, bridge method, heap pollution và @SafeVarargs, raw type, reifiable type, type token như Jackson TypeReference, và generics với record, sealed interface.</description><pubDate>Tue, 17 Nov 2026 00:00:00 GMT</pubDate></item><item><title>Generics trong Java: wildcard và quy tắc PECS</title><link>https://notes.vinhnq.com/posts/generics-wildcard-va-pecs/</link><guid isPermaLink="true">https://notes.vinhnq.com/posts/generics-wildcard-va-pecs/</guid><description>Unbounded, upper bounded và lower bounded wildcard, quy tắc PECS qua các API trong JDK, wildcard capture, khi nào dùng wildcard thay cho type parameter, kèm Lab 10 InventoryItem có lời giải đầy đủ.</description><pubDate>Tue, 17 Nov 2026 00:00:00 GMT</pubDate></item><item><title>Git: version control, staging area, object model và commit convention</title><link>https://notes.vinhnq.com/posts/git/</link><guid isPermaLink="true">https://notes.vinhnq.com/posts/git/</guid><description>Version control là gì, ba vùng của Git, object model (blob, tree, commit), Conventional Commits, commit hygiene và cách hoàn tác trong ngày bằng restore, amend.</description><pubDate>Tue, 17 Nov 2026 00:00:00 GMT</pubDate></item><item><title>Git: branching, merge vs rebase, conflict, reflog và quy trình Pull Request</title><link>https://notes.vinhnq.com/posts/git-branching-merge-rebase/</link><guid isPermaLink="true">https://notes.vinhnq.com/posts/git-branching-merge-rebase/</guid><description>Branch và fast-forward, giải quyết merge conflict, merge hay rebase, interactive rebase, cherry-pick, revert, reset, Git Flow vs trunk-based, reflog, bisect và quy trình review qua Pull Request.</description><pubDate>Tue, 17 Nov 2026 00:00:00 GMT</pubDate></item><item><title>Git: remote, clone, tag phiên bản và thói quen push hằng ngày</title><link>https://notes.vinhnq.com/posts/git-remote-tag-va-backup/</link><guid isPermaLink="true">https://notes.vinhnq.com/posts/git-remote-tag-va-backup/</guid><description>Làm việc với remote và GitHub, clone repo sang máy mới, thói quen commit và push để Git thật sự là bản backup, Semantic Versioning và đánh dấu release bằng tag.</description><pubDate>Tue, 17 Nov 2026 00:00:00 GMT</pubDate></item><item><title>Java cơ bản: Hello World, biên dịch, ba loại lỗi và bài tập đầu tiên</title><link>https://notes.vinhnq.com/posts/hello-world-va-ba-loai-loi-java/</link><guid isPermaLink="true">https://notes.vinhnq.com/posts/hello-world-va-ba-loai-loi-java/</guid><description>Chương trình Java đầu tiên, cú pháp tối thiểu, javac và java, lỗi biên dịch/runtime/logic, cùng bộ bài tập chỉ dùng lệnh in và biểu thức.</description><pubDate>Tue, 17 Nov 2026 00:00:00 GMT</pubDate></item><item><title>IoC và Dependency Injection: Spring container hoạt động thế nào</title><link>https://notes.vinhnq.com/posts/ioc-va-dependency-injection/</link><guid isPermaLink="true">https://notes.vinhnq.com/posts/ioc-va-dependency-injection/</guid><description>Từ coupling, IoC, DI đến ApplicationContext, các cách tạo và inject bean, vòng đời bean, scope, proxy và circular dependency trong Spring.</description><pubDate>Tue, 17 Nov 2026 00:00:00 GMT</pubDate></item><item><title>Java cơ bản: JVM, JDK, các bản LTS và Java được dùng ở đâu</title><link>https://notes.vinhnq.com/posts/java-co-ban/</link><guid isPermaLink="true">https://notes.vinhnq.com/posts/java-co-ban/</guid><description>Java chạy như thế nào, JDK/JRE/JVM, các bản LTS từ 8 tới 25, Java được dùng ở đâu và cách cài môi trường.</description><pubDate>Tue, 17 Nov 2026 00:00:00 GMT</pubDate></item><item><title>Java cơ bản: vòng lặp, hàm, call stack và pass-by-value</title><link>https://notes.vinhnq.com/posts/java-co-ban-phan-2/</link><guid isPermaLink="true">https://notes.vinhnq.com/posts/java-co-ban-phan-2/</guid><description>while, do-while, for, break/continue và nhãn, method, call stack, phạm vi biến và vì sao Java luôn truyền tham trị.</description><pubDate>Tue, 17 Nov 2026 00:00:00 GMT</pubDate></item><item><title>Bên trong Java Collections: ArrayList, LinkedList, ArrayDeque và HashMap</title><link>https://notes.vinhnq.com/posts/java-collections-ben-trong-jdk/</link><guid isPermaLink="true">https://notes.vinhnq.com/posts/java-collections-ben-trong-jdk/</guid><description>ArrayList tăng kích thước thế nào, vì sao LinkedList và Stack hiếm khi là lựa chọn đúng, HashMap băm, treeify và resize ra sao, Sequenced Collections của Java 21, bảng Big-O tổng hợp, và tự viết lại ArrayList, LinkedList.</description><pubDate>Tue, 17 Nov 2026 00:00:00 GMT</pubDate></item><item><title>Java Collections: List, Set và Map</title><link>https://notes.vinhnq.com/posts/java-collections-list-set-map/</link><guid isPermaLink="true">https://notes.vinhnq.com/posts/java-collections-list-set-map/</guid><description>Phần Java Collections Framework dùng hằng ngày: chọn List, Set, Map hay Queue, ArrayList, lớp tiện ích Collections, HashSet và cách nó phát hiện phần tử trùng, HashMap cùng các method Map hiện đại như merge, computeIfAbsent.</description><pubDate>Tue, 17 Nov 2026 00:00:00 GMT</pubDate></item><item><title>ORM và JPA: ánh xạ schema E-Learning, DTO và vòng lặp JSON</title><link>https://notes.vinhnq.com/posts/jpa-anh-xa-e-learning-va-json/</link><guid isPermaLink="true">https://notes.vinhnq.com/posts/jpa-anh-xa-e-learning-va-json/</guid><description>Dựng lại schema E-Learning của khoá (user, full_name, course, chapter, lesson, user_course, user_course_lesson, address), ánh xạ từng quan hệ sang JPA với @EmbeddedId và FK ghép, rồi xử lý vòng lặp JSON khi trả entity hai chiều: @JsonIgnore, @JsonBackReference, @JsonIdentityInfo và DTO.</description><pubDate>Tue, 17 Nov 2026 00:00:00 GMT</pubDate></item><item><title>ORM và JPA: persistence context, dirty checking và N+1</title><link>https://notes.vinhnq.com/posts/jpa-persistence-context-va-n-plus-1/</link><guid isPermaLink="true">https://notes.vinhnq.com/posts/jpa-persistence-context-va-n-plus-1/</guid><description>Persistence context và cache cấp 1, bốn trạng thái của entity, persist và merge, dirty checking và flush, lazy/eager, bài toán N+1 và bốn cách chữa: fetch join, entity graph, batch fetching, DTO projection.</description><pubDate>Tue, 17 Nov 2026 00:00:00 GMT</pubDate></item><item><title>ORM và JPA: quan hệ entity 1-1, 1-n, n-n và mappedBy</title><link>https://notes.vinhnq.com/posts/jpa-quan-he-va-persistence-context/</link><guid isPermaLink="true">https://notes.vinhnq.com/posts/jpa-quan-he-va-persistence-context/</guid><description>Ánh xạ quan hệ 1-1, 1-n, n-n trong JPA: đặt khoá ngoại ở đâu, owning side và mappedBy, @MapsId, cascade và orphanRemoval, Set thay vì List cho @ManyToMany, và khi nào cần entity trung gian riêng.</description><pubDate>Tue, 17 Nov 2026 00:00:00 GMT</pubDate></item><item><title>Lập trình hướng đối tượng: kế thừa, đóng gói và đa hình</title><link>https://notes.vinhnq.com/posts/ke-thua-dong-goi-va-da-hinh/</link><guid isPermaLink="true">https://notes.vinhnq.com/posts/ke-thua-dong-goi-va-da-hinh/</guid><description>Kế thừa với extends và super, vì sao ưu tiên composition, đóng gói thật sự, overloading và overriding, dynamic dispatch, upcast/downcast và pattern matching instanceof, kèm Lab 05 Person → Employee → Manager.</description><pubDate>Tue, 17 Nov 2026 00:00:00 GMT</pubDate></item><item><title>Lập trình hướng đối tượng: class, object, constructor, static và access modifier</title><link>https://notes.vinhnq.com/posts/lap-trinh-huong-doi-tuong/</link><guid isPermaLink="true">https://notes.vinhnq.com/posts/lap-trinh-huong-doi-tuong/</guid><description>Class và object, constructor và this, static, package và import, access modifier, kèm bài tập class Student và Lab 04 về đóng gói và quyền truy cập giữa các package.</description><pubDate>Tue, 17 Nov 2026 00:00:00 GMT</pubDate></item><item><title>Lập trình hướng đối tượng: UML class diagram và 6 quan hệ giữa các class</title><link>https://notes.vinhnq.com/posts/lap-trinh-huong-doi-tuong-phan-2/</link><guid isPermaLink="true">https://notes.vinhnq.com/posts/lap-trinh-huong-doi-tuong-phan-2/</guid><description>Đọc và vẽ UML class diagram, 6 quan hệ giữa các class (kế thừa, triển khai, composition, aggregation, association, dependency) và cách viết chúng bằng code.</description><pubDate>Tue, 17 Nov 2026 00:00:00 GMT</pubDate></item><item><title>Java cơ bản: mảng và chuỗi</title><link>https://notes.vinhnq.com/posts/mang-va-chuoi-java/</link><guid isPermaLink="true">https://notes.vinhnq.com/posts/mang-va-chuoi-java/</guid><description>Mảng một chiều, hai chiều, răng cưa, các tiện ích của Arrays, các method String hay dùng, so sánh chuỗi và StringBuilder.</description><pubDate>Tue, 17 Nov 2026 00:00:00 GMT</pubDate></item><item><title>Nested class trong Java: static nested, inner, local, anonymous class và lambda</title><link>https://notes.vinhnq.com/posts/nested-class-va-lambda/</link><guid isPermaLink="true">https://notes.vinhnq.com/posts/nested-class-va-lambda/</guid><description>Bốn loại nested class và khi nào dùng loại nào, tham chiếu ẩn tới outer gây rò rỉ bộ nhớ, effectively final, anonymous class khác lambda thế nào, record thay nested class, kèm Lab 07 đầy đủ, builder và bài tìm rò rỉ bộ nhớ.</description><pubDate>Tue, 17 Nov 2026 00:00:00 GMT</pubDate></item><item><title>ORM và JPA: JDBC, Hibernate, entity và repository</title><link>https://notes.vinhnq.com/posts/orm-va-jpa/</link><guid isPermaLink="true">https://notes.vinhnq.com/posts/orm-va-jpa/</guid><description>Vì sao cần ORM, JDBC, JPA, Hibernate và Spring Data JPA là gì, cách định nghĩa entity, repository, service, cấu hình connection pool, quản lý schema bằng Flyway và equals/hashCode cho entity.</description><pubDate>Tue, 17 Nov 2026 00:00:00 GMT</pubDate></item><item><title>ORM và JPA: JPQL, native query, @Transactional và locking</title><link>https://notes.vinhnq.com/posts/orm-va-jpa-phan-2/</link><guid isPermaLink="true">https://notes.vinhnq.com/posts/orm-va-jpa-phan-2/</guid><description>Giới hạn của derived query, JPQL và native query với @Query và @Modifying, truy vấn động, các cạm bẫy của @Transactional, optimistic và pessimistic locking, open-session-in-view.</description><pubDate>Tue, 17 Nov 2026 00:00:00 GMT</pubDate></item><item><title>Ví dụ đặt phòng khách sạn: API, chống overbooking và kế hoạch triển khai Spring Boot</title><link>https://notes.vinhnq.com/posts/pet-project-api-va-trien-khai/</link><guid isPermaLink="true">https://notes.vinhnq.com/posts/pet-project-api-va-trien-khai/</guid><description>Danh sách API, chống overbooking bằng update có điều kiện, idempotency key, cấu trúc package, controller, service, truy vấn tìm kiếm, các mốc triển khai và chiến lược test với Testcontainers.</description><pubDate>Tue, 17 Nov 2026 00:00:00 GMT</pubDate></item><item><title>Phân tích yêu cầu và thiết kế dữ liệu qua ví dụ đặt phòng khách sạn</title><link>https://notes.vinhnq.com/posts/pet-project-thuc-hanh/</link><guid isPermaLink="true">https://notes.vinhnq.com/posts/pet-project-thuc-hanh/</guid><description>Dùng ví dụ mẫu đặt phòng khách sạn của giảng viên để biến đề bài mơ hồ thành đặc tả kiểm chứng được (câu hỏi mở, phạm vi, BDD, NFR có số đo), rồi thiết kế entity, review thiết kế, ERD và DDL, nhìn từ góc độ senior, rồi áp dụng cho pet project E-Learning.</description><pubDate>Tue, 17 Nov 2026 00:00:00 GMT</pubDate></item><item><title>Ôn tập phỏng vấn backend: Java Core, Spring Boot và web</title><link>https://notes.vinhnq.com/posts/pet-project-thuc-hanh-phan-2/</link><guid isPermaLink="true">https://notes.vinhnq.com/posts/pet-project-thuc-hanh-phan-2/</guid><description>Ôn nhanh các câu hỏi nền tảng trước phỏng vấn: JDK/JRE/JVM, bốn tính chất OOP, == và equals, final, overload và override, truyền tham trị, cấu trúc dữ liệu, IoC/DI, tham số URL và HTTPS.</description><pubDate>Tue, 17 Nov 2026 00:00:00 GMT</pubDate></item><item><title>Concurrency trong Java: race condition, volatile và deadlock</title><link>https://notes.vinhnq.com/posts/race-condition-volatile-deadlock/</link><guid isPermaLink="true">https://notes.vinhnq.com/posts/race-condition-volatile-deadlock/</guid><description>Vì sao count++ mất lượt cộng, synchronized vs AtomicInteger vs LongAdder, visibility và happens-before với volatile, deadlock: phát hiện bằng thread dump và phòng tránh.</description><pubDate>Tue, 17 Nov 2026 00:00:00 GMT</pubDate></item><item><title>REST API: nguyên tắc REST, quy ước thiết kế API và cấu trúc dự án Spring Boot</title><link>https://notes.vinhnq.com/posts/thiet-ke-rest-api-spring-boot/</link><guid isPermaLink="true">https://notes.vinhnq.com/posts/thiet-ke-rest-api-spring-boot/</guid><description>Spring Boot là gì, sáu ràng buộc của REST, quy ước URL, phân trang, versioning, format lỗi, cache HTTP, so sánh với gRPC/GraphQL và cách tổ chức một dự án Spring Boot.</description><pubDate>Tue, 17 Nov 2026 00:00:00 GMT</pubDate></item><item><title>Thread trong Java: tạo thread, vòng đời và interrupt</title><link>https://notes.vinhnq.com/posts/thread-va-concurrency-co-ban/</link><guid isPermaLink="true">https://notes.vinhnq.com/posts/thread-va-concurrency-co-ban/</guid><description>Process và thread, concurrency và parallelism, Thread/Runnable/Callable, start vs run, 6 trạng thái của thread, sleep/join và cách dừng thread bằng interrupt.</description><pubDate>Tue, 17 Nov 2026 00:00:00 GMT</pubDate></item><item><title>Thuật toán cơ bản: Big-O và ba thuật toán sắp xếp O(n²)</title><link>https://notes.vinhnq.com/posts/thuat-toan-co-ban/</link><guid isPermaLink="true">https://notes.vinhnq.com/posts/thuat-toan-co-ban/</guid><description>Cách đo độ phức tạp bằng Big-O, cách đọc độ phức tạp từ vòng lặp, phép thử nhân đôi dữ liệu, và ba thuật toán sắp xếp insertion, bubble, selection: chạy thế nào, stable hay không, khi nào còn dùng.</description><pubDate>Tue, 17 Nov 2026 00:00:00 GMT</pubDate></item><item><title>Thuật toán cơ bản: Merge sort, Quick sort và cách Java thực sự sắp xếp</title><link>https://notes.vinhnq.com/posts/thuat-toan-co-ban-phan-2/</link><guid isPermaLink="true">https://notes.vinhnq.com/posts/thuat-toan-co-ban-phan-2/</guid><description>Hai thuật toán chia để trị O(n log n), cách chống worst case của quick sort, và vì sao Arrays.sort dùng dual-pivot quicksort cho primitive nhưng TimSort cho object.</description><pubDate>Tue, 17 Nov 2026 00:00:00 GMT</pubDate></item><item><title>Java cơ bản: toán tử, if và switch</title><link>https://notes.vinhnq.com/posts/toan-tu-va-re-nhanh-java/</link><guid isPermaLink="true">https://notes.vinhnq.com/posts/toan-tu-va-re-nhanh-java/</guid><description>Hệ nhị phân và bù hai, toán tử số học, so sánh, logic, bit, tiền tố/hậu tố, thứ tự ưu tiên, if/else, ba ngôi, switch cổ điển, switch expression và pattern matching.</description><pubDate>Tue, 17 Nov 2026 00:00:00 GMT</pubDate></item><item><title>Database: transaction, isolation level và locking</title><link>https://notes.vinhnq.com/posts/transaction-isolation-locking/</link><guid isPermaLink="true">https://notes.vinhnq.com/posts/transaction-isolation-locking/</guid><description>Vì sao code đúng vẫn sai khi có nhiều request đồng thời: ACID và cách InnoDB làm, isolation level và các anomaly (lost update, write skew), lock, gap lock, deadlock, MVCC, SKIP LOCKED và retry đúng cách.</description><pubDate>Tue, 17 Nov 2026 00:00:00 GMT</pubDate></item><item><title>Java Collections: TreeSet, TreeMap, Comparator và Iterator</title><link>https://notes.vinhnq.com/posts/treemap-comparator-va-iterator/</link><guid isPermaLink="true">https://notes.vinhnq.com/posts/treemap-comparator-va-iterator/</guid><description>Dữ liệu có thứ tự trong Java: TreeSet/TreeMap và NavigableMap cho truy vấn gần nhất, theo khoảng; Comparable và Comparator; Iterator, ListIterator, fail-fast và các loại iterator đồng thời; kèm Lab 09 có lời giải.</description><pubDate>Tue, 17 Nov 2026 00:00:00 GMT</pubDate></item><item><title>Web và HTTP: Internet, HTTPS, method, status code và các phiên bản HTTP</title><link>https://notes.vinhnq.com/posts/web-va-rest-api/</link><guid isPermaLink="true">https://notes.vinhnq.com/posts/web-va-rest-api/</guid><description>Internet và web hoạt động ra sao, HTTPS và TLS, ngữ nghĩa HTTP method, idempotency, status code, HTTP/2, HTTP/3, timeout và CORS.</description><pubDate>Tue, 17 Nov 2026 00:00:00 GMT</pubDate></item><item><title>Lập trình hướng đối tượng: wrapper class, BigInteger/BigDecimal và String</title><link>https://notes.vinhnq.com/posts/wrapper-bigdecimal-va-string/</link><guid isPermaLink="true">https://notes.vinhnq.com/posts/wrapper-bigdecimal-va-string/</guid><description>Wrapper class và autoboxing, API chung của wrapper số, constructor wrapper đã deprecated, BigInteger/BigDecimal để tính tiền, String bất biến và StringBuilder.</description><pubDate>Tue, 17 Nov 2026 00:00:00 GMT</pubDate></item><item><title>Cron job dọn dữ liệu: xoá theo batch, archive và partition</title><link>https://notes.vinhnq.com/posts/xoa-du-lieu-cu-an-toan/</link><guid isPermaLink="true">https://notes.vinhnq.com/posts/xoa-du-lieu-cu-an-toan/</guid><description>Vì sao một câu DELETE hàng triệu dòng làm hại database, xoá theo batch mỗi batch một transaction, archive trước khi xoá, DROP PARTITION, quan sát job và một job purge hoàn chỉnh với Spring.</description><pubDate>Tue, 17 Nov 2026 00:00:00 GMT</pubDate></item><item><title>Custom exception và xử lý lỗi tập trung trong Spring Boot: @RestControllerAdvice, ProblemDetail, validation</title><link>https://notes.vinhnq.com/posts/xu-ly-loi-spring-boot/</link><guid isPermaLink="true">https://notes.vinhnq.com/posts/xu-ly-loi-spring-boot/</guid><description>Thiết kế custom exception với mã lỗi, vì sao không try-catch ở mọi controller, @RestControllerAdvice và @ExceptionHandler, ProblemDetail (RFC 9457), thiết kế error response và validate DTO với Bean Validation.</description><pubDate>Tue, 17 Nov 2026 00:00:00 GMT</pubDate></item><item><title>Bắt đầu ghi chép</title><link>https://notes.vinhnq.com/posts/bat-dau-ghi-chep/</link><guid isPermaLink="true">https://notes.vinhnq.com/posts/bat-dau-ghi-chep/</guid><description>Blog này là nơi mình lưu lại những gì học được mỗi ngày.</description><pubDate>Mon, 09 Nov 2026 00:00:00 GMT</pubDate></item></channel></rss>