Webhook Performance Issues on N8N with Postgres

Describe the problem/error/question

I am currently running n8n docker on my local machine. I am running some stress tests on it to see if it is something we want to use in production. I am having a very weird issue I can’t seem to figure out.

What I am trying to do is test to see how many background processes I can have to determine performance, queueing, etc. I have a very simple code to test this. What I expect this to do is return the webhook right away, then queue the rest of the processes to be run. In reality there would be a bunch of stuff executed instead of wait, but I am just adding that to “simulate” stuff happening.

If I use sqlite, when I do my stress test, I can get it to run at about 33 requests per second using k6 to test it. The only change I make to the config is to use postgres instead of sqlite and that drops down to just over 1 per second.

When I use postgres, what seems to happen is it gets to about 5-6 processes being handled by the workers, and about 5-6 processes queued (saved in postgres), then every other webhook is just waiting in the browser for processes to be finished (did not return anything). What I expect to it to do is keep filling the queue.

When I use sqlite, it does what I expect and loads the queue with over 300 requests.

Any ideas what setting I need to change to get this behaviour to work with postgres? I don’t think it is a postgres issue because I am able to query the database just fine while the browser is hanging.

Please share your workflow

Information on your n8n setup

  • n8n version: 1.72.1
  • Database (default: SQLite): postgres
  • n8n EXECUTIONS_PROCESS setting (default: own, main): not set (depricated?, using EXECUTIONS_MODE=true)
  • Running n8n via (Docker, npm, n8n cloud, desktop app): docker
  • Operating system: windows 11

Environment variables set:

      - N8N_ENCRYPTION_KEY=<random string>
      - DB_TYPE=postgresdb
      - DB_POSTGRESDB_DATABASE=postgres
      - DB_POSTGRESDB_HOST=n8n_postgres
      - DB_POSTGRESDB_PORT=5432
      - DB_POSTGRESDB_USER=postgres
      - DB_POSTGRESDB_PASSWORD=<random string>
      - N8N_DISABLE_UI=false
      - N8N_DIAGNOSTICS_ENABLED=false
      - N8N_VERSION_NOTIFICATIONS_ENABLED=false
      - N8N_TEMPLATES_ENABLED=false
      - N8N_HIRING_BANNER_ENABLED=false
      - N8N_PUBLIC_API_SWAGGERUI_DISABLED=false
      - N8N_METRICS=true
      - EXECUTIONS_MODE=queue
      - N8N_HIDE_USAGE_PAGE=true
      - QUEUE_BULL_REDIS_HOST=172.17.0.1
      - QUEUE_BULL_REDIS_PORT=6379
      - N8N_DISABLE_PRODUCTION_MAIN_PROCESS=true
      - EXECUTIONS_DATA_SAVE_ON_ERROR=none
      - EXECUTIONS_DATA_SAVE_ON_SUCCESS=none

Hi @burgoyn1

Thanks for posting here and welcome to the community! :tada:
That’s pretty neat what you’re doing :slight_smile: Keep us posted!

Since you’ve got EXECUTIONS_MODE=queue you can increase the amount of concurrent jobs a worker can do (with N8N_CONCURRENCY_PRODUCTION_LIMIT) as well as the workers themselves.

Check out some helpful references:

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