Skip to main content
SMKRV MCP Studio uses a Redis-backed queue to control concurrent query execution per database connection. This prevents overwhelming databases with too many simultaneous queries.

Overview

When an MCP client calls a tool that executes a SQL query:
  1. The tool requests a query slot for its bound connection
  2. If a slot is available (under max_concurrent_queries), the query executes immediately
  3. If all slots are taken, the query is placed in a FIFO queue
  4. When a running query completes, the next queued query is released
  5. If a queued query waits longer than queue_timeout_seconds, it is rejected

Per-Connection Settings

Configure queue settings in the connection editor: go to Connections, open a connection, and scroll to the Queue section. Each connection has independent settings:
SettingRangeDefaultDescription
max_concurrent_queries1–2005Maximum queries running simultaneously
queue_timeout_seconds1–30030Maximum wait time in the queue
queue_enabledbooleantrueWhether queueing is active

Choosing Values

  • Small databases or shared hosts: Keep max_concurrent_queries low (2–5)
  • Dedicated database servers: Increase to 20–50 depending on capacity
  • Long-running analytical queries: Increase queue_timeout_seconds to 120–300
  • Quick OLTP queries: Keep timeout at 10–30 seconds

Queue Monitor

The Queue Monitor tab on the Server page displays real-time metrics:
MetricDescription
Active QueriesNumber of queries currently executing per connection
Queued QueriesNumber of queries waiting in the queue
Total ExecutedCumulative query count per connection

Fallback Behavior

When Redis is unavailable, MCP Studio falls back to in-memory concurrency control:
FeatureRedis ModeFallback Mode
Concurrency controlDistributedPer-process only
Queue persistenceSurvives restartsLost on restart
MetricsFullLimited

Troubleshooting

Queries Timing Out in Queue

  • Increase queue_timeout_seconds
  • Increase max_concurrent_queries if the database can handle more load
  • Check for long-running queries holding slots

Redis Connection Failed

docker compose ps redis
docker compose logs redis
docker compose exec redis redis-cli -a "${REDIS_PASSWORD}" ping

Queue Not Limiting Queries

  • Verify queue_enabled is true on the connection
  • Confirm Redis is connected (check the indicator on the Server page)

See Also