On 14/02/2017 14:36, Daniel Tryba wrote:
On Tue, Feb 14, 2017 at 02:27:59PM +0100, Igor
Potjevlesch wrote:
Looks to be a good idea.
I use MySQL and MyISAM, so I understand that async is supported.
Async
(db_insert_mode=2) is supported with any (acc)backend. With myisam you
can use delayed inserts (db_insert_mode=1). But without even looking at
the kamailio implementation I'd guess that 2 is the better choice in the
hope that the sql operation is entirely done in an other thread, with 1
there might be the chance that setting up/reusing connections might
block (since insert delayed is a feature on the mysql server side that
just returns an OK before any writes to disk).
How should I dimension the number of
async_workers?
I set it to 2, but for acc and a few async sql_ops calls that should
be
overkill. I have no metrics to make a better assumption on the number of
worker threads.
... ahh, forgot to say that even with async query, the insert can still
fail if the db operations take too long, because of the timeout value
set to db_mysql. So if the bottleneck is the mysql server, it doesn't
matter how many async workers you create. I typically start 4, but use
them for more than async sql queries.
Cheers,
Daniel
--
Daniel-Constantin Mierla
www.twitter.com/miconda --
www.linkedin.com/in/miconda
Kamailio Advanced Training - Mar 6-8 (Europe) and Mar 20-22 (USA) -
www.asipto.com
Kamailio World Conference - May 8-10, 2017 -
www.kamailioworld.com