vendredi 11 juin 2010

How to optimize Zabbix 1.6 Mysql database (too many temporary tables created on disk)

We have a zabbix server whose database is under quite heavy load. Recently, I noticed there were something like 200 temporary tables created per second (Created_tmp_tables), and 60% of them were written on disk!! (Created_tmp_disk_tables).

I first used a quickfix, namely mounting a ramdisk tmpfs somewhere in /tmp, and make MySql write disk temporary tables in it. Fine, the server was fast again.

Recently, I found a better solution: to really solve the problem. Basically, looking at temporary tables in /tmp, I found they were all very very small (1K). According to http://dev.mysql.com/doc/refman/5.1/en/internal-temporary-tables.html the basic reason why so tiny temporary tables could finish on the disk is: some TEXT or BLOB columns. Right, I found them inside zabbix database, using a full log of all MySQL queries.

Basically :


alter table items modify params VARCHAR(255);
alter table triggers modify comments VARCHAR(255);


just solved the problem. No more temporary tables written on disk.

By the way, make a backup first: this will truncate comments of your alerts, whenever they are longer than 255 characters.

Changement de disque dur interne 2.5'' de mon Macbook Pro 13''

Hier soir, j'ai changé le disque dur interne original de mon Macbook Pro (un 2.5'' 300G) pour un 1T.

Voici les étapes :

  1. backup complet du disque original vers un disque dur externe USB de 500G avec Time Machine
  2. j'ouvre le MBP et je change le disque, cf http://www.ifixit.com/Guide/Repair/Installing-MacBook-Pro-13-Inch-Unibody-Hard-Drive-Replacement/1337/1
  3. j'allume le MBP avec le CD d'install Mac OS X
  4. je formate d'abord le nouveau disque interne avec Utilities>Disk Utilities
  5. puis Utilities>Restore from Time Machine Backup
  6. la restauration a pris quelques heures, raisonnable pour 300G de données
Au redémarrage, nickel, aucun problème, tout marche comme avant!

Un grand merci à Time Machine pour le temps gagné!