CDR custom variables - Performance Issues

Dear Asterisk Community,

I am building an Asterisk solution (high level architecture: SIP trunk, Opensips + Asterisk configuration, PJSIP connectivity) and I am currently performing stress tests on the platform.
I observed delays, in case of concurrent calls, however the number is not quite large (fewer than 200 concurrent calls), in order to justify this behavior.
After investigating the logs, I found out that the delays are inserted, when dialplan tries to handle CDR variables.

Let me here explain a bit: I have introduced a large number of CDR custom variables (25 of them) that are needed for my solution (they are written to DB via ODBC at the end of the call). When the dialplan tries to set to a custom CDR variable a value (e.g. CDR(custom_var1)=30, CDR(custom_var2)=10, etc), I can see from the logs that it may be needed a couple of seconds in order to process the corresponding command. The delays seem to be created from these commands.

I tried to investigate if the large number of custom CDR variables can have an impact on the performance.
I found the performance tuning page ( Performance Tuning - Asterisk Project - Asterisk Project Wiki ), I set up the statis.conf according to the proposed values (not the PJSIP, do I need to configure also PJSIP threadpool?). The situation was improved, however issue still remains.
I tried to perform an initialization of all custom CDR variables via ARRAY(), in order to allocate memory for all custom CDR variables once. But the problem was not solved.

How could I handle this issue? The large number of custom CDR variables can indeed create a performance issue? Is there a proposed configuration that could solve the problem?
If issue could not be solved otherwise, I will collect all the data needed (via non-CDR variables) and send them to DB via ODBC once the call is ended (at hangup handler). However, the CDR solution is more straightforward and I would like to use an existing functionality of Asterisk for my solution.

Thank you all in advance for your time and interest.

There is no configuration to work around such a thing, it’s a consequence of the implementation and changing it would require major threading changes to the way CDRs work.

Did you try to write CDR to external mysql cluster ?

voip.vom.vn, the delays are inserted at the handling of the CDR variables, not at the writing to the DB. So, there is no point at changing where they are written to.

So, jcolp, your opinion is that the way that Asterisk implements the CDR variables, the extra custom CDR variables can cause such delays, correct? And the only way to avoid them would be to avoid at all the extra custom CDR variables.

It’s possible, yes, if there’s contention in the CDR system. I haven’t tested such things personally.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.