I have a cron job workflow that is very simple:
- HTTP Request to get data
- Function node to parse result (to one item)
- HTTP Request to post the parsed data to another API
Normally, it only takes 0.5 seconds to 3 seconds, sometimes if the data is larger like 3000KB, it will take 14s to finish the whole workflow.
But today I found an execution, the data was only 500KB, and it takes 68 minutes to finish, I check the API, no timeout(response immediately).
Are there any ways to check where the execution stuck?
Hey @petersiow, welcome to the community! I am sorry to hear you’re having trouble.
But today I found an execution, the data was only 500KB, and it takes 68 minutes to finish, I check the API, no timeout(response immediately).
Can you confirm where you got the two values (immediately + 68 minutes) from?
On a general note, when debugging things my first step would be to enable debug logging (described here) and then taking a look at the server logs for the respective time range.
Some possible causes for a slow n8n instance could be a high load on either the server itself or a large/slow database. For the latter you could consider implementing a pruning strategy as described here. Be careful though, when using SQLite and enabling DB_SQLITE_VACUUM_ON_STARTUP, your first n8n startup will take a very long time - so you might want to do this outside of your core business hours.
Thanks @MutedJam
I check the executions log (on the n8n panel), and it shows the running time is 68 minutes.
About the “response immediately”: I checked the timestamps of the cronjob start time and the access log of the API server (steps 1&3). Both of them are very close (diff only a few seconds). It should be able to prove that there is no timeout or stuck. Therefore I think all the nodes work correctly and get the result immediately.
I agree that the large/ slow database is one of the reasons to cause this. Due to our n8n having many cronjobs being run simultaneously and in high frequency, it keeps so many execution logs.
I will try to prune the execution log, refine the schedule of the tasks, and see if it solves the problem.
Thank you 