Search code examples
mysqlejabberd

Understanding odbc_pool_size in ejabberd.yml


in ejabberd.yml we have following line :

##
## Number of connections to open to the database for each virtual host
##
## odbc_pool_size: 10

we are running mysql enabled ejabberd server. MySql server connection limit is 300.

After doing research online (on very limited documentation available) , it seems like increase odbc_pool_size from default 10 mainly affects (decreases) the connecting time of client to server. we have an average of ~1500 users online at one given time instance.

My question : what exact purpose does odbc_pool_size variable serve. How will increasing the pool size affect server connect time / latency ?

UPDATE

Ejabberd Server stats :

  • 8 gb RAM
  • Dual core
  • ~2000 users (peak hours)
  • average cpu utilaztion 13.5%

MySql Server stats:

  • max supported simultaneous connection: 300
  • write IOPS (QPS) 23.1/sec
  • read IOPS 1/sec
  • Memory usage : 2.5/15gb

According to you what will be a good odbc_pool_size for above configuration? (I was thinking of something around 50?)


Solution

  • Like any pool, its size decide of the number of request that can be processed in parallel. If your pool size in 10, only 10 requests can be process in parallel, the other are queued. It means if you have 100 users that tried to connect at the same time, the last one to be process will have to wait for 10 batches of queries to have been processed, thus increasing the latency.

    Increasing the pool size can help with latency, up to a point where database cannot cope with more parallelism and global performance will decrease. Good value depends on your database sizing, your use case and your overall architecture.

    You need to perform benchmarks and experiment to adapt the sizing to your own case as it really depend on actual traffic patterns.