StartDBSyncers in Zabbix

Mattias Geniar, Friday, November 28, 2014

Zabbix Server has a configuration setting called StartDBSyncers. By default, this value is set to 4. This may seem like a conservative setting, but increasing the value can do more harm than good -- I'll try to explain why.

In the Zabbix Server, there are a few parameters that control the size of the memory cache. The cache consists of the CacheSize (hosts, triggers and items), HistoryCacheSize (items received by the Zabbix server, but not yet synced to the database), TrendCacheSize (trending data calculated by the Zabbix Server, but not yet synced to the database) and HistoryTextCacheSize for text-values received by the server, but not synced to the database.

To process those different memory caches, zabbix starts a Database Syncer Process, the amount of which is controlled by the StartDBSyncers parameter.

Those DBSyncer processes periodically look into the different caches and move items from the cache into the backend database, either by updating values or inserting them as new values. If too many DBSyncers are started, the database can start to see many deadlocks as all processes try to acquire table locks at the same time. Since Zabbix uses a single table for generating unique IDs, these locks can start to add up and add considerable latency/delay to each request.

The end result is that the higher you increase the StartDBSyncers parameters, the slower your data is flushed to the database. This sounds controversial, as you would imagine that having more DBSyncers would cause more parallel syncing to the database, but it's exactly because of those many database deadlocks that are being caused that each sync takes longer (waiting for the locks to be cleared) to complete.

As a rule of thumb, one DBSyncer can handle 1.000 New Values Per Second (NVPS), as long as your database can keep up with the write I/O. You can check the status of your DBSyncers by using the Zabbix Internal types to check the state of each process, and their busy times.



Hi! My name is Mattias Geniar. I'm a Support Manager at Nucleus Hosting in Belgium, a general web geek & public speaker. Currently working on DNS Spy & Oh Dear!. Follow me on Twitter as @mattiasgeniar.

Share this post

Did you like this post? Will you help me share it on social media? Thanks!

Comments

Waini M Thursday, January 25, 2018 at 09:30 - Reply

Hi Mattias,

Great Blog! Very very informative. I am new to Zabbix and has just installed one to monitor around 200 servers (mostly Centos and a couple of Windows machine). And your blog had help me to understand Zabbix better.

Cut to the chase. I am curious about how frequent would zabbix start the dbsyncer processes. And where is that defined?

I checked what I setup. And it is quite frequent in a daily basis.

zabbixPrd:/var/log/zabbix# grep “insert into history” /var/log/zabbix/zabbix_server.log | egrep ‘20180123|20180124|20180125’ |awk ‘{print $1, $2, $3}’ | cut -c6-13 | uniq -c
783 20180123
1021 20180124
683 20180125
zabbixPrd:/var/log/zabbix#

Hope to hear from you soon :)


    Mattias Geniar Thursday, January 25, 2018 at 11:38 - Reply

    Cut to the chase. I am curious about how frequent would zabbix start the dbsyncer processes. And where is that defined?

    It’s always running, it’s one of the processes of the Zabbix setup. If you define DBSyncers as 2, there will always be 2 processes running.

    The config is usually in /etc/zabbix/zabbix_server.conf.


Leave a Reply

Your email address will not be published. Required fields are marked *