Best practices¶
Recommendations for interfaces that stay fast, reliable and easy to support in production.
Interface design¶
- Keep synchronous requests short. If processing takes more than about 2.5 seconds, queue the work and return a reference immediately.
- Use one error flow. Send every Error link to a shared flow that records the failure in IConDb and alerts your support team.
- Use a consistent response format for every endpoint, so callers handle success and failure the same way.
- Keep configuration in the Common Store, not hard-coded in components, so the same interface can move between environments.
Databases¶
-
Keep transactions short when multi-threaded interfaces update the same tables, to reduce blocking and deadlocks.
-
Guard updates with the expected state so two threads can't process the same record:
SQL
UPDATE InboundQueue
SET Status = 'PROCESSED', ProcessedDate = GETDATE()
WHERE Id = @RecordId
AND Status = 'PENDING';
-
Check the affected row count. Zero rows means another thread already took the record.
-
Use
READ UNCOMMITTEDonly for reporting reads where dirty data is acceptable; it doesn't prevent deadlocks on updates.
Performance¶
- Use
ProcessMethodBatchfor high-volume files where components can work on many rows at once, and StartComponent links to run independent work in parallel. - Turn on detailed logging only while testing or troubleshooting.
- Don't use the Sleep component to throttle production flows.
Queues¶
- Pre-create transactional queues with scripts so every environment matches.
- Grant the service account the queue permissions it needs, and no more.
- Monitor queue depth; a growing backlog is the earliest sign of a stopped worker.
Maintenance¶
- Archive IConDb message history on a schedule (see Monitor and manage interfaces).
- Keep third-party libraries, such as Newtonsoft.Json, at the same version on the i-Con Client and the server.