1---2name: tech-matrix3description: Reference document for monopoly tech-matrix.4risk: safe5reports-to: monopoly6metadata:7 source: https://skillmd.com/skills/jantoniofc/tech-matrix8---910# MONOPOLY — Technology Decision Matrix1112## Table of Contents131. Database Selection142. Cache Selection153. Message Queue / Event Streaming164. API Protocol175. Search Engine186. Object Storage197. Container Orchestration208. Load Balancer219. Observability Stack2210. CDN2324---2526## 1. Database Selection2728### Relational (SQL)2930| Database | Best For | Avoid When | Scale Ceiling |31|----------|----------|------------|---------------|32| **PostgreSQL** | Complex queries, JSONB, GIS, strong consistency, most default use cases | Ultra-high write throughput (>100K writes/s) | ~10TB single node; use Citus for horizontal |33| **MySQL / MariaDB** | Read-heavy apps, legacy systems, WordPress/Drupal ecosystem | Complex queries, full ACID at scale | ~10TB; use Vitess for sharding |34| **CockroachDB** | Global distributed SQL, geo-partitioning, multi-region | Simple single-region apps (overkill) | Petabyte-scale |35| **PlanetScale** | MySQL-compatible, serverless, branch-based workflow | Complex JOINs (foreign keys removed by design) | Very high — Vitess based |36| **Amazon Aurora** | AWS-native apps, managed PostgreSQL/MySQL, high availability | Non-AWS environments | Up to 128TB, 15 replicas |3738### NoSQL3940| Database | Best For | Avoid When | Scale Ceiling |41|----------|----------|------------|---------------|42| **MongoDB** | Flexible schema, document model, prototyping | Financial transactions requiring ACID | Petabyte-scale with sharding |43| **DynamoDB** | Key-value at massive scale, AWS-native, serverless, predictable latency | Complex queries, ad-hoc analytics, JOINs | Unlimited (AWS-managed) |44| **Cassandra** | Write-heavy, time-series, wide-column, geographically distributed | Read-heavy with complex queries | Petabyte-scale; used at Apple, Netflix |45| **Redis** | Cache, sessions, leaderboards, pub/sub, rate limiting | Primary data store for complex models | ~1TB per node; cluster for more |46| **Elasticsearch** | Full-text search, log aggregation, analytics | Primary database (durability risk) | Petabyte-scale with clusters |47| **InfluxDB** | Time-series metrics, IoT, monitoring data | General-purpose data | Very high write throughput |48| **Neo4j** | Graph data, social networks, recommendation engines, fraud detection | Non-graph data (overhead not worth it) | Billions of nodes |4950### Decision Framework5152```53Is your data relational (joins, foreign keys, transactions)?54 YES → Start with PostgreSQL55 NO → Continue below5657Is your primary access pattern key-value?58 YES, need extreme scale → DynamoDB or Cassandra59 YES, need speed/cache → Redis6061Is your data document-shaped (nested, flexible schema)?62 YES → MongoDB6364Is it time-series (metrics, logs, IoT)?65 YES → InfluxDB or TimescaleDB6667Is it graph (relationships are the data)?68 YES → Neo4j6970Is it search?71 YES → Elasticsearch / OpenSearch72```7374---7576## 2. Cache Selection7778| Technology | Best For | Max Single Node | Cluster Support |79|------------|----------|----------------|----------------|80| **Redis** | Sessions, leaderboards, pub/sub, complex data structures, Lua scripting | ~1TB RAM | Yes (Redis Cluster, Redis Sentinel) |81| **Memcached** | Simple key-value, multi-threaded, large object cache | ~64GB RAM | Yes (client-side sharding) |82| **Varnish** | HTTP reverse proxy cache, full-page caching | RAM bound | Limited |83| **CloudFront / CDN** | Static assets, edge caching globally | N/A (distributed) | Built-in global distribution |8485**Default recommendation: Redis** — more features, better ecosystem, active development.8687Use **Memcached** only when: you need multi-threading for CPU-bound caching workloads and don't need data structures beyond string.8889---9091## 3. Message Queue / Event Streaming9293| Technology | Model | Best For | Throughput | Retention |94|------------|-------|----------|------------|-----------|95| **Apache Kafka** | Log-based streaming | Event sourcing, high-throughput pipelines, replay, audit | Millions msg/s | Days to forever |96| **RabbitMQ** | AMQP message broker | Task queues, RPC, routing, fanout | 50K–100K msg/s | Until consumed |97| **AWS SQS** | Managed queue | AWS-native, simple task queue, serverless | Very high (managed) | Up to 14 days |98| **AWS SNS** | Pub/sub notification | Fan-out to many subscribers (email, SMS, Lambda, SQS) | Very high (managed) | No retention |99| **Google Pub/Sub** | Managed streaming | GCP-native, global, serverless | Very high (managed) | Up to 7 days |100| **Redis Pub/Sub** | In-memory pub/sub | Real-time notifications, low latency, fire-and-forget | Very high | None (no retention) |101| **NATS** | Lightweight messaging | IoT, microservices, low latency | Very high | JetStream adds retention |102103### Decision Matrix104105```106Need event replay / audit trail?107 YES → Kafka or Kinesis108109Need simple task queue with retries and DLQ?110 AWS shop → SQS111 Self-hosted → RabbitMQ112113Need real-time pub/sub with no persistence?114 Redis Pub/Sub or NATS115116Need fan-out to multiple consumers?117 Kafka (consumer groups) or SNS → SQS fan-out118119Need < 5 minutes guaranteed delivery, AWS-native, zero ops?120 SQS121122Volume > 1 million messages/second?123 Kafka (self-hosted) or Kinesis (managed)124```125126---127128## 4. API Protocol129130| Protocol | Best For | Avoid When |131|----------|----------|------------|132| **REST (HTTP/JSON)** | Public APIs, CRUD, browser clients, simplicity | Strict typing required; high-performance internal services |133| **GraphQL** | Complex client data requirements, mobile (reduce over-fetching), BFF pattern | Simple CRUD; not worth the complexity |134| **gRPC (HTTP/2 + Protobuf)** | Internal microservice communication, low latency, strict contracts, streaming | Public browser APIs (needs gRPC-web) |135| **WebSocket** | Real-time bidirectional (chat, live dashboards, multiplayer games) | One-way server push (use SSE instead) |136| **SSE (Server-Sent Events)** | Server → client push (notifications, live feeds) | Bidirectional communication |137| **GraphQL Subscriptions** | Real-time with GraphQL schema consistency | Simple push scenarios |138139**Default recommendation:**140- External / public: **REST**141- Internal service-to-service: **gRPC**142- Real-time features: **WebSocket** or **SSE**143144---145146## 5. Search Engine147148| Technology | Best For | Avoid When |149|------------|----------|------------|150| **Elasticsearch** | Full-text search, log analytics (ELK), complex aggregations | Simple lookups; operational overhead is high |151| **OpenSearch** | AWS-native Elasticsearch alternative | Non-AWS preferred setups |152| **Typesense** | Simple, fast full-text search, typo tolerance, easy ops | Complex aggregations at massive scale |153| **Algolia** | Managed search-as-a-service, fast setup, great UI | High volume (expensive); self-hosted preference |154| **Meilisearch** | Self-hosted, developer-friendly, fast relevancy | Enterprise-scale analytics |155| **PostgreSQL FTS** | Basic full-text search, already using PostgreSQL | High relevancy requirements or large datasets |156157**Rule of thumb:** Use PostgreSQL FTS under 1M documents. Move to Typesense or Elasticsearch above that.158159---160161## 6. Object Storage162163| Service | Best For | Egress Cost |164|---------|----------|------------|165| **AWS S3** | AWS-native apps, de facto standard, massive ecosystem | $0.09/GB (expensive) |166| **Cloudflare R2** | S3-compatible, **zero egress cost**, global | $0.00 egress |167| **GCS** | GCP-native | $0.12/GB |168| **Azure Blob** | Azure-native | $0.087/GB |169| **Backblaze B2** | Cost-sensitive, S3-compatible | Free with Cloudflare |170| **MinIO** | Self-hosted S3-compatible | Self-managed |171172**Cost optimization tip:** Use **Cloudflare R2** for user-facing media delivery (zero egress). Use **S3** for internal/AWS-integrated storage.173174---175176## 7. Container Orchestration177178| Technology | Best For | Avoid When |179|------------|----------|------------|180| **Kubernetes (K8s)** | Large teams, complex deployments, multi-cloud, full control | Small teams (ops overhead is very high) |181| **AWS ECS + Fargate** | AWS-native, serverless containers, simpler than K8s | Multi-cloud or K8s ecosystem tools needed |182| **AWS EKS** | Managed K8s on AWS, best of both | Small teams; Fargate may be enough |183| **GKE (Google)** | Best managed K8s, GCP-native, Autopilot mode | Non-GCP environments |184| **Docker Compose** | Local dev, small single-server deployments | Production at any meaningful scale |185| **Nomad** | HashiCorp ecosystem, simpler than K8s, multi-workload | K8s ecosystem tools required |186187**Startup default:** ECS + Fargate (zero cluster management).188**Scale default:** EKS or GKE once team > 5 engineers or services > 10.189190---191192## 8. Load Balancer193194| Technology | Layer | Best For |195|------------|-------|----------|196| **AWS ALB** | L7 (HTTP/HTTPS) | AWS apps, path-based routing, WebSocket, HTTP/2 |197| **AWS NLB** | L4 (TCP/UDP) | Ultra-low latency, static IP, non-HTTP protocols |198| **GCP GLB** | L7 global | GCP apps, global anycast, single IP worldwide |199| **Nginx** | L4/L7 | Self-hosted, reverse proxy, flexible config |200| **HAProxy** | L4/L7 | High performance self-hosted, advanced routing |201| **Cloudflare** | L7 global + DDoS | DDoS protection + CDN + load balancing combined |202| **Traefik** | L7 | Kubernetes-native, automatic SSL, service discovery |203204---205206## 9. Observability Stack207208### Metrics209| Tool | Best For |210|------|----------|211| **Prometheus + Grafana** | Self-hosted, open-source, Kubernetes-native |212| **Datadog** | Managed, APM + infra + logs unified, expensive |213| **CloudWatch** | AWS-native, zero setup, integrated with AWS services |214| **New Relic** | APM-focused, good for application-level insights |215216### Logging217| Tool | Best For |218|------|----------|219| **ELK Stack** (Elasticsearch + Logstash + Kibana) | Self-hosted, powerful, high volume |220| **Loki + Grafana** | Lightweight, Kubernetes-native, cheap |221| **Splunk** | Enterprise, compliance, expensive |222| **AWS CloudWatch Logs** | AWS-native, zero setup |223| **Datadog Logs** | Unified with metrics, expensive |224225### Distributed Tracing226| Tool | Best For |227|------|----------|228| **Jaeger** | Open-source, Kubernetes-native, OpenTelemetry |229| **Zipkin** | Simple, lightweight, good integrations |230| **AWS X-Ray** | AWS-native, integrates with Lambda, ECS |231| **Datadog APM** | Managed, unified with metrics and logs |232| **Honeycomb** | High-cardinality event-based observability |233234**Recommended open-source stack:** Prometheus + Grafana + Loki + Jaeger (all integrate via OpenTelemetry)235**Recommended managed stack:** Datadog (expensive but unified) or Grafana Cloud236237---238239## 10. CDN240241| Technology | Best For | Edge Locations |242|------------|----------|----------------|243| **Cloudflare** | DDoS protection + CDN + DNS, best free tier, edge workers | 300+ |244| **AWS CloudFront** | AWS-native, deep S3 and API GW integration | 450+ |245| **Akamai** | Enterprise, highest performance, expensive | 4000+ |246| **Fastly** | Real-time purging, streaming, VCL customization | 90+ |247| **Vercel Edge / Netlify** | Jamstack, frontend-first, zero config | 100+ |248249**Default recommendation:** Cloudflare for most use cases (best value, DDoS included, free SSL, Workers for edge compute).250251---252253## Scale Benchmarks Quick Reference254255| Technology | Write Throughput | Read Throughput | Notes |256|------------|-----------------|----------------|-------|257| PostgreSQL (single) | ~10K writes/s | ~50K reads/s | With connection pooling |258| PostgreSQL (replicas) | ~10K writes/s | ~200K reads/s | 4 replicas |259| MySQL (single) | ~15K writes/s | ~60K reads/s | |260| Cassandra | ~1M writes/s | ~500K reads/s | 10-node cluster |261| Redis | ~1M ops/s | ~1M ops/s | Single node in-memory |262| Kafka | ~1M msgs/s | ~1M msgs/s | Per partition |263| Elasticsearch | ~50K docs/s | ~10K queries/s | Per node |264| MongoDB | ~50K writes/s | ~100K reads/s | Per replica set |265266*All benchmarks are approximate and depend heavily on hardware, payload size, and query complexity.*267268269## Limitations270- This is a reference document and may not cover all edge cases. Always verify architectures before production.