Tuning iTop Performance
In order to enhance the performance of your iTop server, you must first find the bottleneck. Is it the PHP execution of the pages which is too slow, or is it MySQL?
The real tuning of the application's performance requires deep-dive into the actual usage pattern of your iTop instance, however there are few generic points to check:
If it is available on your system, install and enable APCu (Alternative PHP Cache). APC speeds-up PHP applications by caching the result of the PHP parsing as opcodes in shared memory. Moreover, iTop uses APC for caching a lot of its internal structures in memory instead of rebuilding them at each page load.
Installing APCu will improve the overall responsiveness of the application, which is especially important for “small” pages. If not available, iTop implements a simple caching mechanism based on files.
[apcu] apc.shm_size=128M apc.ttl=7200
To improve performance you can use php-fpm with fastcgi.
Observations regarding the timeout with Apache + FPM
The timeout comes from Apache through the ProxyTimeout directive. If not defined, Apache will use the TimeOut directive (60s by default).
AJAX request indeed returns a 504 error (Timeout).
Following AJAX requests will NOT be sent, we have to guess when the setup is over and when we can re-run it.
Setup process is robust, when upgrade of the DB is launched, it will complete even if Apache times out. Meaning that if we re-run the setup it will not start new queries but wait for the end of the current ones.
If MySQL restarts during the setup, MySQL rollbacks and resume on the previous table. No slowdown, no data loss.
We don't know when the setup will end once the timeout comes. The current solution is to check the current MySQL processes, wait for the end and run the setup again.
Careful with the disk free space. An alter table needs to have the equivalent of the table size in disk free space. For example, if the “attachment” table takes 7GB, it will need an extra 7GB for the alter table. (mind to take the iTop backup size if the checkbox is checked).
Maintenance and ReadOnly modes: On a “small” server, SQL queries will take so much resources that using iTop in read-onmly mode will most likely not be usable.
Configure Apache Modules: Headers & Expires
Activate apache's modules:
a2enmod expires a2enmod headers
Upgrade to PHP 7
We have noticed that PHP7 brings a lot of performance improvement on iTop.
Check MySQL's Key cache
Make sure that MySQL has enough memory for caching all
its indexes in memory. The important status variables are:
The actual ratio of
key_reads / key_read_requests
should be as low as possible (typically less than 0.1 %). If this
ratio is too high, this means that you should increase the amount
of memory allocated to cache MySQL's indexes (adjust the variable
my.cnf and restart the
Check the Query Cache
Check if the MySQL Query Cache is enabled, with enough memory to cache the results of the most common queries.
Here is what the Query Cache status looks like in PhpMyAdmin:
Remove un-needed dictionary files
Using iTop in your language is great, but do you really need Turkish, Spanish, Russian and Chinese on your system? If the answer is no, then you can free a good amount of memory that will be used for more productive purposes. Moreover, if you don't have APC installed on your system, all these dictionaries are loaded on each page request. To remove the non-needed dictionaries, the easiest way is to remove the files (they are called XX.dictionary.YYYY.php, where XX is the language code) from the datamodels directory and to run the setup again.
Another way to remove the dictionaries is to edit the iTop configuration file and to comment out (or remove) the lines corresponding to the dictionaries. Be aware however that the list of included dictionaries will be recomputed the next time you run the setup.
For example, keeping just the English, French and Italian translations:
'dictionaries' => array ( //'dictionaries/ru.dictionary.itop.ui.php', 'dictionaries/fr.dictionary.itop.core.php', 'dictionaries/it.dictionary.itop.core.php', // 'dictionaries/zh.dictionary.itop.core.php', // 'dictionaries/zh.dictionary.itop.ui.php', // 'dictionaries/es_cr.dictionary.itop.core.php', // 'dictionaries/ja.dictionary.itop.ui.php', // 'dictionaries/es_cr.dictionary.itop.ui.php', // 'dictionaries/hu.dictionary.itop.ui.php', // 'dictionaries/ru.dictionary.itop.core.php', // 'dictionaries/ja.dictionary.itop.core.php', 'dictionaries/dictionary.itop.core.php', 'dictionaries/dictionary.itop.ui.php', // 'dictionaries/tr.dictionary.itop.ui.php', // 'dictionaries/de.dictionary.itop.ui.php', // 'dictionaries/de.dictionary.itop.core.php', // 'dictionaries/pt_br.dictionary.itop.core.php', // 'dictionaries/pt_br.dictionary.itop.ui.php', // 'dictionaries/tr.dictionary.itop.core.php', 'dictionaries/fr.dictionary.itop.ui.php', 'dictionaries/it.dictionary.itop.ui.php', // 'dictionaries/hu.dictionary.itop.core.php', 'env-production/authent-ldap/fr.dict.authent-ldap.php', 'env-production/authent-ldap/it.dict.authent-ldap.php', 'env-production/authent-ldap/en.dict.authent-ldap.php', // 'env-production/authent-ldap/pt_br.dict.authent-ldap.php', // 'env-production/authent-ldap/de.dict.authent-ldap.php', // 'env-production/authent-ldap/es_cr.dict.authent-ldap.php', ...