Running Flowise using Queue
By default, Flowise runs in a NodeJS main thread. However, with large number of predictions, this does not scale well. Therefore there are 2 modes you can configure: main
(default) and queue
.
Queue Mode
With the following environment variables, you can run Flowise in queue
mode.
MODE
Mode to run Flowise
Enum String: main
, queue
main
WORKER_CONCURRENCY
How many jobs are allowed to be processed in parallel for a worker. If you have 1 worker, that means how many concurrent prediction tasks it can handle. More info
Number
10000
QUEUE_NAME
The name of the message queue
String
flowise-queue
QUEUE_REDIS_EVENT_STREAM_MAX_LEN
Event stream is auto-trimmed so that its size does not grow too much. More info
Number
10000
REDIS_URL
Redis URL
String
REDIS_HOST
Redis host
String
localhost
REDIS_PORT
Redis port
Number
6379
REDIS_USERNAME
Redis username (optional)
String
REDIS_PASSWORD
Redis password (optional)
String
REDIS_CERT
Redis self-signed certificate
String
REDIS_KEY
Redis self-signed certificate key file
String
REDIS_CA
Redis self-signed certificate CA file
String
In queue
mode, the main server will be responsible for processing requests, sending jobs to message queue. Main server will not execute the job. One or multiple workers receive jobs from the queue, execute them and send the results back.
This allows for dynamic scaling: you can add workers to handle increased workloads or remove them during lighter periods.
Here's how it works:
The main server receive prediction or other requests from the web, adding them as jobs to the queue.
These job queues are essential lists of tasks waiting to be processed. Workers, which are essentially separate processes or threads, pick up these jobs and execute them.
Once the job is completed, the worker:
Write the results in the database.
Send an event to indicate the completion of the job.
Main server receive the event, and send the result back to UI.
Redis pub/sub is also used for streaming data back to UI.

Local Setup
Start Redis
Before starting main server and workers, Redis need to be running first. You can run Redis on a separate machine, but make sure that it's accessible by the server and worker instances.
For example, you can get Redis running on your Docker following this guide.
Start Main Server
This is the same as you were to run Flowise by default, with the exceptions of configuring the environment variables mentioned above.
pnpm start
Start Worker
Same as main server, environment variables above must be configured. We recommend just using the same .env
file for both main and worker instances. The only difference is how to run the workers. Open another terminal and run:
pnpm run start-worker
Main server and worker need to share the same secret key. Refer to For Credentials. For production, we recommend using Postgres as database for perfomance.
Docker Setup
Method 1: Pre-built Images (Recommended)
This method uses pre-built Docker images from Docker Hub, making it the fastest and most reliable deployment option.
Step 1: Setup Environment
Create a .env
file in the docker
directory:
# Basic Configuration
PORT=3000
WORKER_PORT=5566
# Queue Configuration (Required)
MODE=queue
QUEUE_NAME=flowise-queue
REDIS_URL=redis://redis:6379
# Optional Queue Settings
WORKER_CONCURRENCY=5
REMOVE_ON_AGE=24
REMOVE_ON_COUNT=1000
QUEUE_REDIS_EVENT_STREAM_MAX_LEN=1000
ENABLE_BULLMQ_DASHBOARD=false
# Database (Optional - defaults to SQLite)
DATABASE_PATH=/root/.flowise
# Storage
BLOB_STORAGE_PATH=/root/.flowise/storage
# Secret Keys
SECRETKEY_PATH=/root/.flowise
# Logging
LOG_PATH=/root/.flowise/logs
Step 2: Deploy
cd docker
docker compose -f docker-compose-queue-prebuilt.yml up -d
Step 3: Verify Deployment
# Check container status
docker compose -f docker-compose-queue-prebuilt.yml ps
# View logs
docker compose -f docker-compose-queue-prebuilt.yml logs -f flowise
docker compose -f docker-compose-queue-prebuilt.yml logs -f flowise-worker
Method 2: Build from Source
This method builds Flowise from source code, useful for development or custom modifications.
Step 1: Setup Environment
Create the same .env
file as in Method 1.
Step 2: Deploy
cd docker
docker compose -f docker-compose-queue-source.yml up -d
Step 3: Build Process
The source build will:
Build the main Flowise application from source
Build the worker image from source
Set up Redis and networking
Step 4: Monitor Build
# Watch build progress
docker compose -f docker-compose-queue-source.yml logs -f
# Check final status
docker compose -f docker-compose-queue-source.yml ps
Health Checks
All compose files include health checks:
# Check main instance health
curl http://localhost:3000/api/v1/ping
# Check worker health
curl http://localhost:5566/healthz
Queue Dashboard
Set ENABLE_BULLMQ_DASHBOARD
to true will allow users to view all the jobs, status, result, data by navigating to <your-flowise-url.com>/admin/queues

Last updated