<div dir="ltr"><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Dec 9, 2015 at 6:32 AM, Stefan Viljoen <span dir="ltr"><<a href="mailto:viljoens@verishare.co.za" target="_blank">viljoens@verishare.co.za</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Hi guys<br>
<br>
I'm running 1.8.32.3 with CEL logging over ODBC to MariaDB 5.5.41 on the<br>
same Centos 7 machine.<br>
<br>
I've noticed that the CDR entries made are all in-time, e. g. the call will<br>
take place and the CDR entry is immediately written into the CDR table in<br>
the MariaDB database.<br>
<br>
However, CEL events for that CDR (which I need to process for a realtime<br>
display feature in my dialer software) are always several hours after the<br>
fact. E. g. I will make a call at 09:30, see the call immediate pop up in<br>
the MariaDB CDR table, but only at about 15:15 that afternoon will I see<br>
that call's CEL events come into the CEL table, from Asterisk.... I have<br>
examined the `show processlist` in MariaDB exhaustively to establish this<br>
fact.<br>
<br>
The system doesn't appear loaded, load average is about 1.1 - it's a<br>
quad-coare HT Intel Xeon E3-1225 with 8GB of DRAM running on an SSD for main<br>
storage.<br>
<br>
The system processes about 30 000 calls every 8 hour day, and services 90<br>
SIP phones.<br>
<br>
I can stop and restart the MariaDB instance for several minutes, when I<br>
restart it it immediately picks up on the "slow" CELs from where it was<br>
interrupted - more evidence that Asterisk is very slowly streaming the CELs<br>
through. I thought MariaDB was the bottleneck, but apparently not?<br>
<br>
If I make test inserts from a script into the CEL table, all of them<br>
complete so quickly a time indication does not even register for the query<br>
in MariaDB. Simple test queries on the CEL table are also instant, not even<br>
counting in the internal MariaDB query duration timer.<br>
<br>
Can anybody explain why this is that the CELs asterisk emits over ODBC are<br>
so delayed? Are CELs intended NOT to be realtime?<br>
<br>
So, logically, Asterisk appears to be caching CELs to the tune of hundreds<br>
of thousands of them at any given time - meaning if it is stopped (either<br>
killed, or core stop gracefully'ed, or just "core stop now")  potentially<br>
hundreds of thousands of CELs will just evaporate irretrivably.<br>
<br>
What can I do to mitigate this extremely slow populating of CELs over ODBC?<br clear="all"><br></blockquote><div><br></div><div>Asterisk does not buffer CEL entries. If anything, it pushes the entries out to ODBC much more aggressively than what you would get with CDRs.<br><br></div><div>An event is generated in Asterisk that corresponds to the CEL entry. That entry is pushed over a message bus (the 'event' message bus in 1.8 - 11; 'stasis' in 12+) and is picked up by the CEL core. The events are immediately sent to the registered backends, who also immediately write it out to the backend they support. In the case of ODBC, this immediately does an INSERT into the appropriate table.<br><br></div><div>In Asterisk 1.8, you can look for a verbose level 11 message that will show when this occurs:<br><br>        ast_verb(11, "[%s]\n", ast_str_buffer(sql));<br><br></div><div>In later versions, this was turned into a debug level 3 message (as anything over a verbose 5/debug 5 was cleaned up).<br></div><div><br></div><div>If you see that message, then that will tell you when Asterisk *believes* it has written the CEL entry. If that doesn't show up in the database, then it is either in the ODBC driver or the Maria database.<br><br></div><div>If you don't see that message, then something is preventing those events from getting delivered inside of Asterisk, which would only occur if you had some other serious call related issues occurring.<br></div><div><br></div><div>Matt<br></div><div><br></div></div>-- <br><div class="gmail_signature"><div dir="ltr"><div><div dir="ltr"><div>Matthew Jordan<br></div><div>Digium, Inc. | Director of Technology<br></div><div>445 Jan Davis Drive NW - Huntsville, AL 35806 - USA</div><div>Check us out at: <a href="http://digium.com" target="_blank">http://digium.com</a> & <a href="http://asterisk.org" target="_blank">http://asterisk.org</a></div></div></div></div></div>
</div></div>