These are some areas to consider when trying to performance tune your Asterisk installation.
There are two threadpools of interest: pjsip and stasis.
system section of pjsip.conf (or the ps_systems table in the database) contains 2 settings that control the threadpool used for the stack:
Although the stasis message bus is not used much for simple call processing, it is used heavily for ARI and AGI processing, transfers, conference bridges, AMI, CDR and CEL processing, etc. The threadpool is configured in stasis.conf:
If you don't need AMI, CDR, or CEL then disabling those modules will reduce resource usage. The CDR module uses a lot of processing to create the CDR records and can easily get backed up on a busy system.
PJSIP Protocol Tuning
timer_b settings are in the
system section of pjsip.conf (or the ps_systems table in the database)
The order in which endpoint identification methods are tried when an incoming request is received directly affects transaction rate. The default order is set in the
global of pjsip.conf (or the ps_globals table in the database).
While storing pjsip objects in the pjsip.conf results in the fastest access time during call processing, a config change requires the entire file to be re-written and the res_pjsip module to be reloaded. Using backend database for storage is most convenient for configuration but will be slowest for access time during call processing. The solution is to use the database for storage and use sorcery to cache the objects. This will result in the same access times as using pjsip.conf.
Setting up caching
The sorcery caches are defined in sorcery.conf.
Flushing the caches:
sorcery memory cache Asterisk CLI commands will allow flushing caches and individual objects from a specific cache. There are also equivalent AMI commands (SorcerymemoryCache*) that do the same. After you make all pjsip configuration changes, call the appropriate AMI commands to flush objects and caches where appropriate. This is necessary for Asterisk to see the changes made in the database immediately.