Database / BetterDB Interview questions
1. What is BetterDB Monitor?
BetterDB Monitor is the flagship product from BetterDB Inc., built as an observability layer for Valkey and Redis. It persists data that these servers normally throw away – slowlogs, command patterns, client activity, and anomaly signals – so teams can look back at what happened at 3a...
2. What is BetterDB for Valkey?
BetterDB for Valkey is a free, MIT-licensed VS Code extension (also installable in Cursor and VSCodium) for browsing and managing Valkey or Redis databases directly from the editor. It gives you a connection manager, a key browser with wildcard filtering, type-specific CRUD editors, a built-in CL...
3. What are the two Docker image variants for BetterDB Monitor?
BetterDB Monitor publishes two multi-arch (linux/amd64, linux/arm64) Docker image variants. Tag What it is latest, X.Y.Z-no-ai Default image with every monitoring feature, without the experimental local-LLM AI Helper's dependencies (~360MB compressed) X.Y.Z Adds the experimental AI Helper (bring ...
4. What is the purpose of the BetterDB MCP server?
The @betterdb/mcp package exposes 60 tools over the Model Context Protocol so AI coding assistants like Claude Code or Cursor can query monitoring data – slowlogs, metrics, cluster state, client analytics – through natural-language tool calls instead of switching over to the web UI or...
5. What are the storage backends supported by BetterDB Monitor?
BetterDB Monitor persists audit trail, analytics, captures, and anomaly data to one of four pluggable backends, chosen with the STORAGE_TYPE environment variable. Which one to pick depends mostly on whether the deployment needs to survive a restart and whether it's serverless. Backend Use case me...
6. How do you run BetterDB Monitor with a single Docker command?
The quick-start command pulls the default image and maps the dashboard's port to your host: docker run -d --name betterdb -p 3001 :3001 betterdb/monitor:latest Then open http://localhost:3001 in a browser to reach the dashboard. To point it at a specific Valkey or Redis instance instead of relyin...
7. How do you install BetterDB Monitor without Docker?
Run npx @betterdb/monitor to launch it directly with Node.js. On first run, an interactive setup wizard walks through the database connection, storage backend (SQLite, PostgreSQL, or in-memory), and server settings, saving the result to ~/.betterdb/config.json . For a persistent install, use npm ...
8. What is the minimum Valkey version BetterDB Monitor supports?
BetterDB Monitor supports Valkey 8.0 and above for its full feature set. COMMANDLOG specifically requires Valkey 8.1+, since that command was introduced there, and CLUSTER SLOT-STATS is likewise a newer Valkey-only capability. On the Redis side, it supports Redis 6 and above, covering everything ...
9. Define COMMANDLOG support in BetterDB Monitor?
COMMANDLOG is a Valkey 8.1+-exclusive server feature that captures large requests and large replies, not just slow ones the way SLOWLOG does. A command can return in a couple of milliseconds and still ship a multi-megabyte reply that pressures memory and network throughput; SLOWLOG would never fl...
10. What is the default port for the BetterDB Monitor dashboard?
The web UI listens on port 3001 by default, controlled by the PORT environment variable, and it's the same port you map with -p 3001:3001 in the quick-start Docker command or forward with kubectl port-forward on Kubernetes. In local development the frontend's Vite dev server runs separately on po...
11. What are the key browser features in BetterDB for Valkey?
The Key Browser lets you scan and filter keys by wildcard pattern, such as user:* , session:* , or *:cache , so you can narrow a large keyspace down to the namespace you actually care about instead of paging through everything. For each matching key it shows the type and TTL at a glance, which is...
12. What are the connection settings in BetterDB for Valkey?
Each saved connection in the extension exposes a small, focused set of fields rather than a long configuration form, which fits its role as a lightweight editor client rather than a full deployment tool. Only Host and Port really matter to get a connection working; Username, Password, and Databas...
13. Describe the tech stack behind BetterDB Monitor?
The backend is built with NestJS on the Fastify adapter, using the iovalkey client for Valkey/Redis connections, written in TypeScript strict mode with explicit return types and no any , served on port 3001. The frontend is React with TypeScript, built with Vite, styled with TailwindCSS, and char...
14. What is the purpose of BetterDB Monitor's Prometheus endpoint?
BetterDB Monitor exposes over 100 metrics, all prefixed betterdb_ , at GET /api/prometheus/metrics in standard Prometheus text format, so any existing Prometheus server can scrape it exactly like it would scrape a normal exporter, with no custom parsing needed. The metrics cover ACL audit events,...
15. What is host.docker.internal used for with BetterDB Monitor?
When the Valkey or Redis instance you want to monitor runs on your host machine, localhost inside the BetterDB container refers to the container itself, not the host. Setting DB_HOST=host.docker.internal instead lets the container reach services on the host. This works out of the box on Docker De...
16. Which data types support full CRUD in BetterDB for Valkey?
The type-specific editors in BetterDB for Valkey cover every core Valkey/Redis data type, with one deliberate exception. String, Hash, List, Set, and Sorted Set all get full view, edit, and delete support, each with an editor suited to that structure's shape – for instance a Hash shows fiel...
17. What is the ENCRYPTION_KEY variable used for in BetterDB Monitor?
ENCRYPTION_KEY (minimum 16 characters) is used to envelope-encrypt stored connection passwords and SSH tunnel secrets, including private keys and passphrases, at rest – wherever STORAGE_TYPE happens to be writing that data, whether that's Postgres, Turso, or SQLite. If it isn't set, those s...
18. List the ways you can access data in BetterDB Monitor?
BetterDB's own philosophy is that everything shown in the UI is also reachable another way, so the same underlying data is available through five distinct interfaces depending on what's consuming it. Interface Details Web UI http://localhost:3001 MCP server npx @betterdb/mcp (stdio); token from S...
19. Why does BetterDB Monitor need PostgreSQL for production deployments?
The Docker image only bundles the monitoring application itself – the backend API and frontend – not a database to remember anything in. The default memory storage mode is explicitly a testing/ephemeral option: every slowlog, client-analytics record, capture, and anomaly baseline is l...
20. How does BetterDB Monitor detect Valkey versus Redis automatically?
The backend talks to the database through a unified adapter built on the wire-compatible iovalkey client, so the same code path works against either server. With the default DB_TYPE=auto , it inspects the response of the server's INFO command to tell Valkey and Redis apart, then checks per-versio...
21. What is the difference between BetterDB Monitor's memory and postgres storage?
Aspect memory postgres Persistence Lost on restart Durable across restarts Setup Default, zero config STORAGE_TYPE=postgres + STORAGE_URL Intended use Testing, ephemeral environments Production Beyond the table, the practical impact is what survives an upgrade: with memory , a container replace w...
22. When should you use BetterDB Monitor's offline license instead of an online key?
Use the offline/air-gapped license specifically when the host has no internet access at all. The online model ( BETTERDB_LICENSE_KEY ) validates against betterdb.com and caches a locally-verified signed token so your tier survives short outages and restarts – but it still assumes at least o...
23. How does BetterDB Monitor persist license state across restarts?
License state, including the offline license and the online outage-grace token, is written under BETTERDB_DATA_DIR , which defaults to /app/data . In Docker, that means you need to mount a writable volume there. Because the container runs as UID 1001 rather than root, a freshly created Docker vol...
24. Explain how SSH tunnels work in BetterDB Monitor?
sequenceDiagram participant M as BetterDB Monitor participant B as SSH Bastion participant D as Valkey/Redis M->>B: SSH connection (password or private key) B-->>M: Local TCP tunnel established M->>B: Forwarded traffic over the tunnel B->>D: Connects to 127.0.0.1 on the database D-->>M: Responses...
25. Why doesn't BetterDB Monitor's Docker image bundle SQLite support?
The documentation explicitly lists SQLite support as excluded from the Docker image, pointing users to PostgreSQL or Memory storage instead. The practical reason is that the sqlite backend depends on better-sqlite3 , a native Node.js module that has to be compiled per platform and architecture. S...
26. What is the difference between the two SSH key sources in BetterDB Monitor?
"Paste key" submits the PEM key content inline along with the connection. It's stored encrypted at rest only when ENCRYPTION_KEY is set; otherwise it's stored in plaintext, just like connection passwords. This works everywhere, including managed or cloud deployments. "Server file path" instead re...
27. How does BetterDB Monitor's anomaly detection identify problems?
Anomaly detection (a Pro feature, free during early access) learns a baseline for your metrics automatically rather than requiring manual thresholds for each one. It runs 20+ built-in detectors, correlates related events together, and produces plain-English diagnoses instead of a raw list of trig...
28. What is capacity forecasting in BetterDB Monitor?
Capacity forecasting projects a time-to-ceiling estimate for memory, ops/sec, CPU, and fragmentation based on observed trends, rather than just showing you today's numbers on a dashboard. Instead of discovering you're about to hit a memory limit only when Valkey starts evicting keys or refusing w...
29. How do webhooks work in BetterDB Monitor?
When an alert condition fires – an anomaly, a capacity-forecast warning, or any other configured trigger – BetterDB Monitor can deliver it to a webhook endpoint you configure, such as a Slack relay, PagerDuty, or a custom internal service. Each delivery is HMAC-signed, so the receivin...
30. What is the difference between BetterDB Monitor and BetterDB for Valkey?
BetterDB Monitor is the observability platform: historical analytics, anomaly detection, Prometheus and OpenTelemetry integration, and an MCP server, deployed as a server via Docker, Helm, or the CLI. BetterDB for Valkey is a separate, free MIT-licensed VS Code (or Cursor/VSCodium) extension for ...
31. How does the Search Query Runner build hybrid KNN queries?
The panel offers a visual filter builder for TAG, NUMERIC, and TEXT fields – toggles, ranges, and multi-select tag pickers – alongside a separate vector KNN search section with a K selector and a vector input, entered either as a JSON array like [0.12, -0.4, ...] or as base64-encoded ...
32. When would you choose the CLI install over Docker for BetterDB Monitor?
The CLI ( npx @betterdb/monitor ) is the better fit for local development, quick one-off checks, or environments where you'd rather not manage a Docker container. Its interactive setup wizard configures the connection, storage backend, and server settings for you and saves them to ~/.betterdb/con...
33. What happens when you enable BetterDB Monitor's experimental AI Helper?
The AI Helper's dependencies only exist in the versioned image tags ( X.Y.Z ), not in latest or the -no-ai tags, which is why that image is roughly 280MB larger. Even when you're running the heavier versioned image, the AI Helper is disabled by default via the AI_ENABLED setting, so it's opt-in o...
34. Why should you set BETTERDB_SSH_KEY_DIR in BetterDB Monitor?
Setting BETTERDB_SSH_KEY_DIR is what unlocks the "server file path" SSH key source, letting a connection reference a private key that already exists on the monitor server by path, instead of pasting the key contents inline every time. Left unset, that option is disabled and only inline pasted key...
35. Explain the three-phase workflow of BetterDB Monitor's live migration?
flowchart LR A[Analysis] --> B[Execution] --> C[Validation] A -.compatibility & size checks.-> A B -.moves data Redis Valkey.-> B C -.confirms match with source.-> C Live migration moves data between Redis and Valkey through three distinct phases rather than a single blind copy. The Analysis phas...
36. What is the difference between Key Analytics and Hot Key Tracking?
Hot Key Tracking is a base feature that ranks keys by access frequency and shows how that ranking moves over time – essentially, "what's hot right now versus a while ago." Key Analytics, a Pro feature free during early access, goes further: it adds type, TTL, and size distributions gathered...
37. How does semantic cache intelligence help AI applications in BetterDB Monitor?
This Pro feature, backed by the @betterdb/semantic-cache (TypeScript) and betterdb-semantic-cache (Python) packages, gives visibility into semantic caches built on vector similarity – the kind LLM applications use to avoid recomputing near-duplicate requests. It reports hit-rate health, rec...
38. Explain the execution flow when BetterDB Monitor ingests OpenTelemetry traces?
sequenceDiagram participant App as AI Application participant BDB as BetterDB Monitor participant V as Valkey App->>BDB: OTLP spans (traces) BDB->>V: Correlate span timing with live Valkey state BDB-->>App: Waterfall view with Valkey context BDB-->>BDB: Mirror metrics/events to any OTLP backend A...
39. Which is better for VPC-only instances: SSH tunnel or the BetterDB agent?
It depends on the topology. An SSH tunnel through a bastion works well for single-node or primary monitoring, but it has a documented limitation with clusters: only the one connection you configure is tunnelled, while Valkey Cluster and Sentinel nodes are contacted directly using the addresses th...
40. How does the VS Code extension protect vector fields during key edits?
In both the Search Query Runner's results and the hash key editor, vector fields are rendered as read-only placeholders like ⟨N bytes · binary⟩ rather than as editable text or numbers. That matters because a vector embedding round-tripped through a text editor – parsed,...
41. What is the difference between MONITOR captures and slowlog analytics?
A MONITOR capture session is something you deliberately start and stop: it records real, live traffic on demand, with live tail, filtering, replay, export to JSON or CSV, and cross-referencing against connection history. It's a targeted, full-detail recorder for the window you choose to run it. S...
42. How does BetterDB Monitor prevent tampering with offline license tokens?
Every entitlement is issued as a signed RS256 JWT. BetterDB Monitor verifies that signature locally, against public keys already embedded in the image, so it never has to contact a license server to decide whether to trust a given token – which is exactly what makes true air-gapped operatio...
43. Explain the internal working of BetterDB Monitor's unified database adapter?
The adapter sits on top of the wire-compatible iovalkey client, so the rest of the application – dashboards, analytics, the REST API – talks to one interface regardless of whether the underlying server is Valkey or Redis. With DB_TYPE=auto , the adapter's first job on connecting is id...
44. What is the difference between ACL audit trail and client analytics?
ACL audit trail persists who accessed what, over time – an identity-and-permissions history aimed at compliance and post-incident review, the kind of record you pull up after something went wrong to answer "who touched this." Client analytics instead attributes ongoing traffic by client nam...
45. How can you optimize Prometheus scraping for a clustered BetterDB Monitor deployment?
Point Prometheus at the single /api/prometheus/metrics endpoint on the monitor instance itself, rather than trying to scrape each Valkey node directly – BetterDB already aggregates cluster topology, SLOT-STATS, and per-node metrics behind that one exporter, so scraping the nodes separately ...
46. When should you pin the SSH host key fingerprint on a connection?
Pin it whenever the tunnel crosses a network you don't fully control – essentially any bastion reachable over the internet or a shared network – because leaving the fingerprint blank means the bastion's identity is never actually verified; BetterDB just logs a warning and connects any...
47. Why is COMMANDLOG exclusive to Valkey rather than Redis in BetterDB Monitor?
COMMANDLOG is a server-side feature that Valkey introduced starting at 8.1 – it isn't a command that exists in any released version of Redis, so there's simply nothing for BetterDB to call, even with its Redis 6+ compatibility mode. SLOWLOG, which both databases support, is the closest Redi...
48. How do you troubleshoot license persistence failing with EACCES errors?
The symptom is an EACCES error writing license.jwt after mounting a fresh volume at BETTERDB_DATA_DIR (default /app/data ). The cause is a UID mismatch: the container runs as UID 1001, but a newly created Docker volume is typically owned by root, so the process can't write into it. The fix is to ...
49. Explain the known limitation of SSH tunnels with cluster topologies?
SSH tunnelling in BetterDB Monitor only covers the single connection you explicitly configure. For Valkey Cluster or Sentinel deployments, BetterDB discovers the other nodes by calling CLUSTER NODES or querying Sentinel, and then connects to those nodes directly using the addresses they themselve...
50. How does BetterDB Monitor's cluster visibility feature work?
Cluster visibility renders topology graphs of the Valkey Cluster alongside CLUSTER SLOT-STATS heatmaps, showing per-slot CPU usage and key distribution across the cluster. That lets an operator spot a hot slot or an imbalanced shard visually, instead of trying to infer a topology problem from dow...