.To measure the cost of OpenSIPS startup, i will use the environment variable LD_DEBUG which is used to instruct Linux dynamic linker to dump debug information. To display all valid options, execute:
# LD_DEBUG=help cat
Here I am using the default routing script of OpenSIPS. I will set the variable LD_DEBUG to the value “statistics” while starting OpenSIPS:
- # cd /etc/init.d
- # LD_DEBUG=statistics ./opensips start
19179: runtime linker statistics:
19179: total startup time in dynamic loader: 274776 clock cycles
19179: time needed for relocation: 51512 clock cycles (18.7%)
It took 274776 cycles to startup OpenSIPS on my device.
To decrease the latency after startup, we load all dynamic libraries at startup. Dynamic Libraries can be instructed to load at system startup by setting the environment variable LD_BIND_NOW to 1.
- # LD_BIND_NOW=1 LD_DEBUG=statistics ./opensips start
19211: runtime linker statistics:
19211: total startup time in dynamic loader: 308553 clock cycles
19211: time needed for relocation: 47668 clock cycles (15.4%)
With LD_BIND_NOW=1 it took 308553 cycles on startup. They are nearly the same. This means OpenSIPS already load all dynamic libraries at startup. This eliminate the latency of loading after the startup while processing SIP messages. Good Job !
What actually happens is: When OpenSIPS parses the configuration file, it loads all the modules that are configured in the configuration file. The statement loadmodule (Module_Name) corresponds to loading the shared library named Module_Name.
After parsing, the configuration file is not needed any more.