TL;DR — Redash can be turned into a robust, enterprise‑grade analytics platform by separating query execution, using container orchestration (Kubernetes or Docker Swarm), and applying a handful of visualization best‑practices such as data source caching, row‑level security, and asynchronous query handling.
Enterprises that rely on ad‑hoc SQL dashboards often start with a single‑node Redash instance and quickly hit limits: query latency spikes, credential sprawl, and brittle upgrades. This post walks through the core components of Redash’s architecture, shows how to deploy it on modern infrastructure, and distills production‑ready patterns that keep dashboards fast, secure, and maintainable at scale.
Architecture Overview
Redash’s architecture is intentionally modular. Understanding the moving parts helps you design a system that can grow from a handful of users to tens of thousands.
Core Services
| Service | Responsibility | Typical Scaling Technique |
|---|---|---|
| Web UI | Serves HTML/JS, handles authentication, stores user preferences. | Horizontal pods behind a load balancer; stateless. |
| Worker | Pulls query jobs from Redis, executes them via the appropriate data source driver, writes results back to PostgreSQL. | Autoscale based on queue depth; can be sharded per data source type. |
| PostgreSQL | Stores dashboards, query definitions, results cache, and user metadata. | Primary‑replica setup with read replicas for UI queries. |
| Redis | Simple in‑memory queue for job dispatch and short‑lived result caching. | Cluster mode for high availability. |
| Data Source Connectors | Native drivers (Postgres, MySQL, Snowflake, BigQuery, etc.) that run inside the worker process. | No separate service; scale workers instead. |
Note: The official Redash docs describe this architecture in detail: Redash Architecture Overview.
Why Separate Query Execution?
Running queries inside the web process would block user requests. By offloading to workers you gain:
- Back‑pressure handling – Redis queues smooth spikes.
- Resource isolation – Workers can be provisioned with more CPU/RAM for heavy analytics.
- Fault tolerance – A crashed worker does not affect the UI.
Data Flow Diagram (textual)
User → Load Balancer → Web UI → PostgreSQL (metadata)
↘
→ Redis (job queue) → Worker → Data Source → Result → PostgreSQL (cache) → Web UI → Browser
Deployment Strategies
Enterprises have three common deployment footprints: Docker Compose, Kubernetes, and Managed Cloud Marketplace. We’ll focus on Docker Compose for quick‑start labs and Kubernetes for production.
1. Docker Compose (Local / Small Team)
A minimal docker-compose.yml that mirrors the architecture:
version: "3.8"
services:
postgres:
image: postgres:15-alpine
environment:
POSTGRES_USER: redash
POSTGRES_PASSWORD: redash_pass
POSTGRES_DB: redash
volumes:
- pgdata:/var/lib/postgresql/data
redis:
image: redis:7-alpine
command: ["redis-server", "--appendonly", "yes"]
server:
image: redash/redash:10.1.0
command: server
env_file: .env
depends_on:
- postgres
- redis
ports:
- "5000:5000"
scheduler:
image: redash/redash:10.1.0
command: scheduler
env_file: .env
depends_on:
- postgres
- redis
worker:
image: redash/redash:10.1.0
command: worker
env_file: .env
depends_on:
- postgres
- redis
volumes:
pgdata:
Pros: One‑click setup, great for demos.
Cons: No built‑in HA, limited scaling.
2. Kubernetes (Production)
Kubernetes gives you the elasticity Redash needs. Below is a trimmed helm values snippet; you can also use the official chart from the Redash community.
# values.yaml
replicaCount: 3 # Web UI
worker:
replicaCount: 4
postgresql:
enabled: true
postgresqlUsername: redash
postgresqlPassword: REDACTED
postgresqlDatabase: redash
redis:
architecture: standalone
auth:
enabled: false
service:
type: LoadBalancer
port: 80
resources:
limits:
cpu: "500m"
memory: "512Mi"
requests:
cpu: "250m"
memory: "256Mi"
Deploy with:
helm repo add redash https://helm.redash.io
helm install my-redash redash/redash -f values.yaml
Production‑grade Add‑ons
| Add‑on | Reason | Example |
|---|---|---|
| PostgreSQL read replica | Offload UI reads from the primary. | helm install pg-replica bitnami/postgresql --set readReplicas.replicaCount=2 |
| Redis Cluster | Avoid single‑point failure; supports sharding. | helm install redis-cluster bitnami/redis-cluster |
| External Secrets | Keep DB passwords out of Helm values. | kubectl create secret generic redash-db-secret --from-literal=postgresql-password=$(aws secretsmanager get-secret-value --secret-id redash-db --query SecretString --output text) |
3. Managed Marketplace (AWS/GCP)
Both AWS Marketplace and GCP Marketplace offer a “Redash on Kubernetes” offering that provisions the entire stack with a click. The managed version bundles:
- EKS or GKE cluster with auto‑scaling node groups.
- Amazon RDS (Postgres) with Multi‑AZ.
- Amazon ElastiCache (Redis) with automatic failover.
While convenient, you still need to apply the production patterns described later (caching, row‑level security, etc.) because the managed service only handles the infrastructure.
Production‑Ready Visualization Patterns
A dashboard is only as useful as the data it shows. Below are patterns that keep visualizations performant and secure.
Pattern 1 – Result Caching with TTL
Redash stores query results in PostgreSQL, but you can explicitly set a Cache TTL per query. For high‑frequency metrics (e.g., daily active users), a 5‑minute TTL reduces load on the source warehouse.
# Example: Setting cache ttl via Redash API (Python)
import requests
API_KEY = "YOUR_REDASH_API_KEY"
QUERY_ID = 42
payload = {"ttl": 300} # seconds
resp = requests.post(
f"https://redash.example.com/api/queries/{QUERY_ID}/refresh",
json=payload,
headers={"Authorization": f"Key {API_KEY}"}
)
print(resp.status_code)
Why it matters: A 10‑second query against Snowflake can become a 0.2‑second UI response when cached, improving user experience and cutting cost.
Pattern 2 – Asynchronous Query Execution
Long‑running queries (e.g., >30 seconds) should be marked asynchronous. The UI shows a spinner while the worker processes the job in the background. Enable this per‑data‑source in the Redash admin UI: Settings → Data Sources → Enable Async.
Operational tip: Monitor the Redis queue length (redis-cli LLEN redash:queries) and scale workers accordingly. Alert when queue depth exceeds a threshold (e.g., 100).
Pattern 3 – Row‑Level Security (RLS) at the Data Source
Instead of trying to enforce security in Redash, push it down to the warehouse. For Postgres:
-- Enable RLS on the sales table
ALTER TABLE sales ENABLE ROW LEVEL SECURITY;
-- Policy for the sales_analytics role
CREATE POLICY sales_region_policy ON sales
USING (region = current_setting('app.current_region'));
Then, in Redash, set the user attribute app.current_region via a Parameter that is auto‑filled from the logged‑in user’s profile. This keeps the UI simple while guaranteeing that users never see other regions’ data.
Pattern 4 – Parameterized Queries with Type Safety
Redash supports Jinja templating. Use explicit type casting to avoid SQL injection and improve plan reuse.
SELECT *
FROM orders
WHERE order_date >= '{{ start_date | date("YYYY-MM-DD") }}'
AND order_date < '{{ end_date | date("YYYY-MM-DD") }}'
AND status = {{ status | int }};
datefilter guarantees ISO format.intfilter forces numeric conversion.
Pattern 5 – Dashboard Versioning & CI/CD
Treat dashboard JSON as code. Store it in a Git repo and apply changes via the Redash API in a CI pipeline.
# Bash snippet for CI: update a dashboard
curl -X POST "https://redash.example.com/api/dashboards" \
-H "Authorization: Key $REDASH_API_KEY" \
-H "Content-Type: application/json" \
-d @dashboard.json
Combine with GitHub Actions:
name: Deploy Redash Dashboards
on:
push:
paths:
- 'dashboards/**.json'
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Deploy
run: |
for f in dashboards/*.json; do
curl -X POST "https://redash.example.com/api/dashboards" \
-H "Authorization: Key ${{ secrets.REDASH_API_KEY }}" \
-H "Content-Type: application/json" \
-d @"$f"
done
Benefits: audit trail, rollback, and consistent environments across dev/stage/prod.
Patterns in Production
Beyond visualization, production teams must address reliability, observability, and security holistically.
Observability Stack
- Metrics: Export Redash internal metrics via the built‑in Prometheus endpoint (
/metrics). Scrape them with a Prometheus server and create alerts forredash_worker_queue_depthorredash_query_duration_seconds. - Logs: Forward container logs to a centralized system (e.g., Loki, CloudWatch). Include the request ID (
X-Request-ID) to trace a user’s journey from UI to query execution. - Tracing: Enable OpenTelemetry in the worker process to see latency across data source drivers. This is especially useful for multi‑cloud warehouses.
Security Hardening Checklist
| Item | Recommended Setting |
|---|---|
| TLS termination | Use a dedicated Ingress controller (NGINX or Envoy) with certificates from Let’s Encrypt or corporate PKI. |
| Database credentials | Store in Kubernetes Secrets or external vault (AWS Secrets Manager, HashiCorp Vault). |
| Redis auth | Enable requirepass and configure Redash to read the password from an env var (REDIS_PASSWORD). |
| SAML / SSO | Prefer SAML 2.0 or OIDC over native password auth; Redash supports both out‑of‑the‑box. |
| Network policies | Restrict worker pods to only talk to allowed data source IP ranges. |
Disaster Recovery
- PostgreSQL backups – Use logical backups (
pg_dumpall) nightly and point‑in‑time recovery (PITR) via WAL archiving. - Redis persistence – Enable AOF (Append‑Only File) and schedule snapshot uploads to S3.
- Infrastructure as Code – Keep Helm charts and Terraform modules versioned; a single
terraform applycan spin up a fresh environment in minutes.
Key Takeaways
- Redash’s modular design (Web UI, Worker, PostgreSQL, Redis) lets you scale each component independently.
- Deploy with Docker Compose for proof‑of‑concept, but move to Kubernetes for HA, autoscaling, and seamless upgrades.
- Production‑ready patterns—result caching, async execution, RLS at the source, typed parameters, and CI‑driven dashboard versioning—dramatically improve performance and governance.
- Pair Redash with a robust observability stack (Prometheus, Loki, OpenTelemetry) and enforce security via TLS, secrets management, and network policies.
- Treat dashboards as code: store JSON in Git, deploy via API, and you gain auditability, rollback, and consistent environments across teams.