1---2name: "tech-matrix"3description: "Reference document for monopoly tech-matrix. Use when working with tech matrix."4source: "community_canonical"5risk: "unknown"6license: "not_declared_upstream"7metadata:8 source: https://skillmd.com/skills/revrebel/tech-matrix9---1011# MONOPOLY — Technology Decision Matrix1213## When to Use14- Use this skill when the task matches this description: Reference document for monopoly tech-matrix.1516## Table of Contents171. Database Selection182. Cache Selection193. Message Queue / Event Streaming204. API Protocol215. Search Engine226. Object Storage237. Container Orchestration248. Load Balancer259. Observability Stack2610. CDN2728---2930## 1. Database Selection3132### Relational (SQL)3334| Database | Best For | Avoid When | Scale Ceiling |35|----------|----------|------------|---------------|36| **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 |37| **MySQL / MariaDB** | Read-heavy apps, legacy systems, WordPress/Drupal ecosystem | Complex queries, full ACID at scale | ~10TB; use Vitess for sharding |38| **CockroachDB** | Global distributed SQL, geo-partitioning, multi-region | Simple single-region apps (overkill) | Petabyte-scale |39| **PlanetScale** | MySQL-compatible, serverless, branch-based workflow | Complex JOINs (foreign keys removed by design) | Very high — Vitess based |40| **Amazon Aurora** | AWS-native apps, managed PostgreSQL/MySQL, high availability | Non-AWS environments | Up to 128TB, 15 replicas |4142### NoSQL4344| Database | Best For | Avoid When | Scale Ceiling |45|----------|----------|------------|---------------|46| **MongoDB** | Flexible schema, document model, prototyping | Financial transactions requiring ACID | Petabyte-scale with sharding |47| **DynamoDB** | Key-value at massive scale, AWS-native, serverless, predictable latency | Complex queries, ad-hoc analytics, JOINs | Unlimited (AWS-managed) |48| **Cassandra** | Write-heavy, time-series, wide-column, geographically distributed | Read-heavy with complex queries | Petabyte-scale; used at Apple, Netflix |49| **Redis** | Cache, sessions, leaderboards, pub/sub, rate limiting | Primary data store for complex models | ~1TB per node; cluster for more |50| **Elasticsearch** | Full-text search, log aggregation, analytics | Primary database (durability risk) | Petabyte-scale with clusters |51| **InfluxDB** | Time-series metrics, IoT, monitoring data | General-purpose data | Very high write throughput |52| **Neo4j** | Graph data, social networks, recommendation engines, fraud detection | Non-graph data (overhead not worth it) | Billions of nodes |5354### Decision Framework5556```57Is your data relational (joins, foreign keys, transactions)?58 YES → Start with PostgreSQL59 NO → Continue below6061Is your primary access pattern key-value?62 YES, need extreme scale → DynamoDB or Cassandra63 YES, need speed/cache → Redis6465Is your data document-shaped (nested, flexible schema)?66 YES → MongoDB6768Is it time-series (metrics, logs, IoT)?69 YES → InfluxDB or TimescaleDB7071Is it graph (relationships are the data)?72 YES → Neo4j7374Is it search?75 YES → Elasticsearch / OpenSearch76```7778---7980## 2. Cache Selection8182| Technology | Best For | Max Single Node | Cluster Support |83|------------|----------|----------------|----------------|84| **Redis** | Sessions, leaderboards, pub/sub, complex data structures, Lua scripting | ~1TB RAM | Yes (Redis Cluster, Redis Sentinel) |85| **Memcached** | Simple key-value, multi-threaded, large object cache | ~64GB RAM | Yes (client-side sharding) |86| **Varnish** | HTTP reverse proxy cache, full-page caching | RAM bound | Limited |87| **CloudFront / CDN** | Static assets, edge caching globally | N/A (distributed) | Built-in global distribution |8889**Default recommendation: Redis** — more features, better ecosystem, active development.9091Use **Memcached** only when: you need multi-threading for CPU-bound caching workloads and don't need data structures beyond string.9293---9495## 3. Message Queue / Event Streaming9697| Technology | Model | Best For | Throughput | Retention |98|------------|-------|----------|------------|-----------|99| **Apache Kafka** | Log-based streaming | Event sourcing, high-throughput pipelines, replay, audit | Millions msg/s | Days to forever |100| **RabbitMQ** | AMQP message broker | Task queues, RPC, routing, fanout | 50K–100K msg/s | Until consumed |101| **AWS SQS** | Managed queue | AWS-native, simple task queue, serverless | Very high (managed) | Up to 14 days |102| **AWS SNS** | Pub/sub notification | Fan-out to many subscribers (email, SMS, Lambda, SQS) | Very high (managed) | No retention |103| **Google Pub/Sub** | Managed streaming | GCP-native, global, serverless | Very high (managed) | Up to 7 days |104| **Redis Pub/Sub** | In-memory pub/sub | Real-time notifications, low latency, fire-and-forget | Very high | None (no retention) |105| **NATS** | Lightweight messaging | IoT, microservices, low latency | Very high | JetStream adds retention |106107### Decision Matrix108109```110Need event replay / audit trail?111 YES → Kafka or Kinesis112113Need simple task queue with retries and DLQ?114 AWS shop → SQS115 Self-hosted → RabbitMQ116117Need real-time pub/sub with no persistence?118 Redis Pub/Sub or NATS119120Need fan-out to multiple consumers?121 Kafka (consumer groups) or SNS → SQS fan-out122123Need < 5 minutes guaranteed delivery, AWS-native, zero ops?124 SQS125126Volume > 1 million messages/second?127 Kafka (self-hosted) or Kinesis (managed)128```129130---131132## 4. API Protocol133134| Protocol | Best For | Avoid When |135|----------|----------|------------|136| **REST (HTTP/JSON)** | Public APIs, CRUD, browser clients, simplicity | Strict typing required; high-performance internal services |137| **GraphQL** | Complex client data requirements, mobile (reduce over-fetching), BFF pattern | Simple CRUD; not worth the complexity |138| **gRPC (HTTP/2 + Protobuf)** | Internal microservice communication, low latency, strict contracts, streaming | Public browser APIs (needs gRPC-web) |139| **WebSocket** | Real-time bidirectional (chat, live dashboards, multiplayer games) | One-way server push (use SSE instead) |140| **SSE (Server-Sent Events)** | Server → client push (notifications, live feeds) | Bidirectional communication |141| **GraphQL Subscriptions** | Real-time with GraphQL schema consistency | Simple push scenarios |142143**Default recommendation:**144- External / public: **REST**145- Internal service-to-service: **gRPC**146- Real-time features: **WebSocket** or **SSE**147148---149150## 5. Search Engine151152| Technology | Best For | Avoid When |153|------------|----------|------------|154| **Elasticsearch** | Full-text search, log analytics (ELK), complex aggregations | Simple lookups; operational overhead is high |155| **OpenSearch** | AWS-native Elasticsearch alternative | Non-AWS preferred setups |156| **Typesense** | Simple, fast full-text search, typo tolerance, easy ops | Complex aggregations at massive scale |157| **Algolia** | Managed search-as-a-service, fast setup, great UI | High volume (expensive); self-hosted preference |158| **Meilisearch** | Self-hosted, developer-friendly, fast relevancy | Enterprise-scale analytics |159| **PostgreSQL FTS** | Basic full-text search, already using PostgreSQL | High relevancy requirements or large datasets |160161**Rule of thumb:** Use PostgreSQL FTS under 1M documents. Move to Typesense or Elasticsearch above that.162163---164165## 6. Object Storage166167| Service | Best For | Egress Cost |168|---------|----------|------------|169| **AWS S3** | AWS-native apps, de facto standard, massive ecosystem | $0.09/GB (expensive) |170| **Cloudflare R2** | S3-compatible, **zero egress cost**, global | $0.00 egress |171| **GCS** | GCP-native | $0.12/GB |172| **Azure Blob** | Azure-native | $0.087/GB |173| **Backblaze B2** | Cost-sensitive, S3-compatible | Free with Cloudflare |174| **MinIO** | Self-hosted S3-compatible | Self-managed |175176**Cost optimization tip:** Use **Cloudflare R2** for user-facing media delivery (zero egress). Use **S3** for internal/AWS-integrated storage.177178---179180## 7. Container Orchestration181182| Technology | Best For | Avoid When |183|------------|----------|------------|184| **Kubernetes (K8s)** | Large teams, complex deployments, multi-cloud, full control | Small teams (ops overhead is very high) |185| **AWS ECS + Fargate** | AWS-native, serverless containers, simpler than K8s | Multi-cloud or K8s ecosystem tools needed |186| **AWS EKS** | Managed K8s on AWS, best of both | Small teams; Fargate may be enough |187| **GKE (Google)** | Best managed K8s, GCP-native, Autopilot mode | Non-GCP environments |188| **Docker Compose** | Local dev, small single-server deployments | Production at any meaningful scale |189| **Nomad** | HashiCorp ecosystem, simpler than K8s, multi-workload | K8s ecosystem tools required |190191**Startup default:** ECS + Fargate (zero cluster management).192**Scale default:** EKS or GKE once team > 5 engineers or services > 10.193194---195196## 8. Load Balancer197198| Technology | Layer | Best For |199|------------|-------|----------|200| **AWS ALB** | L7 (HTTP/HTTPS) | AWS apps, path-based routing, WebSocket, HTTP/2 |201| **AWS NLB** | L4 (TCP/UDP) | Ultra-low latency, static IP, non-HTTP protocols |202| **GCP GLB** | L7 global | GCP apps, global anycast, single IP worldwide |203| **Nginx** | L4/L7 | Self-hosted, reverse proxy, flexible config |204| **HAProxy** | L4/L7 | High performance self-hosted, advanced routing |205| **Cloudflare** | L7 global + DDoS | DDoS protection + CDN + load balancing combined |206| **Traefik** | L7 | Kubernetes-native, automatic SSL, service discovery |207208---209210## 9. Observability Stack211212### Metrics213| Tool | Best For |214|------|----------|215| **Prometheus + Grafana** | Self-hosted, open-source, Kubernetes-native |216| **Datadog** | Managed, APM + infra + logs unified, expensive |217| **CloudWatch** | AWS-native, zero setup, integrated with AWS services |218| **New Relic** | APM-focused, good for application-level insights |219220### Logging221| Tool | Best For |222|------|----------|223| **ELK Stack** (Elasticsearch + Logstash + Kibana) | Self-hosted, powerful, high volume |224| **Loki + Grafana** | Lightweight, Kubernetes-native, cheap |225| **Splunk** | Enterprise, compliance, expensive |226| **AWS CloudWatch Logs** | AWS-native, zero setup |227| **Datadog Logs** | Unified with metrics, expensive |228229### Distributed Tracing230| Tool | Best For |231|------|----------|232| **Jaeger** | Open-source, Kubernetes-native, OpenTelemetry |233| **Zipkin** | Simple, lightweight, good integrations |234| **AWS X-Ray** | AWS-native, integrates with Lambda, ECS |235| **Datadog APM** | Managed, unified with metrics and logs |236| **Honeycomb** | High-cardinality event-based observability |237238**Recommended open-source stack:** Prometheus + Grafana + Loki + Jaeger (all integrate via OpenTelemetry)239**Recommended managed stack:** Datadog (expensive but unified) or Grafana Cloud240241---242243## 10. CDN244245| Technology | Best For | Edge Locations |246|------------|----------|----------------|247| **Cloudflare** | DDoS protection + CDN + DNS, best free tier, edge workers | 300+ |248| **AWS CloudFront** | AWS-native, deep S3 and API GW integration | 450+ |249| **Akamai** | Enterprise, highest performance, expensive | 4000+ |250| **Fastly** | Real-time purging, streaming, VCL customization | 90+ |251| **Vercel Edge / Netlify** | Jamstack, frontend-first, zero config | 100+ |252253**Default recommendation:** Cloudflare for most use cases (best value, DDoS included, free SSL, Workers for edge compute).254255---256257## Scale Benchmarks Quick Reference258259| Technology | Write Throughput | Read Throughput | Notes |260|------------|-----------------|----------------|-------|261| PostgreSQL (single) | ~10K writes/s | ~50K reads/s | With connection pooling |262| PostgreSQL (replicas) | ~10K writes/s | ~200K reads/s | 4 replicas |263| MySQL (single) | ~15K writes/s | ~60K reads/s | |264| Cassandra | ~1M writes/s | ~500K reads/s | 10-node cluster |265| Redis | ~1M ops/s | ~1M ops/s | Single node in-memory |266| Kafka | ~1M msgs/s | ~1M msgs/s | Per partition |267| Elasticsearch | ~50K docs/s | ~10K queries/s | Per node |268| MongoDB | ~50K writes/s | ~100K reads/s | Per replica set |269270*All benchmarks are approximate and depend heavily on hardware, payload size, and query complexity.*271272273## Limitations274- This is a reference document and may not cover all edge cases. Always verify architectures before production.