Two identical servers, 1 always has a 2sec delay on workflow trigger

Describe the problem/error/question

I have two identically configured servers.
Both have the .env in root n8n folder with:
EXECUTIONS_PROCESS=main

And yet one of them behaves as though it is running with the “own” configuration where every webhook trigger takes 2 seconds to start.

Is it possible to verify what configuration a running instance of n8n is using? own vs main.

Neither of them use any other config files except docker-compose.yml

The logs don’t seem to give any indication, nor does running n8n in non-daemon mode.

any clues as to how to solve this would be much appreciated. I feel like I’ve exhausted everything I can think of.

Information on your n8n setup

  • n8n version: 0.222.3 on both
  • Database postgres15 on both
  • n8n EXECUTIONS_PROCESS setting : I hope it’s MAIN on both, but I don’t think so!
  • Running n8n via : docker compose
  • Operating system: ubuntu 22.04.1

Hi @davidbamboo - thanks for getting in touch about this!

Both myself and @MutedJam aren’t too sure what’s going on here by this description, as we can’t reproduce this based on what information you’ve provided. Can you let us know what service(s) you might be running n8n on? If you’re using a VPS there might be different loads on them, where one of your shared servers is a particularly busy server (and the other one isn’t).

I’ve been diagnosing this issue with n8n for the last year.

Neither of these servers is busy at all. But a few of the workflows really depend on having an instant response to a webhook (autocomplete lookups)

With the server that has instant responses, I had finally completely started from scratch and by some stroke of magic it worked. I then cloned that machine, followed all the same steps, and it didn’t work.
Somewhere something isn’t functioning correctly.

These are both on Linode 2cpu 4gb ram ubuntu 22.04 vps’s.

I’ve confirmed with multiple workflows, that are identical on both machines, that there is always a ~2sec delay on the one.

I just need to confirm that n8n is running in “main” mode. is there anyway to know that definitively?

Thanks a bunch

The only thing I can think of that is not standard, is that I disable traefik because I use cloudflare tunnels to reverse proxy.

Here is my docker-compose.yml



version: "3"

services:
#  traefik:
#    image: "traefik"
#    restart: always
#    command:
#      - "--api=true"
#      - "--api.insecure=true"
#      - "--providers.docker=true"
#      - "--providers.docker.exposedbydefault=false"
#      - "--entrypoints.web.address=:80"
#      - "--entrypoints.web.http.redirections.entryPoint.to=websecure"
#      - "--entrypoints.web.http.redirections.entrypoint.scheme=https"
#      - "--entrypoints.websecure.address=:443"
#      - "--certificatesresolvers.mytlschallenge.acme.tlschallenge=true"
#      - "--certificatesresolvers.mytlschallenge.acme.email=${SSL_EMAIL}"
#      - "--certificatesresolvers.mytlschallenge.acme.storage=/letsencrypt/acme.json"
#    ports:
#      - "80:80"
#      - "443:443"
#    volumes:
#      - ${DATA_FOLDER}/letsencrypt:/letsencrypt
#      - /var/run/docker.sock:/var/run/docker.sock:ro
# 
  n8n:
    image: n8nio/n8n
    restart: always
    ports:
      - "127.0.0.1:5678:5678"
    labels:
      - traefik.enable=false
      - traefik.http.routers.n8n.rule=Host(`${SUBDOMAIN}.${DOMAIN_NAME}`)
      - traefik.http.routers.n8n.tls=true
      - traefik.http.routers.n8n.entrypoints=web,websecure
      - traefik.http.routers.n8n.tls.certresolver=mytlschallenge
      - traefik.http.middlewares.n8n.headers.SSLRedirect=true
      - traefik.http.middlewares.n8n.headers.STSSeconds=315360000
      - traefik.http.middlewares.n8n.headers.browserXSSFilter=true
      - traefik.http.middlewares.n8n.headers.contentTypeNosniff=true
      - traefik.http.middlewares.n8n.headers.forceSTSHeader=true
      - traefik.http.middlewares.n8n.headers.SSLHost=${DOMAIN_NAME}
      - traefik.http.middlewares.n8n.headers.STSIncludeSubdomains=true
      - traefik.http.middlewares.n8n.headers.STSPreload=true
      - [email protected]
    environment:
      - DB_TYPE=postgresdb
      - DB_POSTGRESDB_HOST=${POSTGRES_HOST}
      - DB_POSTGRESDB_PORT=5432
      - DB_POSTGRESDB_DATABASE=${POSTGRES_DB}
      - DB_POSTGRESDB_SCHEMA=n8n
      - DB_POSTGRESDB_USER=${POSTGRES_NON_ROOT_USER}
      - DB_POSTGRESDB_PASSWORD=${POSTGRES_NON_ROOT_PASSWORD}
      - N8N_BASIC_AUTH_ACTIVE=true
      - N8N_BASIC_AUTH_USER
      - N8N_BASIC_AUTH_PASSWORD
      - N8N_HOST=${SUBDOMAIN}.${DOMAIN_NAME}
      - N8N_PORT=5678
      - N8N_PROTOCOL=https
      - NODE_ENV=production
      - WEBHOOK_URL=https://${SUBDOMAIN}.${DOMAIN_NAME}/
      - GENERIC_TIMEZONE=${GENERIC_TIMEZONE}
    volumes:
      - ${DATA_FOLDER}/.n8n:/home/node/.n8n
    # Wait 5 seconds to start n8n to make sure that PostgreSQL is ready
    # when n8n tries to connect to it
    command: /bin/sh -c "sleep 5; n8n start"
1 Like

and here is the .env

# Folder where data should be saved
DATA_FOLDER=/home/xxxxxxxxx/n8n/

# The top level domain to serve from
DOMAIN_NAME=xxxxxxxxx.com

# The subdomain to serve from
SUBDOMAIN=xxxxxxxxx

# DOMAIN_NAME and SUBDOMAIN combined decide where n8n will be reachable from
# above example would result in: https://n8n.example.com

# The user name to use for autentication - IMPORTANT ALWAYS CHANGE!
N8N_BASIC_AUTH_USER=xxxxxxxxx

# The password to use for autentication - IMPORTANT ALWAYS CHANGE!
N8N_BASIC_AUTH_PASSWORD=xxxxxxxxx

# Optional timezone to set which gets used by Cron-Node by default
# If not set New York time will be used
GENERIC_TIMEZONE=America/Vancouver

# The email address to use for the SSL certificate creation
[email protected]

# postgres info
POSTGRES_DB=xxxxxxxxx
POSTGRES_NON_ROOT_USER=xxxxxxxxx
POSTGRES_NON_ROOT_PASSWORD=xxxxxxxxx
POSTGRES_HOST=xxxxxxxxx

## this param added to correct the SES errors per https://community.n8n.io/t/error-on-sending-html-email-with-amazon-ses/3773/5
N8N_USE_DEPRECATED_REQUEST_LIB=true

## lets store the encryption key here instead:
N8N_ENCRYPTION_KEY=xxxxxxxxx+xxxxxxxxx

EXECUTIONS_PROCESS=main
#EXECUTIONS_PROCESS=own
#EXECUTIONS_MODE=regular

#N8N_LOG_LEVEL=debug
#N8N_LOG_OUTPUT=file,console
#N8N_LOG_FILE_LOCATION=/home/xxxxxxxxx/n8n/logs/n8n.log
#DB_LOGGING_ENABLED=true

#### disable telemetry
N8N_DIAGNOSTICS_ENABLED=false
N8N_VERSION_NOTIFICATIONS_ENABLED=false
N8N_TEMPLATES_ENABLED=false
EXTERNAL_FRONTEND_HOOKS_URLS=
N8N_DIAGNOSTICS_CONFIG_FRONTEND=
N8N_DIAGNOSTICS_CONFIG_BACKEND=
## other random
N8N_TEMPLATES_ENABLED=false
EXECUTIONS_DATA_PRUNE=true
EXECUTIONS_DATA_MAX_AGE=720
EXECUTIONS_DATA_PRUNE_TIMEOUT=3600

1 Like

Hi @davidbamboo - thanks for the additional context, and for providing your configuration files.

It looks like EXECUTIONS_PROCESS isn’t specifically set. I’d suggest adding in EXECUTIONS_PROCESS=main as well to your docker compose file as a next step to troubleshoot. Just as a heads up, it looks like you have the env file set up, but your Docker compose file isn’t actually reading those variables for the executions process :see_no_evil:

THANK YOU! You are absolutely correct! The other server had this in it’s docker-compose.yml

      - EXECUTIONS_PROCESS=main

At some point I guess I had tried that to troubleshoot and forgot to apply it to the other server.

Does this mean that unless it is a sensitive credential, I should probably be putting most things in the docker-compose.yml ?

It would be awesome to add this little tidbit to the docs if it isn’t a bug.

Thanks a bunch!

2 Likes

Hi @davidbamboo - so glad this is now fixed up for you!

While there’s a myriad ways to set up Docker, I personally keep everything in docker-compose.yml just for simplicity’s sake :sweat_smile:

1 Like

ok. I see that I needed to edumacate myself further on how .env to the docker-compose.yml

It looks like I had it setup incorrectly.

This is enlightening me: Ways to set environment variables in Compose | Docker Documentation

2 Likes

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.