[asterisk-dev] Optimize CDR batch mode
Gabriel Ortiz Lour
ortiz.admin at gmail.com
Mon Jun 15 23:21:23 CDT 2020
Hi all,
I was looking around cdr batch mode and I think that should be two
signalling functions:
ast_cdr_batch_start();
ast_cdr_batch_finish();
This two functions would tell all the BackEnds about the batch mode
happening, so in the PGSQL backend the CDR loading could be done in a
single COPY sql command, which is much faster than single INSERTs
Sounds like a small addition for having a much faster CDR insertion
Gabriel Ortiz
The do_batch_backend_process would look like this:
static void *do_batch_backend_process(void *data)
{
struct cdr_batch_item *processeditem;
struct cdr_batch_item *batchitem = data;
ast_cdr_batch_start();
/* Push each CDR into storage mechanism(s) and free all the memory */
while (batchitem) {
post_cdr(batchitem->cdr);
ast_cdr_free(batchitem->cdr);
processeditem = batchitem;
batchitem = batchitem->next;
ast_free(processeditem);
}
ast_cdr_batch_finish();
return NULL;
}
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-dev/attachments/20200616/6060b5ca/attachment-0001.html>
More information about the asterisk-dev
mailing list