{"id":126122,"date":"2025-03-27T16:36:18","date_gmt":"2025-03-27T16:36:18","guid":{"rendered":"\/tutorials\/?p=126122"},"modified":"2026-03-10T09:26:42","modified_gmt":"2026-03-10T09:26:42","slug":"n8n-queue-mode","status":"publish","type":"post","link":"\/ca\/tutorials\/n8n-queue-mode","title":{"rendered":"How to configure n8n queue mode on VPS?"},"content":{"rendered":"<?xml encoding=\"utf-8\" ?><p>As your n8n automation workflows grow in complexity, running them efficiently can become a challenge. Running everything on a single process can lead to slow execution times, unnecessary system strain, or even cause your automation to fail.<\/p><p>The solution for this problem is <strong>n8n queue mode<\/strong>. It introduces a job queue that distributes your tasks across multiple worker processes rather than running everything in one place. This allows your workflows to run independently, improving the performance and scalability of your automation.<\/p><p>In this guide, we&rsquo;ll walk you through the step-by-step process of setting up queue mode on a Hostinger VPS. By the end of this guide, you&rsquo;ll be able to make your n8n automation ecosystem more reliable and scalable.<\/p><p>\n\n\n\n<\/p><h2 class=\"wp-block-heading\" id=\"h-how-does-queue-mode-work\"><strong>How does queue mode work?<\/strong><\/h2><p>By default, n8n operates within a single-threaded main process where all of its tasks are handled sequentially. This works well for low-volume automations, but can lead to bottlenecks when your workloads increase.<\/p><p>Queue mode effectively splits your entire n8n back end into three distinct areas:<\/p><ul class=\"wp-block-list\">\n<li><strong>Management segment <\/strong>&ndash; this is responsible for the visual interface, configuring the workflows and managing all your triggers.&nbsp;<\/li>\n\n\n\n<li><strong>Storage segment &ndash; <\/strong>this is where all your data, such as tasks, workflows, credentials, and logs are stored. Where it differs from a standard n8n setup is that it incorporates Redis, a key-value database, to act as a message broker.<\/li>\n\n\n\n<li><strong>Worker segment <\/strong>&ndash; this is where all the automation logic happens and your automation steps are executed in parallel.<\/li>\n<\/ul><p>Here&rsquo;s how it looks visually:<\/p><div class=\"wp-block-image\"><figure data-wp-context='{\"imageId\":\"69e1d434ed5be\"}' data-wp-interactive=\"core\/image\" class=\"aligncenter size-large wp-lightbox-container\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"757\" data-wp-class--hide=\"state.isContentHidden\" data-wp-class--show=\"state.isContentVisible\" data-wp-init=\"callbacks.setButtonStyles\" data-wp-on-async--click=\"actions.showLightbox\" data-wp-on-async--load=\"callbacks.setButtonStyles\" data-wp-on-async-window--resize=\"callbacks.setButtonStyles\" src=\"https:\/\/www.hostinger.com\/tutorials\/wp-content\/uploads\/sites\/2\/2025\/03\/queue-mode-diagram-1024x757.png\" alt=\"Visual diagram of the n8n queue mode architecture.\" class=\"wp-image-126130\"  sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><button class=\"lightbox-trigger\" type=\"button\" aria-haspopup=\"dialog\" aria-label=\"Enlarge\" data-wp-init=\"callbacks.initTriggerButton\" data-wp-on-async--click=\"actions.showLightbox\" data-wp-style--right=\"state.imageButtonRight\" data-wp-style--top=\"state.imageButtonTop\">\n\t\t\t<svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"12\" height=\"12\" fill=\"none\" viewbox=\"0 0 12 12\">\n\t\t\t\t<path fill=\"#fff\" d=\"M2 0a2 2 0 0 0-2 2v2h1.5V2a.5.5 0 0 1 .5-.5h2V0H2Zm2 10.5H2a.5.5 0 0 1-.5-.5V8H0v2a2 2 0 0 0 2 2h2v-1.5ZM8 12v-1.5h2a.5.5 0 0 0 .5-.5V8H12v2a2 2 0 0 1-2 2H8Zm2-12a2 2 0 0 1 2 2v2h-1.5V2a.5.5 0 0 0-.5-.5H8V0h2Z\"><\/path>\n\t\t\t<\/svg>\n\t\t<\/button><\/figure><\/div><figure tabindex=\"0\" class=\"wp-block-table\"><table><tbody><tr><td><strong>Service<\/strong><\/td><td><strong>Role<\/strong><\/td><\/tr><tr><td>Main n8n instance<\/td><td>Handles the visual interface, workflow configurations, and their triggers<\/td><\/tr><tr><td>Redis<\/td><td>Acts as the message broker for the job queue<\/td><\/tr><tr><td>n8n database<\/td><td>Stores workflow execution data such as logs and results<\/td><\/tr><tr><td>n8n worker instances<\/td><td>Picks up pending jobs from Redis and executes the automation steps<\/td><\/tr><\/tbody><\/table><\/figure><p>This is how the general process flow looks in queue mode:<\/p><div class=\"wp-block-image\"><figure data-wp-context='{\"imageId\":\"69e1d434efc2d\"}' data-wp-interactive=\"core\/image\" class=\"aligncenter size-large wp-lightbox-container\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"346\" data-wp-class--hide=\"state.isContentHidden\" data-wp-class--show=\"state.isContentVisible\" data-wp-init=\"callbacks.setButtonStyles\" data-wp-on-async--click=\"actions.showLightbox\" data-wp-on-async--load=\"callbacks.setButtonStyles\" data-wp-on-async-window--resize=\"callbacks.setButtonStyles\" src=\"https:\/\/www.hostinger.com\/tutorials\/wp-content\/uploads\/sites\/2\/2025\/03\/n8n-queue-mode-process-1024x346.png\" alt=\"Visual representation of how n8n queue mode handles requests.\" class=\"wp-image-126132\"  sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><button class=\"lightbox-trigger\" type=\"button\" aria-haspopup=\"dialog\" aria-label=\"Enlarge\" data-wp-init=\"callbacks.initTriggerButton\" data-wp-on-async--click=\"actions.showLightbox\" data-wp-style--right=\"state.imageButtonRight\" data-wp-style--top=\"state.imageButtonTop\">\n\t\t\t<svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"12\" height=\"12\" fill=\"none\" viewbox=\"0 0 12 12\">\n\t\t\t\t<path fill=\"#fff\" d=\"M2 0a2 2 0 0 0-2 2v2h1.5V2a.5.5 0 0 1 .5-.5h2V0H2Zm2 10.5H2a.5.5 0 0 1-.5-.5V8H0v2a2 2 0 0 0 2 2h2v-1.5ZM8 12v-1.5h2a.5.5 0 0 0 .5-.5V8H12v2a2 2 0 0 1-2 2H8Zm2-12a2 2 0 0 1 2 2v2h-1.5V2a.5.5 0 0 0-.5-.5H8V0h2Z\"><\/path>\n\t\t\t<\/svg>\n\t\t<\/button><\/figure><\/div><p>To help put this into perspective, we can compare this setup to other popular work orchestration platforms:<\/p><ul class=\"wp-block-list\">\n<li><strong>Kubernetes <\/strong>manages infrastructure in an inherently similar way, by creating pods that are managed by a control plane, while individual containers handle application workloads.<\/li>\n\n\n\n<li><strong>Batch jobs <\/strong>in popular cloud service providers operate exactly as n8n&rsquo;s queue mode does, with a job queue that gets picked up asynchronously by other solutions.<\/li>\n\n\n\n<li><strong>Load balancers <\/strong>operate in a similar fashion, distributing traffic to multiple duplicate instances for parallel execution.<\/li>\n<\/ul><p>At its core, it&rsquo;s a very simple way of scaling your automation capabilities. To enable more automation runs at the same time, you execute more automation processes. Queue mode acts as a load balancer for the distribution of that workflow.<\/p><h2 class=\"wp-block-heading\" id=\"h-prerequisites\"><strong>Prerequisites<\/strong><\/h2><p>To host <strong>n8n in queue mode <\/strong>with <strong>Redis<\/strong>, your minimum system specifications are:<\/p><ul class=\"wp-block-list\">\n<li>1 vCPU, 2 vCPUs recommended<\/li>\n\n\n\n<li>1 GB of memory, 2 GB of memory recommended<\/li>\n<\/ul><p>You&rsquo;ll also need:<\/p><ul class=\"wp-block-list\">\n<li><strong><a href=\"\/ca\/tutorials\/how-to-install-docker-on-ubuntu\">Docker<\/a>, <\/strong>or<strong> <a href=\"\/ca\/tutorials\/how-to-install-nodejs-ubuntu\">Node.js<\/a> <\/strong>with<strong> npm<\/strong> installed on your VPS.&nbsp;<\/li>\n\n\n\n<li>Basic <a href=\"\/ca\/tutorials\/linux-commands\">Linux command<\/a> knowledge and familiarity with the terminal.<\/li>\n\n\n\n<li>You will need to be comfortable with editing configuration files.<\/li>\n<\/ul><p>While you can run queue mode with the SQLite database that is installed and used by default, we recommend installing PostgreSQL instead, as outlined later in this guide.<\/p><p>n8n and Redis are not compute-intensive, so memory is the primary consideration here. A <a href=\"\/ca\/self-hosted-n8n\">Hostinger KVM 2 VPS<\/a> with Ubuntu<strong> <\/strong>is a comfortable choice for a basic n8n queue mode setup, fitting in:<\/p><ul class=\"wp-block-list\">\n<li>The n8n main process<\/li>\n\n\n\n<li>Redis cluster<\/li>\n\n\n\n<li>PostgreSQL database<\/li>\n\n\n\n<li>Three n8n worker processes<\/li>\n<\/ul><p>This should handle small-medium workflow setups very comfortably and give you plenty of headroom to scale.<\/p><?xml encoding=\"utf-8\" ?><figure class=\"wp-block-image size-large\"><a class=\"hgr-tutorials-cta hgr-tutorials-cta-vps-hosting\" href=\"\/ca\/vps-hosting\" target=\"_blank\" rel=\"noreferrer noopener\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"300\" src=\"https:\/\/www.hostinger.com\/tutorials\/wp-content\/uploads\/sites\/2\/2023\/02\/VPS-hosting-banner-1024x300.png\" alt=\"\" class=\"wp-image-77934\"  sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/a><\/figure><h2 class=\"wp-block-heading\" id=\"h-configuring-queue-mode-in-n8n\"><strong>Configuring queue mode in n8n<\/strong><\/h2><p>In this tutorial, we will implement n8n queue mode on a single <strong>VPS KVM 2<\/strong> instance running <strong>Ubuntu 24.04<\/strong>, with <a href=\"\/ca\/tutorials\/how-to-install-n8n#How_to_install_n8n_on_Ubuntu_manually\">n8n installed manually<\/a> via <strong>Docker<\/strong>. This is the recommended approach as it&rsquo;s the easiest to implement and scale.<\/p><h3 class=\"wp-block-heading\" id=\"h-1-prepare-a-redis-container\"><strong>1. Prepare a Redis container<\/strong><\/h3><p>n8n&rsquo;s queue mode depends on Redis as a message broker to manage job queues, making it a critical component in this setup. To prepare a Redis container on your n8n instance, follow these steps:<\/p><ol class=\"wp-block-list\">\n<li>Log in to <a href=\"https:\/\/hpanel.hostinger.com\/\" target=\"_blank\" rel=\"noopener\">hPanel<\/a>.<\/li>\n\n\n\n<li>Navigate to <strong>VPS <\/strong>and press <strong>Manage <\/strong>on your instance.<\/li>\n<\/ol><div class=\"wp-block-image\"><figure data-wp-context='{\"imageId\":\"69e1d434f3c3e\"}' data-wp-interactive=\"core\/image\" class=\"aligncenter size-large wp-lightbox-container\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"89\" data-wp-class--hide=\"state.isContentHidden\" data-wp-class--show=\"state.isContentVisible\" data-wp-init=\"callbacks.setButtonStyles\" data-wp-on-async--click=\"actions.showLightbox\" data-wp-on-async--load=\"callbacks.setButtonStyles\" data-wp-on-async-window--resize=\"callbacks.setButtonStyles\" src=\"https:\/\/www.hostinger.com\/tutorials\/wp-content\/uploads\/sites\/2\/2025\/03\/n8n-instance-manage-1024x89.png\" alt=\"hPanel VPS view with the Manage button highlighted\" class=\"wp-image-126133\"  sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><button class=\"lightbox-trigger\" type=\"button\" aria-haspopup=\"dialog\" aria-label=\"Enlarge\" data-wp-init=\"callbacks.initTriggerButton\" data-wp-on-async--click=\"actions.showLightbox\" data-wp-style--right=\"state.imageButtonRight\" data-wp-style--top=\"state.imageButtonTop\">\n\t\t\t<svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"12\" height=\"12\" fill=\"none\" viewbox=\"0 0 12 12\">\n\t\t\t\t<path fill=\"#fff\" d=\"M2 0a2 2 0 0 0-2 2v2h1.5V2a.5.5 0 0 1 .5-.5h2V0H2Zm2 10.5H2a.5.5 0 0 1-.5-.5V8H0v2a2 2 0 0 0 2 2h2v-1.5ZM8 12v-1.5h2a.5.5 0 0 0 .5-.5V8H12v2a2 2 0 0 1-2 2H8Zm2-12a2 2 0 0 1 2 2v2h-1.5V2a.5.5 0 0 0-.5-.5H8V0h2Z\"><\/path>\n\t\t\t<\/svg>\n\t\t<\/button><\/figure><\/div><ol start=\"3\" class=\"wp-block-list\">\n<li>Click <strong>Settings &rarr; Browser terminal.<\/strong><\/li>\n<\/ol><div class=\"wp-block-image\"><figure data-wp-context='{\"imageId\":\"69e1d43501eea\"}' data-wp-interactive=\"core\/image\" class=\"aligncenter size-large wp-lightbox-container\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"373\" data-wp-class--hide=\"state.isContentHidden\" data-wp-class--show=\"state.isContentVisible\" data-wp-init=\"callbacks.setButtonStyles\" data-wp-on-async--click=\"actions.showLightbox\" data-wp-on-async--load=\"callbacks.setButtonStyles\" data-wp-on-async-window--resize=\"callbacks.setButtonStyles\" src=\"https:\/\/www.hostinger.com\/tutorials\/wp-content\/uploads\/sites\/2\/2025\/03\/n8n-browser-terminal-1024x373.png\" alt=\"Ubuntu VPS settings view with Browser terminal option highlighted.\" class=\"wp-image-126134\"  sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><button class=\"lightbox-trigger\" type=\"button\" aria-haspopup=\"dialog\" aria-label=\"Enlarge\" data-wp-init=\"callbacks.initTriggerButton\" data-wp-on-async--click=\"actions.showLightbox\" data-wp-style--right=\"state.imageButtonRight\" data-wp-style--top=\"state.imageButtonTop\">\n\t\t\t<svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"12\" height=\"12\" fill=\"none\" viewbox=\"0 0 12 12\">\n\t\t\t\t<path fill=\"#fff\" d=\"M2 0a2 2 0 0 0-2 2v2h1.5V2a.5.5 0 0 1 .5-.5h2V0H2Zm2 10.5H2a.5.5 0 0 1-.5-.5V8H0v2a2 2 0 0 0 2 2h2v-1.5ZM8 12v-1.5h2a.5.5 0 0 0 .5-.5V8H12v2a2 2 0 0 1-2 2H8Zm2-12a2 2 0 0 1 2 2v2h-1.5V2a.5.5 0 0 0-.5-.5H8V0h2Z\"><\/path>\n\t\t\t<\/svg>\n\t\t<\/button><\/figure><\/div><ol start=\"4\" class=\"wp-block-list\">\n<li>Create a directory where Redis will store persistent data:<\/li>\n<\/ol><pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">mkdir -p ~\/redis-data<\/pre><ol start=\"5\" class=\"wp-block-list\">\n<li>Create a directory to store your working files.&nbsp;<\/li>\n<\/ol><pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">mkdir ~\/n8n-queue-modecd ~\/n8n-queue-mode<\/pre><ol start=\"6\" class=\"wp-block-list\">\n<li>Create the <strong>docker-compose.yml<\/strong> file:<\/li>\n<\/ol><pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">sudo nano docker-compose.yml<\/pre><ol start=\"7\" class=\"wp-block-list\">\n<li>In it, paste the YAML configuration for a Redis 6 container:<\/li>\n<\/ol><pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">version: \"3.7\"\nservices:&nbsp;&nbsp;redis:&nbsp;&nbsp;&nbsp;&nbsp;image: redis:6&nbsp;&nbsp;&nbsp;&nbsp;container_name: redis&nbsp;&nbsp;&nbsp;&nbsp;restart: always&nbsp;&nbsp;&nbsp;&nbsp;volumes:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;- ~\/redis-data:\/data<\/pre><ol start=\"8\" class=\"wp-block-list\">\n<li>Save your changes by pressing <strong>Ctrl + X &rarr; Y &rarr; Enter<\/strong>.<\/li>\n<\/ol><p>Now that Redis is prepared and ready, you may want to add extra configuration to your Redis instance, such as a password. To do so, you can follow configuration steps outlined in our <a href=\"\/ca\/tutorials\/how-to-install-and-setup-redis-on-ubuntu\/#2_Configure_Redis\">Redis installation guide<\/a>.<\/p><p>However, since we are using a Redis container, you would also need to add a custom <strong>redis.conf <\/strong>file to store your settings and mount it as a volume &amp; command.<\/p><p>For example, if you added <strong>redis.conf<\/strong> in the <strong>~\/redis-conf<\/strong> directory, you would need to add the following lines to your <strong>docker-compose.yml<\/strong>:<\/p><pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">    volumes:      - ~\/redis-conf\/redis.conf:\/usr\/local\/etc\/redis\/redis.conf  command: [\"redis-server\", \"\/usr\/local\/etc\/redis\/redis.conf\"]<\/pre><h3 class=\"wp-block-heading\" id=\"h-2-configure-environment-variables\"><strong>2. Configure environment variables<\/strong><\/h3><p>Now that you have Redis prepared, you need to configure the necessary variables to enable queue mode. In our scenario, we have a n8n instance already set up with <strong>nginx<\/strong>. Next, we will move it to a containerized environment.<\/p><p>Here are the key variables you need to set:<\/p><figure tabindex=\"0\" class=\"wp-block-table\"><table class=\"has-fixed-layout\"><tbody><tr><td><strong>Variable<\/strong><\/td><td><strong>Purpose<\/strong><\/td><\/tr><tr><td>EXECUTIONS_MODE=queue<\/td><td>Sets the queue mode execution method<\/td><\/tr><tr><td>QUEUE_BULL_REDIS_HOST=redis<\/td><td>Hostname of the Redis instance. Since we&rsquo;re using containerized Redis, the value will be redis<\/td><\/tr><tr><td>QUEUE_BULL_REDIS_PORT=6379<\/td><td>Port Redis is listening on (6379 by default)<\/td><\/tr><tr><td>N8N_RUNNERS_ENABLED=true<\/td><td>Toggles task runners.<\/td><\/tr><tr><td>OFFLOAD_MANUAL_EXECUTIONS_TO_WORKERS=true<\/td><td>Ensures that manual workflow executions also get sent to workers<\/td><\/tr><\/tbody><\/table><\/figure><p>Some other important variables include:<\/p><figure tabindex=\"0\" class=\"wp-block-table\"><table class=\"has-fixed-layout\"><tbody><tr><td><strong>Variable<\/strong><\/td><td><strong>Purpose<\/strong><\/td><\/tr><tr><td>QUEUE_HEALTH_CHECK_ACTIVE=true<\/td><td>Adds an internal health check to monitor the Redis connection<\/td><\/tr><tr><td>QUEUE_BULL_REDIS_PASSWORD<\/td><td>If you added a password to Redis, you also need to set it here<\/td><\/tr><\/tbody><\/table><\/figure><p>Now that you know what the required settings are, let&rsquo;s set them up.<\/p><ol class=\"wp-block-list\">\n<li>Move back to your working directory:<\/li>\n<\/ol><pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">cd ~\/n8n-queue-mode<\/pre><ol start=\"2\" class=\"wp-block-list\">\n<li>Create a .env file that will store your variables. If you&rsquo;d like, you can rename it:<\/li>\n<\/ol><pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">sudo nano .env<\/pre><p>Store these values:<\/p><pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">N8N_LOG_LEVEL=debugN8N_LOG_OUTPUT=console\nN8N_BASIC_AUTH_ACTIVE=trueN8N_BASIC_AUTH_USER=&lt;your_username&gt;N8N_BASIC_AUTH_PASSWORD=&lt;your_password&gt;\nN8N_HOST=srv721674.hstgr.cloudN8N_PORT=5678N8N_PROTOCOL=httpsWEBHOOK_URL=https:\/\/srv721674.hstgr.cloud\/GENERIC_TIMEZONE=UTC\nN8N_EXPRESS_TRUST_PROXY=trueN8N_SECURE_COOKIE=true\nEXECUTIONS_MODE=queueQUEUE_BULL_REDIS_HOST=redisQUEUE_BULL_REDIS_PORT=6379N8N_RUNNERS_ENABLED=trueOFFLOAD_MANUAL_EXECUTIONS_TO_WORKERS=true<\/pre><p>The extra queue mode values are highlighted in bold &ndash; if you have an existing environment file, you can add just the bold lines to your existing configuration.<\/p><p><div class=\"protip\">\n                    <h4 class=\"title\">Pro Tip<\/h4>\n                    <p> While the logging settings are optional, this will prove to be useful for checking the status of our containers, and for troubleshooting errors.<\/p>\n                <\/div>\n\n\n\n<\/p><ol start=\"3\" class=\"wp-block-list\">\n<li>Save your changes by pressing <strong>Ctrl + X &rarr; Y &rarr; Enter<\/strong><\/li>\n<\/ol><h3 class=\"wp-block-heading\" id=\"h-3-deploy-the-main-n8n-process\"><strong>3. Deploy the main n8n process<\/strong><\/h3><p>So far, you&rsquo;ve defined all the environment variables needed for queue mode to work. Now, let&rsquo;s define our n8n container for the main process:<\/p><ol class=\"wp-block-list\">\n<li>Open up <strong>docker-compose.yml <\/strong>by running:<\/li>\n<\/ol><pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">sudo nano docker-compose.yml<\/pre><ol start=\"2\" class=\"wp-block-list\">\n<li>Add the following code under services:<\/li>\n<\/ol><pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">&nbsp; n8n:\n&nbsp; &nbsp; image: n8nio\/n8n\n&nbsp; &nbsp; container_name: n8n\n&nbsp; &nbsp; restart: always\n&nbsp; &nbsp; env_file:\n&nbsp; &nbsp; &nbsp; - .env\n&nbsp; &nbsp; ports:\n&nbsp; &nbsp; &nbsp; - \"5678:5678\"\n&nbsp; &nbsp; volumes:\n&nbsp; &nbsp; &nbsp; - ~\/.n8n:\/home\/node\/.n8n&nbsp;&nbsp;&nbsp;&nbsp;depends_on:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;- redis<\/pre><ol start=\"3\" class=\"wp-block-list\">\n<li>Save your changes by pressing <strong>Ctrl + X &rarr; Y &rarr; Enter<\/strong><\/li>\n<\/ol><p>Your <strong>docker-compose.yml file <\/strong>should look something like this:<\/p><div class=\"wp-block-image\"><figure data-wp-context='{\"imageId\":\"69e1d43504e72\"}' data-wp-interactive=\"core\/image\" class=\"aligncenter size-large wp-lightbox-container\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"786\" data-wp-class--hide=\"state.isContentHidden\" data-wp-class--show=\"state.isContentVisible\" data-wp-init=\"callbacks.setButtonStyles\" data-wp-on-async--click=\"actions.showLightbox\" data-wp-on-async--load=\"callbacks.setButtonStyles\" data-wp-on-async-window--resize=\"callbacks.setButtonStyles\" src=\"https:\/\/www.hostinger.com\/tutorials\/wp-content\/uploads\/sites\/2\/2025\/03\/docker-compose-file-1024x786.png\" alt=\"Example of the docker-compose.yml file with Redis and the n8n main instance configured.\" class=\"wp-image-126135\"  sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><button class=\"lightbox-trigger\" type=\"button\" aria-haspopup=\"dialog\" aria-label=\"Enlarge\" data-wp-init=\"callbacks.initTriggerButton\" data-wp-on-async--click=\"actions.showLightbox\" data-wp-style--right=\"state.imageButtonRight\" data-wp-style--top=\"state.imageButtonTop\">\n\t\t\t<svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"12\" height=\"12\" fill=\"none\" viewbox=\"0 0 12 12\">\n\t\t\t\t<path fill=\"#fff\" d=\"M2 0a2 2 0 0 0-2 2v2h1.5V2a.5.5 0 0 1 .5-.5h2V0H2Zm2 10.5H2a.5.5 0 0 1-.5-.5V8H0v2a2 2 0 0 0 2 2h2v-1.5ZM8 12v-1.5h2a.5.5 0 0 0 .5-.5V8H12v2a2 2 0 0 1-2 2H8Zm2-12a2 2 0 0 1 2 2v2h-1.5V2a.5.5 0 0 0-.5-.5H8V0h2Z\"><\/path>\n\t\t\t<\/svg>\n\t\t<\/button><\/figure><\/div><p>At this point, you can run your n8n process by executing:<\/p><pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">docker compose up -d<\/pre><p>Now you should be able to log in to your instance and see the same view you typically would. Let&rsquo;s try running a simple workflow that executes a web request to Google:<\/p><div class=\"wp-block-image\"><figure data-wp-context='{\"imageId\":\"69e1d43507344\"}' data-wp-interactive=\"core\/image\" class=\"aligncenter size-large wp-lightbox-container\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"590\" data-wp-class--hide=\"state.isContentHidden\" data-wp-class--show=\"state.isContentVisible\" data-wp-init=\"callbacks.setButtonStyles\" data-wp-on-async--click=\"actions.showLightbox\" data-wp-on-async--load=\"callbacks.setButtonStyles\" data-wp-on-async-window--resize=\"callbacks.setButtonStyles\" src=\"https:\/\/www.hostinger.com\/tutorials\/wp-content\/uploads\/sites\/2\/2025\/03\/workflow-test-1024x590.png\" alt=\"Visual of the n8n interface where a workflow is executed even without n8n worker nodes deployed.\" class=\"wp-image-126136\"  sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><button class=\"lightbox-trigger\" type=\"button\" aria-haspopup=\"dialog\" aria-label=\"Enlarge\" data-wp-init=\"callbacks.initTriggerButton\" data-wp-on-async--click=\"actions.showLightbox\" data-wp-style--right=\"state.imageButtonRight\" data-wp-style--top=\"state.imageButtonTop\">\n\t\t\t<svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"12\" height=\"12\" fill=\"none\" viewbox=\"0 0 12 12\">\n\t\t\t\t<path fill=\"#fff\" d=\"M2 0a2 2 0 0 0-2 2v2h1.5V2a.5.5 0 0 1 .5-.5h2V0H2Zm2 10.5H2a.5.5 0 0 1-.5-.5V8H0v2a2 2 0 0 0 2 2h2v-1.5ZM8 12v-1.5h2a.5.5 0 0 0 .5-.5V8H12v2a2 2 0 0 1-2 2H8Zm2-12a2 2 0 0 1 2 2v2h-1.5V2a.5.5 0 0 0-.5-.5H8V0h2Z\"><\/path>\n\t\t\t<\/svg>\n\t\t<\/button><\/figure><\/div><p>It should work, even though you have enabled queue mode and configured the main process to act as a queue orchestrator.<\/p><p>This is a failsafe mechanism in n8n: if you have no available workers to handle your executions, the main instance will pick up the work instead of orchestrating it to Redis.<\/p><p>In spite of all this configuration, you&rsquo;re still not running n8n in queue mode. Let&rsquo;s go ahead and change that by deploying some workers.<\/p><h3 class=\"wp-block-heading\" id=\"h-4-deploy-postgresql-database\"><strong>4. Deploy PostgreSQL database<\/strong><\/h3><p>With the main process configured, now let&rsquo;s move to defining the PostgreSQL database. While it is optional, it&rsquo;s recommended for production-level workloads that SQLite is simply not designed to handle. Luckily, getting a Postgres database ready is quick and easy:<\/p><ol class=\"wp-block-list\">\n<li>Open <strong>docker-compose.yml<\/strong>:<\/li>\n<\/ol><pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">sudo nano docker-compose.yml<\/pre><ol start=\"2\" class=\"wp-block-list\">\n<li>Add the following content at the bottom:<br><\/li>\n<\/ol><pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">postgres:\n&nbsp; &nbsp; image: postgres:15\n&nbsp; &nbsp; container_name: n8n-postgres\n&nbsp; &nbsp; restart: always\n&nbsp; &nbsp; environment:\n&nbsp; &nbsp; &nbsp; POSTGRES_USER: n8n\n&nbsp; &nbsp; &nbsp; POSTGRES_PASSWORD: &lt;your_password&gt;\n&nbsp; &nbsp; &nbsp; POSTGRES_DB: n8ndb\n&nbsp; &nbsp; volumes:\n&nbsp; &nbsp; &nbsp; - pgdata:\/var\/lib\/postgresql\/data\n\nvolumes:&nbsp;&nbsp;pgdata:<\/pre><ol start=\"3\" class=\"wp-block-list\">\n<li>Save with <strong>Ctrl + X &rarr; Y &rarr; Enter<\/strong>.<\/li>\n\n\n\n<li>Open your .env file:<br><\/li>\n<\/ol><pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">sudo nano .env<\/pre><ol start=\"5\" class=\"wp-block-list\">\n<li>Add the following Postgres database configuration details:<\/li>\n<\/ol><pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">DB_TYPE=postgresdb\nDB_POSTGRESDB_HOST=postgres\nDB_POSTGRESDB_PORT=5432\nDB_POSTGRESDB_DATABASE=n8ndb\nDB_POSTGRESDB_USER=n8n\nDB_POSTGRESDB_PASSWORD=&lt;your_password&gt;<\/pre><ol start=\"6\" class=\"wp-block-list\">\n<li>Save with <strong>Ctrl + X &rarr; Y &rarr; Enter<\/strong>.<\/li>\n<\/ol><p>Let&rsquo;s try running it:<\/p><pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">docker compose up -d<\/pre><p>You can also check if the PostgreSQL database works by running:<\/p><pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">docker exec -it n8n-postgres psql -U n8n -d n8ndb\ndt<\/pre><p>Optionally, you can now delete SQLite:<\/p><pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">rm ~\/.n8n\/database.sqlite\nrm ~\/.n8n\/*.sqlite*<\/pre><p><div><p class=\"important\"><strong>Important!<\/strong> In the event that the encryption key value is not set for your main instance, it will generate a fresh key upon config file recreation. To avoid this, we recommend setting N8N_ENCRYPTION_KEY in both environment files to ensure reliability.<\/p><\/div>\n\n\n\n<\/p><h3 class=\"wp-block-heading\" id=\"h-5-launch-worker-processes\"><strong>5. Launch worker processes<\/strong><\/h3><p>Once n8n is in queue mode, it relies on dedicated worker processes to pull jobs from Redis. Let&rsquo;s set up a worker process:<\/p><ol class=\"wp-block-list\">\n<li>First, you need to fetch the encryption key for the workers. You can set it yourself when creating a new n8n instance, or n8n will automatically generate one for you if not provided. Run:<\/li>\n<\/ol><pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">cat ~\/.n8n\/config<\/pre><p>Copy the <strong>encryptionKey <\/strong>value, as you will need to store it in your environment variables.<\/p><ol start=\"2\" class=\"wp-block-list\">\n<li>Prepare a new environment file for the workers. While you can use one file for all n8n instances, separating them to a main and worker file is going to be easier to manage:<\/li>\n<\/ol><pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">sudo nano .env.worker<\/pre><ol start=\"3\" class=\"wp-block-list\">\n<li>Insert the following configuration details:<\/li>\n<\/ol><pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">N8N_LOG_LEVEL=debugN8N_LOG_OUTPUT=console\nEXECUTIONS_MODE=queue\nN8N_RUNNERS_ENABLED=true\nOFFLOAD_MANUAL_EXECUTIONS_TO_WORKERS=trueN8N_ENCRYPTION_KEY=&lt;your_encryption_key&gt;\n\nQUEUE_BULL_REDIS_HOST=redis\nQUEUE_BULL_REDIS_PORT=6379\n\nDB_TYPE=postgresdb\nDB_POSTGRESDB_HOST=postgres\nDB_POSTGRESDB_PORT=5432\nDB_POSTGRESDB_DATABASE=n8ndb\nDB_POSTGRESDB_USER=n8n\nDB_POSTGRESDB_PASSWORD=&lt;your_password&gt;<\/pre><ol start=\"4\" class=\"wp-block-list\">\n<li>Save with <strong>Ctrl + X &rarr; Y &rarr; Enter<\/strong>.<\/li>\n\n\n\n<li>Open <strong>docker-compose.yml<\/strong>:<\/li>\n<\/ol><pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">sudo nano docker-compose.yml<\/pre><ol start=\"6\" class=\"wp-block-list\">\n<li>Add this service just below the PostgreSQL service:<\/li>\n<\/ol><pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">n8n-worker:\n&nbsp; &nbsp; image: n8nio\/n8n\n&nbsp; &nbsp; restart: always\n&nbsp; &nbsp; command: worker\n&nbsp; &nbsp; env_file:\n&nbsp; &nbsp; &nbsp; - .env.worker\n&nbsp; &nbsp; depends_on:\n&nbsp; &nbsp; &nbsp; - redis\n&nbsp; &nbsp; &nbsp; - postgres<\/pre><ol start=\"7\" class=\"wp-block-list\">\n<li>Save with<strong> Ctrl + X &rarr; Y &rarr; Enter<\/strong>.<\/li>\n\n\n\n<li>Start the worker node:<\/li>\n<\/ol><pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">docker compose up -d n8n-worker<\/pre><p><div><p class=\"important\"><strong>Important!<\/strong> In the event that the encryption key value is not set for your main instance, it will generate a fresh key upon config file recreation. To avoid this, we recommend setting N8N_ENCRYPTION_KEY in both environment files to ensure reliability.<\/p><\/div>\n\n\n\n<\/p><p>To get more workers running, run docker compose with the scale argument:<\/p><pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">docker compose up -d --scale n8n-worker=3<\/pre><div class=\"wp-block-image\"><figure data-wp-context='{\"imageId\":\"69e1d43509f37\"}' data-wp-interactive=\"core\/image\" class=\"aligncenter size-large wp-lightbox-container\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"169\" data-wp-class--hide=\"state.isContentHidden\" data-wp-class--show=\"state.isContentVisible\" data-wp-init=\"callbacks.setButtonStyles\" data-wp-on-async--click=\"actions.showLightbox\" data-wp-on-async--load=\"callbacks.setButtonStyles\" data-wp-on-async-window--resize=\"callbacks.setButtonStyles\" src=\"https:\/\/www.hostinger.com\/tutorials\/wp-content\/uploads\/sites\/2\/2025\/03\/docker-scale-1024x169.png\" alt=\"Visual of the terminal which displays a successful scaling activity of the n8n worker nodes up to 3.\" class=\"wp-image-126137\"  sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><button class=\"lightbox-trigger\" type=\"button\" aria-haspopup=\"dialog\" aria-label=\"Enlarge\" data-wp-init=\"callbacks.initTriggerButton\" data-wp-on-async--click=\"actions.showLightbox\" data-wp-style--right=\"state.imageButtonRight\" data-wp-style--top=\"state.imageButtonTop\">\n\t\t\t<svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"12\" height=\"12\" fill=\"none\" viewbox=\"0 0 12 12\">\n\t\t\t\t<path fill=\"#fff\" d=\"M2 0a2 2 0 0 0-2 2v2h1.5V2a.5.5 0 0 1 .5-.5h2V0H2Zm2 10.5H2a.5.5 0 0 1-.5-.5V8H0v2a2 2 0 0 0 2 2h2v-1.5ZM8 12v-1.5h2a.5.5 0 0 0 .5-.5V8H12v2a2 2 0 0 1-2 2H8Zm2-12a2 2 0 0 1 2 2v2h-1.5V2a.5.5 0 0 0-.5-.5H8V0h2Z\"><\/path>\n\t\t\t<\/svg>\n\t\t<\/button><\/figure><\/div><h3 class=\"wp-block-heading\" id=\"h-6-test-the-setup\"><strong>6. Test the setup<\/strong><\/h3><p>To test whether n8n queue mode is working, go ahead and run some test workflows, or put a workflow on a schedule. Here, we will use a simple active workflow running on a ten second interval:<\/p><div class=\"wp-block-image\"><figure data-wp-context='{\"imageId\":\"69e1d4350c85a\"}' data-wp-interactive=\"core\/image\" class=\"aligncenter size-large wp-lightbox-container\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"595\" data-wp-class--hide=\"state.isContentHidden\" data-wp-class--show=\"state.isContentVisible\" data-wp-init=\"callbacks.setButtonStyles\" data-wp-on-async--click=\"actions.showLightbox\" data-wp-on-async--load=\"callbacks.setButtonStyles\" data-wp-on-async-window--resize=\"callbacks.setButtonStyles\" src=\"https:\/\/www.hostinger.com\/tutorials\/wp-content\/uploads\/sites\/2\/2025\/03\/workflow-scheduler-1024x595.png\" alt=\"N8n interface which displays a workflow being activated on a schedule trigger. \" class=\"wp-image-126138\"  sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><button class=\"lightbox-trigger\" type=\"button\" aria-haspopup=\"dialog\" aria-label=\"Enlarge\" data-wp-init=\"callbacks.initTriggerButton\" data-wp-on-async--click=\"actions.showLightbox\" data-wp-style--right=\"state.imageButtonRight\" data-wp-style--top=\"state.imageButtonTop\">\n\t\t\t<svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"12\" height=\"12\" fill=\"none\" viewbox=\"0 0 12 12\">\n\t\t\t\t<path fill=\"#fff\" d=\"M2 0a2 2 0 0 0-2 2v2h1.5V2a.5.5 0 0 1 .5-.5h2V0H2Zm2 10.5H2a.5.5 0 0 1-.5-.5V8H0v2a2 2 0 0 0 2 2h2v-1.5ZM8 12v-1.5h2a.5.5 0 0 0 .5-.5V8H12v2a2 2 0 0 1-2 2H8Zm2-12a2 2 0 0 1 2 2v2h-1.5V2a.5.5 0 0 0-.5-.5H8V0h2Z\"><\/path>\n\t\t\t<\/svg>\n\t\t<\/button><\/figure><\/div><p>After a few minutes, go back to your terminal and check n8n worker logs:<\/p><pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">docker logs &lt;worker name&gt; -f<\/pre><p>You should see something like this:<\/p><div class=\"wp-block-image\"><figure data-wp-context='{\"imageId\":\"69e1d4350eae7\"}' data-wp-interactive=\"core\/image\" class=\"aligncenter size-large wp-lightbox-container\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"123\" data-wp-class--hide=\"state.isContentHidden\" data-wp-class--show=\"state.isContentVisible\" data-wp-init=\"callbacks.setButtonStyles\" data-wp-on-async--click=\"actions.showLightbox\" data-wp-on-async--load=\"callbacks.setButtonStyles\" data-wp-on-async-window--resize=\"callbacks.setButtonStyles\" src=\"https:\/\/www.hostinger.com\/tutorials\/wp-content\/uploads\/sites\/2\/2025\/03\/docker-worker-logs-1024x123.png\" alt=\"Image of the terminal where the docker logs command has been run, showcasing the worker successfully outputting logs to the console for workflow executions.\" class=\"wp-image-126140\"  sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><button class=\"lightbox-trigger\" type=\"button\" aria-haspopup=\"dialog\" aria-label=\"Enlarge\" data-wp-init=\"callbacks.initTriggerButton\" data-wp-on-async--click=\"actions.showLightbox\" data-wp-style--right=\"state.imageButtonRight\" data-wp-style--top=\"state.imageButtonTop\">\n\t\t\t<svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"12\" height=\"12\" fill=\"none\" viewbox=\"0 0 12 12\">\n\t\t\t\t<path fill=\"#fff\" d=\"M2 0a2 2 0 0 0-2 2v2h1.5V2a.5.5 0 0 1 .5-.5h2V0H2Zm2 10.5H2a.5.5 0 0 1-.5-.5V8H0v2a2 2 0 0 0 2 2h2v-1.5ZM8 12v-1.5h2a.5.5 0 0 0 .5-.5V8H12v2a2 2 0 0 1-2 2H8Zm2-12a2 2 0 0 1 2 2v2h-1.5V2a.5.5 0 0 0-.5-.5H8V0h2Z\"><\/path>\n\t\t\t<\/svg>\n\t\t<\/button><\/figure><\/div><p>The key things to look out for are logs like <strong>Worker started execution &lt;number&gt;<\/strong>, which indicate that n8n is successfully pulling jobs from the message broker.<\/p><p>And that&rsquo;s it &ndash; you have successfully configured n8n queue mode and it is now ready to tackle your workloads!<\/p><h3 class=\"wp-block-heading\" id=\"h-7-monitor-and-scale\"><strong>7. Monitor and scale<\/strong><\/h3><p>It&rsquo;s important to maintain your n8n queue mode automation to keep it performant. Here are some things to look out for:<\/p><ul class=\"wp-block-list\">\n<li>Monitor your <strong>CPU <\/strong>and <strong>Memory <\/strong>metrics in <strong>hPanel<\/strong>, or with the <strong>htop <\/strong>command in the terminal.<\/li>\n\n\n\n<li>Run <strong>docker stats <\/strong>to check individual container performance.<\/li>\n\n\n\n<li>Use <strong>redis-cli <\/strong>commands like <strong>info memory<\/strong> or <strong>info stats <\/strong>to monitor Redis.<\/li>\n<\/ul><p>If you see that containers are struggling, it&rsquo;s time to scale. You can do that by running <strong>docker compose up -d &ndash;scale service=number<\/strong>.<\/p><p>For what Hostinger&rsquo;s <a href=\"\/ca\/vps\/n8n-hosting\">VPS for n8n<\/a> offers in hardware capacity, <strong>2-3 workers<\/strong> should be a safe baseline, although you could get away with <strong>5 or more<\/strong> depending on your automation usage.<\/p><p>If you start running into issues with infrastructure resources, here are some steps you may want to consider:<\/p><ul class=\"wp-block-list\">\n<li>Move Redis and PostgreSQL to a separate, dedicated VPS.<\/li>\n\n\n\n<li>Consider implementing an orchestrator like Kubernetes to dynamically scale n8n workers based on load instead of manual scaling.<\/li>\n\n\n\n<li>Scale up your infrastructure to meet your growing needs.<\/li>\n<\/ul><h2 class=\"wp-block-heading\" id=\"h-conclusion\"><strong>Conclusion<\/strong><\/h2><p>Running n8n in queue mode unlocks better scalability, stability, and control over your workflow executions. Separating job scheduling from execution and offloading work to dedicated worker processes reduces the risk of performance bottlenecks.<\/p><p>With this guide, you&rsquo;ve configured queue mode, deployed workers, and learned how to monitor and scale your system on a Hostinger VPS. As your automation grows, you can scale horizontally by adding more workers or hosting Redis and PostgreSQL on separate servers.<\/p><p>Ready to take your automation further? Set up a more robust monitoring system, implement more complex orchestration solutions, and take n8n to its limits!<\/p><h2 class=\"wp-block-heading\" id=\"h-n8n-queue-mode-faq\"><strong>n8n queue mode FAQ<\/strong><\/h2><div class=\"schema-faq wp-block-yoast-faq-block\"><div class=\"schema-faq-section\" id=\"faq-question-1743093016373\"><h3 class=\"schema-faq-question\"><strong>What is queue mode in n8n?<\/strong><\/h3> <p class=\"schema-faq-answer\">Queue mode is a n8n configuration that decouples workflow dispatching from execution by utilizing a job queue, typically backed by Redis. In this mode, the main instance enqueues workflow executions while dedicated worker processes retrieve and process the jobs asynchronously. This separation enhances scalability and stability in high-load and distributed environments.<\/p> <\/div> <div class=\"schema-faq-section\" id=\"faq-question-1743093021301\"><h3 class=\"schema-faq-question\"><strong>How do I enable queue mode in n8n?<\/strong><\/h3> <p class=\"schema-faq-answer\">To enable queue mode in n8n, set the environment variable <strong>EXECUTIONS_MODE<\/strong> to<strong> queue<\/strong> in your configuration files for both the main instance and worker processes. Additionally, configure your Redis options for the queue and optionally set <strong>OFFLOAD_MANUAL_EXECUTIONS_TO_WORKERS<\/strong> and <strong>QUEUE_HEALTH_CHECK_ACTIVE<\/strong> to <strong>true<\/strong>.&nbsp;<\/p> <\/div> <div class=\"schema-faq-section\" id=\"faq-question-1743093027284\"><h3 class=\"schema-faq-question\"><strong>What are the benefits of using queue mode in n8n?<\/strong><\/h3> <p class=\"schema-faq-answer\">Queue mode in n8n offers several benefits, including enhanced scalability and better resource utilization. By offloading workload execution to dedicated n8n workers, it prevents the main process from becoming a bottleneck. This is helpful for both error handling and enabling asynchronous processing in n8n, resulting in a faster and more stable system for high-demand environments.<\/p> <\/div> <\/div>\n","protected":false},"excerpt":{"rendered":"<p>As your n8n automation workflows grow in complexity, running them efficiently can become a challenge. Running everything on a single process can lead to slow execution times, unnecessary system strain, or even cause your automation to fail. The solution for this problem is n8n queue mode. It introduces a job queue that distributes your tasks [&#8230;]<\/p>\n<p><a class=\"btn btn-secondary understrap-read-more-link\" href=\"\/ca\/tutorials\/n8n-queue-mode\">Read More&#8230;<\/a><\/p>\n","protected":false},"author":515,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"rank_math_title":"Configuring n8n in queue mode for improved scalability","rank_math_description":"Learn how to configure n8n in asynchronous queue mode. This guide walks you through setup, prerequisites, and setup for enhanced scalability.","rank_math_focus_keyword":"n8n queue mode","footnotes":""},"categories":[22701,22699],"tags":[],"class_list":["post-126122","post","type-post","status-publish","format-standard","hentry","category-pre-installed-applications","category-vps"],"hreflangs":[{"locale":"en-US","link":"https:\/\/www.hostinger.com\/tutorials\/n8n-queue-mode","default":0},{"locale":"en-UK","link":"https:\/\/www.hostinger.com\/uk\/tutorials\/n8n-queue-mode","default":0},{"locale":"en-IN","link":"https:\/\/www.hostinger.com\/in\/tutorials\/n8n-queue-mode","default":0},{"locale":"en-CA","link":"https:\/\/www.hostinger.com\/ca\/tutorials\/n8n-queue-mode","default":0},{"locale":"en-PH","link":"https:\/\/www.hostinger.com\/ph\/tutorials\/n8n-queue-mode","default":0},{"locale":"en-MY","link":"https:\/\/www.hostinger.com\/my\/tutorials\/n8n-queue-mode","default":0},{"locale":"en-AU","link":"https:\/\/www.hostinger.com\/au\/tutorials\/n8n-queue-mode","default":0},{"locale":"en-NG","link":"https:\/\/www.hostinger.com\/ng\/tutorials\/n8n-queue-mode","default":0}],"_links":{"self":[{"href":"https:\/\/www.hostinger.com\/ca\/tutorials\/wp-json\/wp\/v2\/posts\/126122","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.hostinger.com\/ca\/tutorials\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.hostinger.com\/ca\/tutorials\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.hostinger.com\/ca\/tutorials\/wp-json\/wp\/v2\/users\/515"}],"replies":[{"embeddable":true,"href":"https:\/\/www.hostinger.com\/ca\/tutorials\/wp-json\/wp\/v2\/comments?post=126122"}],"version-history":[{"count":13,"href":"https:\/\/www.hostinger.com\/ca\/tutorials\/wp-json\/wp\/v2\/posts\/126122\/revisions"}],"predecessor-version":[{"id":137167,"href":"https:\/\/www.hostinger.com\/ca\/tutorials\/wp-json\/wp\/v2\/posts\/126122\/revisions\/137167"}],"wp:attachment":[{"href":"https:\/\/www.hostinger.com\/ca\/tutorials\/wp-json\/wp\/v2\/media?parent=126122"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.hostinger.com\/ca\/tutorials\/wp-json\/wp\/v2\/categories?post=126122"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.hostinger.com\/ca\/tutorials\/wp-json\/wp\/v2\/tags?post=126122"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}