Webhook Handler Under High Load Causes Idle Queries and DB Connection Limit Issues

Hi everyone,

I’m currently facing a technical issue with a webhook handler I’ve implemented in Creatio.

Background:

  • I have a webhook endpoint that gets called by an external system at a rate of approximately 150 hits per second.
  • The Creatio database has a maximum connection limit of 400 connections.

The Problem:

During high load, I observed that the number of open database connections increases rapidly, and some queries are left idle (idle in transaction) even after the handler completes its process.

This leads to:

  • Exhaustion of available database connections
  • Timeout errors on other operations
  • Overall system unresponsiveness

What I’ve Tried So Far:

  1. I modified the data access code by changing queries from <strong>ESQ</strong> (EntitySchemaQuery) to direct <strong>Entity</strong> usage.
  2. I manually handled database connections by using:
    • using (DBConnection dbConnection = new DBConnection(...)) { ... }
    • Explicit calls to .Close() and .Dispose() on connections to ensure cleanup.

Despite these adjustments, I'm still seeing idle queries accumulating under high load.

My Questions:

  1. What could be the possible reasons why queries remain idle even after the handler has completed?
  2. Are there any known best practices in Creatio for managing database connections under high request volumes like this?
  3. Is there a proper way to ensure <strong>UserConnection</strong> or underlying connections are completely released, especially in high-frequency webhook scenarios?

I would really appreciate any insights, suggestions, or shared experiences that could help resolve this issue.

Thank you in advance!

Like 1

Like

0 comments
Show all comments