When submitting records to an application, inconsistencies can result if you’re using a concurrency level greater than one and the records arrive at the destination out of order. However, you can use concurrency settings to prevent duplicate records and preserve the order of records.
- What is concurrency?
- Possible problems with concurrency
- Keep your records accurate
What is concurrency?
Concurrency lets you make multiple requests to an API at the same time. Setting your concurrency level to two or higher improves your flow’s speed and performance because you can process, change, and update multiple records simultaneously.
Example: Let’s say that you want to create an integration between NetSuite and Shopify, and every time you place an order in Shopify it automatically gets sent to NetSuite. If your concurrency level is set to five, then your flow will submit orders 5x faster than if it were set to only one.
Note: Reference the API documentation for the app or system that you’re integrating with to verify that your concurrency level does not exceed the number of simultaneous requests allowed by the system. For more information on setting concurrency, see Assign concurrency levels to data transfer.
Possible problems with concurrency
When you use multiple concurrencies, messages can return simultaneously and get processed out of order. While this is rare, you can mitigate the possibility by setting up the Concurrency Lock ID Template.
Example: A customer updates their customer profile on a website and then immediately realizes they have entered the wrong phone number. They quickly edit their profile and save it again. Since these two events (the initial update and the edit) happen in quick succession, they may be handled by the same run of an integration flow. If concurrency is set to a level greater that one, the two updates might be processed in parallel, and the first update might be applied after the second. In such a case, the resulting customer record would retain the errant phone number.
Keep your records accurate
Edit the Concurrency ID lock template setting to ensure the records are always processed in the correct order. Enter one or more fields from your records to construct a unique key for each record. With the unique key (that you define), integrator.io will not process any two records with the same unique key value simultaneously, and records with duplicate key values will always be processed in the correct order. If two or more records that do not have the same unique key value come in at the same time, they will continue to be processed in parallel (preserving optimized flow performance for unrelated records).
Navigate to the Concurrency ID lock template field
- Open the Edit import form for your import.
- At the bottom of the import configuration form, under Advanced settings find the Concurrency ID lock template field.
- In the Advanced settings section, find the Concurrency ID lock template field.
- Enter a handlebars expression to reference the field you want to use as the unique key (wrapped in three sets of curly brackets) to process records in the order that changes are received. For example:
- Click Save.
Build concurrency ID lock template
Click the pencil icon () to the right of the Concurrency ID lock template field to open the editor.
- Type your handlebars template here: Enter the handlebars expression you want to use as your template.
- Resources available for your handlebars template: This displays sample data to test your expression.
- Evaluated handlebars template: This displays the value captured by your handlebars expression that would be used when processing the sample record.
- Save: Click Save or Save & close to save your configuration.
If I'm using a string for my concurrency ID which may have spaces, do I need to include quotes around the template? For example, would this work:
Or are the quotes unnecessary?
Hi Stephen Lemp,
If you add quotes in the manner you suggest above, the quotes will be added to the value extracted from the customer_name field.
For example if the record is:
Tom Santiago, thanks for responding. So my follow up question would be, how does a space affect concurrency lock id? Does the Lock ID allow for spaces?
Please sign in to leave a comment.