Slow external python task runner

Describe the problem/error/question

After upgrading to 2.0.1 (from v1 without external task runners) native python nodes take at least 1s to run, nothing runs under 1 second. JS code node runs flawlessly and fast.

Deployment Details

docker-compose:

services:
  postgres:
    image: postgres:17
    container_name: n8n-postgres
    restart: always
    environment:
      - POSTGRES_USER=n8n
      - POSTGRES_PASSWORD=your_postgres_password
      - POSTGRES_DB=n8n
      - TZ=your_timezone
    volumes:
      - n8n_postgres_data:/var/lib/postgresql/data
    healthcheck:
      test: ['CMD-SHELL', 'pg_isready -U n8n -d n8n']
      interval: 5s
      timeout: 5s
      retries: 10

  task-runners:
    image: n8nio/runners:2.0.1
    container_name: n8n-runners
    environment:
      - N8N_RUNNERS_LAUNCHER_LOG_LEVEL=info
      - N8N_RUNNERS_TASK_BROKER_URI=http://n8n:5688
      - N8N_RUNNERS_AUTH_TOKEN=your_runners_auth_token
      - N8N_RUNNERS_MAX_CONCURRENCY=20
      - N8N_RUNNERS_AUTO_SHUTDOWN_TIMEOUT=600
    volumes:
      - ./n8n-task-runners.json:/etc/n8n-task-runners.json
    depends_on:
      - n8n
      
  n8n:
    image: docker.n8n.io/n8nio/n8n:2.0.1
    container_name: n8n
    restart: always
    ports:
      - "127.0.0.1:5678:443"
    environment:
      - N8N_LOG_LEVEL=info
      - N8N_CONCURRENCY_PRODUCTION_LIMIT=20
      - N8N_ENCRYPTION_KEY=your_encryption_key
      - DB_TYPE=postgresdb
      - DB_POSTGRESDB_DATABASE=n8n
      - DB_POSTGRESDB_HOST=n8n-postgres
      - DB_POSTGRESDB_PORT=5432
      - DB_POSTGRESDB_USER=n8n
      - DB_POSTGRESDB_PASSWORD=your_postgres_password
      - N8N_PROTOCOL=https
      - N8N_HOST=n8n.example.com
      - N8N_PORT=443
      - N8N_EDITOR_BASE_URL=https://n8n.example.com/
      - WEBHOOK_URL=https://n8n.example.com/
      - N8N_TEMPLATES_ENABLED=true
      - N8N_ENFORCE_SETTINGS_FILE_PERMISSIONS=true
      - N8N_PROXY_HOPS=1
      - TZ=your_timezone
      - GENERIC_TIMEZONE=your_timezone
      - N8N_RUNNERS_MODE=external
      - N8N_RUNNERS_AUTH_TOKEN=your_runners_auth_token
      - N8N_RUNNERS_BROKER_PORT=5688
      - N8N_RUNNERS_BROKER_LISTEN_ADDRESS=0.0.0.0
      - N8N_RUNNERS_MAX_CONCURRENCY=10
    volumes:
      - n8n_data:/home/node/.n8n
    depends_on:
      postgres:
        condition: service_healthy

volumes:
  n8n_postgres_data:
  n8n_data:

n8n-task-runners:

{
  "task-runners": [
    {
      "runner-type": "javascript",
      "workdir": "/home/runner",
      "command": "/usr/local/bin/node",
      "args": [
        "--disallow-code-generation-from-strings",
        "--disable-proto=delete",
        "/opt/runners/task-runner-javascript/dist/start.js"
      ],
      "health-check-server-port": "5681",
      "allowed-env": [
        "PATH",
        "GENERIC_TIMEZONE",
        "NODE_OPTIONS",
        "N8N_RUNNERS_AUTO_SHUTDOWN_TIMEOUT",
        "N8N_RUNNERS_TASK_TIMEOUT",
        "N8N_RUNNERS_MAX_CONCURRENCY",
        "N8N_SENTRY_DSN",
        "N8N_VERSION",
        "ENVIRONMENT",
        "DEPLOYMENT_NAME",
        "HOME"
      ],
      "env-overrides": {
        "NODE_FUNCTION_ALLOW_BUILTIN": "crypto",
        "NODE_FUNCTION_ALLOW_EXTERNAL": "moment",
        "N8N_RUNNERS_HEALTH_CHECK_SERVER_HOST": "0.0.0.0"
      }
    },
    {
      "runner-type": "python",
      "workdir": "/home/runner",
      "command": "/opt/runners/task-runner-python/.venv/bin/python",
      "args": [
        "-m",
        "src.main"
      ],
      "health-check-server-port": "5682",
      "allowed-env": [
        "PATH",
        "N8N_RUNNERS_LAUNCHER_LOG_LEVEL",
        "N8N_RUNNERS_AUTO_SHUTDOWN_TIMEOUT",
        "N8N_RUNNERS_TASK_TIMEOUT",
        "N8N_RUNNERS_MAX_CONCURRENCY",
        "N8N_SENTRY_DSN",
        "N8N_VERSION",
        "ENVIRONMENT",
        "DEPLOYMENT_NAME"
      ],
      "env-overrides": {
        "PYTHONPATH": "/opt/runners/task-runner-python",
        "N8N_RUNNERS_STDLIB_ALLOW": "*",
        "N8N_RUNNERS_EXTERNAL_ALLOW": ""
      }
    }
  ]
}

What is the error message (if any)?

Workflows runs successfully, but are extremely slow.

Please share your workflow

The issue is not specific to a particular workflow. Even an empty workflow with only the default code in the python native code node takes +1s to run.

Share the output returned by the last node

Not applicable

Information on your n8n setup

  • n8n version: 2.0.1
  • Database (default: SQLite): Postgres
  • n8n EXECUTIONS_PROCESS setting (default: own, main): v2 default
  • Running n8n via (Docker, npm, n8n cloud, desktop app): docker
  • Operating system: Ubuntu 24.04.3 LTS
1 Like

I’m having a similar experience. There seems to be a lag before execution.

Debug info

core

  • n8nVersion: 2.2.4
  • platform: docker (self-hosted)
  • nodeJsVersion: 22.21.1
  • nodeEnv: production
  • database: postgres
  • executionMode: scaling (single-main)
  • concurrency: -1
  • license: community
  • consumerId: unknown

storage

  • success: all
  • error: all
  • progress: false
  • manual: true
  • binaryMode: database

pruning

  • enabled: true
  • maxAge: 336 hours
  • maxCount: 10000 executions

client

  • userAgent: mozilla/5.0 (windows nt 10.0; win64; x64) applewebkit/537.36 (khtml, like gecko) chrome/143.0.0.0 safari/537.36
  • isTouchDevice: false

Generated at: 2026-01-11T03:00:59.822Z

1 Like