-
Notifications
You must be signed in to change notification settings - Fork 1
N8N Good Practices
divyansh edited this page Jun 7, 2023
·
1 revision
Running the workflow:
- Don’t schedule the workflow to run every min or every few minutes if you don’t need it. It can cause memory issues for everyone using n8n (memory is shared between all the OFN n8n accounts). If you need to run the workflow frequently then you can schedule it to run every 10 mins or more.
- Timezone: If you want to run the workflow at a specific time in a day, then make sure the timezone for the workflow is correct. THIS NEEDS TO BE DONE FOR EACH WORKFLOW.
- Go to the workflow, then click on the 3-dots in top right corner. Then click on settings (It is settings menu for that workflow, not the general n8n settings) and set the correct timezone for that workflow
Credentials:
- Avoid using super admin credentials for workflows
- Name the credential properly to avoid confusion. Suggested format: Instance tag/code - client if any - app (gmail/airtable etc.) Ex. Aus-TPC-Airtable login. Avoid using pre-set names like gmail, gmail1 etc. for the credentials
Testing:
- It's good practice to test each node one by one and then test the whole workflow.
- Always test the workflow with dummy details in action modules (ex. email, text etc.) before using it for actual customer/client. i.e. using dummy data in action modules instead of mapping it with actual data or using dummy initial data (ex. dummy airtable records)
- If you are testing a workflow with lot of data ex. big customer list (say 1000), then limiting the
Notes:
- Its good practice to add notes if you are building a new workflow, as it can help others to understand the logic behind the workflow and can also help you to check the workflow if there is an error.
Error Handling:
- n8n doesn’t have error handling modules like Integromat/Make. It has Error workflows, i.e. you can set up another workflow to run if there is an error.
Workflow setup:
- Naming of modules in a workflow: Its a good idea to add some relevant names to individual modules ex. rather than just having bunch of airtable modules, we can name them as: Reading customer list from airtable, Updating customer status etc.
- Running big requests (API rate limits and Memory Consumption issues): More content to be added for this one
- Some websites and databases have a rate limit for API calls, i.e. they limit the number of API calls which can be performed in a given time. Ex. Airtable API has a rate limit of 5 requests/sec. Now, this API rate limit can lead to errors in the workflow if you have 100s of items/requests coming through in a workflow, as n8n tries to process everything as fast as it can. To avoid this you can use the “Batch Size” and “Batch Interval” options of the HTTP call module. This basically divides all the requests into batches, i.e. if you have 100 items coming through to the HTTP module, then a batch size of 10 and batch interval of 2000 ms will run 10 requests every 2 secs (2000ms).
- Alternatively, you can use Split in Batches node
- or Use multiple sub workflow to run parts of the whole workflow to avoid huge memory consumption at once.
- or Use multiple workflows by allocating a portion of input data for each identical workflow.
Backup/Saving the workflow:
- Temporary measure: At present we don’t have auto-backup for n8n (due to operational issues - ongoing work). So, if you are building a big and complex workflow, then it might be good idea to regularly download your draft workflow as a backup.