Too many devices offline and high disk I/O with mysql - solved

Javier Gonzalez5 years ago

I started to have very high disk I/O which brought the server to be very slow (Ubuntu 18.04 LTS - 8GB -2xCPU - 80GB SSD - VM) with 256 devices reporting every 10 secs. DB is about 12GB with 54.000.000 records in tc_positions.
Suddenly most of the devices went to offline state.
Temporary solution was restart traccar . But few hours later , same problem again.
Installing atop showed that disk I/O was over 100% most of the time and started digging in mysql documentation.
https://dev.mysql.com/doc/refman/8.0/en/innodb-buffer-pool-resize.html
Finally added this to the /etc/mysql/mysql.conf.d/mysqld.cnf these 4 lines

innodb_flush_method     = 1
innodb_buffer_pool_size         =4G
innodb_buffer_pool_instances    =8
innodb_buffer_pool_chunk_size   =535822336

changing buffer pool size to 2G and buffer pool instances to 4 does not differ of the current configuration. maybe some more testing is required, but so far offline problem was gone.

the tool I use to check the device status is the following:

SELECT COUNT(*) FROM `tc_devices` WHERE lastupdate > NOW() - INTERVAL 5 MINUTE

So we this data we know if most of them are reporting and updating fine