01Go vs Node.js
Goroutine + channel/mutex เหมาะกับ parallel work และ service โหลดสูง
Event Loop เด่นด้าน I/O orchestration; CPU-heavy ต้องแยก worker
Compile-time type, binary เดียว, startup เร็ว และ resource คาดเดาง่าย
TypeScript ตรวจตอน build แต่ runtime ยังเป็น JavaScript และมี GC/runtime behavior ของ V8
โครงสร้างเรียบและ explicit แต่อาจเขียน boilerplate มากกว่า
แชร์ภาษา frontend/backend และ ecosystem กว้าง ทำ feature ได้เร็ว
Core service, high concurrency, CPU work และ latency-sensitive path
BFF, API orchestration, realtime I/O และทีม fullstack TypeScript
02Vue vs React / Next.js
Single File Component, template และ reactivity ที่ framework จัดให้
UI เป็น function ของ state; Next เพิ่ม server rendering และ routing convention
Proxy/ref tracking รู้ dependency และ update เฉพาะจุด
State update ทำให้ component render ใหม่ แล้ว reconciliation หา DOM diff
Convention ชัด แยก template/style/script และเริ่มต้นได้เร็ว
แกน React เล็ก แต่ ecosystem และ server/client model ต้องตัดสินใจมากกว่า
ทีมชอบ convention ชัด ต้องการ productivity และ gradual adoption
ทีม React แข็ง ต้องการ ecosystem หรือ full-stack rendering model ของ Next
03PostgreSQL vs MongoDB
Relation, constraints และ normalized schema
Document aggregate ที่ embed ข้อมูลตาม access pattern
Join และ ad-hoc query ข้าม entity แข็งแรง
อ่าน document ทั้งก้อนเร็ว แต่ relation ซับซ้อนต้องออกแบบเพิ่ม
ธุรกรรม, integrity สูง และข้อมูลสัมพันธ์กันมาก
Schema เปลี่ยนเร็วและ aggregate มีขอบเขตชัด
เมื่อไรควรใช้ PostgreSQL
เลือกเมื่อข้อมูลมี relation และ constraint สำคัญ, ต้องทำ transaction หลาย row/table, มี ad-hoc reporting หรือ query ด้วย join/aggregate หลายรูปแบบ เช่น payment, ledger, order และระบบงานธุรกิจที่ integrity สำคัญกว่าความยืดหยุ่นของ document
เมื่อไรควรใช้ MongoDB
เลือกเมื่อข้อมูลเป็น document aggregate ที่มี lifecycle เดียวกัน, อ่านเขียนทั้งก้อน, schema แตกต่างตามชนิดและเปลี่ยนเร็ว หรือ workload ต้องกระจาย document จำนวนมาก โดย query pattern รู้ล่วงหน้า เช่น content/catalog, event metadata หรือ profile ที่มี nested data
04Kafka vs RabbitMQ
Distributed log เก็บ event ตาม retention และ replay ได้
Message broker ส่งงานผ่าน exchange และ queue
Consumer group อ่าน partition และดูแล offset
Ack message แล้ว broker ลบออกจาก queue
Event streaming, analytics pipeline และหลาย consumer ที่ replay อิสระ
Work queue, complex routing, retry และ per-message lifecycle
เลือก Apache Kafka เมื่อไร
ใช้เมื่อ event ต้องถูกเก็บตาม retention และ replay ได้, มี consumer หลายกลุ่มอ่าน stream เดียวกันอย่างอิสระ, ต้องการ throughput สูง หรือทำ event streaming, CDC, analytics pipeline และ materialized views โดยยอมรับ ordering ระดับ partition
เลือก RabbitMQ เมื่อไร
ใช้เมื่อโจทย์คือส่งงานไป worker, routing ผ่าน exchange/routing key, per-message acknowledgement, priority, TTL, retry/DLX และต้องการควบคุมจำนวนงานที่ consumer รับผ่าน prefetch โดยปกติ message ที่ ack แล้วไม่ถูกเก็บไว้เพื่อ replay แบบ event log
อ่านเอกสารทางการ: Apache Kafka Design ↗อ่านเอกสารทางการ: RabbitMQ Reliability Guide ↗
05กรอบตัดสินใจที่ใช้ได้กับทุก Stack
- 1Workload
I/O หรือ CPU-heavy? Latency และ throughput เป้าหมายเท่าไร?
- 2Team
ทีมเชี่ยวชาญอะไร? Hiring, onboarding และ bus factor เป็นอย่างไร?
- 3Ecosystem
Library สำคัญ, observability, deployment และ security tooling พร้อมหรือไม่?
- 4Lifecycle cost
ใครดูแลเมื่อเกิด incident? Upgrade และ migration แพงแค่ไหน?