OTRS / Znuny search tuning with rebuilding ArticleSearchIndex

OTRS and Znuny use sadly a custom index for optimizing search. Sadly, because since many years there a good out of the box solutions, which make fast and reliable search optimizations (e.g. elasticsearch). Hopefully Znuny will clean up this in the near future. But does not help to complain let us go through how to create or configure a well running Indexing in OTRS 5 / OTRS 6 / Znuny 6.x or OTOBO

First let us check the current Index status with

sudo -u otrs /opt/otrs/bin/otrs.Console.pl Maint::Ticket::FulltextIndex --status

Now check what you have configured for executing the Index rebuild via Scheduler. Go in Admin > SysConfig/System Configuration and search for

Daemon::SchedulerCronTaskManager::Task###ArticleSearchIndexRebuild

You will see something like this. The screenshot shows the defaults of OTRS / Znuny 6.x

OTRS / Znuny Cron Scheduler for Fulltext Article Search Index showing defaults

The settings define how big the chunks are in processing the Index. E.g. here we define to run the indexing in 4 parallel perl processes (–children) and that these 4 processes create indices of in total 20.000 articles. Means each perl process will have roughly 5.000 articles processed.
The processing gets triggered every minute (Schedule * * * * *). If an prior cron is already running the cron will simply skip.

Limitations on parallel executions

OTRS / Znuny scheduler have the option to define how many scheduled processes are allowed to get started. This is configured in system configuration in

Daemon::SchedulerTaskWorker::MaximumWorkers

and you will see this configuration screen

OTRS / Znuny maximum allowed Scheduler Worker processes

Here you can define how many parallel workers are allowed to run.
Be careful here to avoid any overloading of your system!
If you system is running the scheduled workers with 100%, like the reindexing will do, you will loose CPU cycles for your online users. Also the amount of IOPS produced could quickly bottleneck your disks.
So as a rule of thumb you can define that many workers here as you having physical CPU cores and you reserve one or two cores for the online processing. It will be mostly enough.
Monitor the conditions of the server during you are producing high load with the reindexing. And if possible add more cores or reduce the amount of MaximumWorkers.

Be informed after changing the MaximumWorkers value, the changes will take a while until the amount of worker processes will be changed. E.g. if your workers are doing already a very long running operation it will take at least this time until the new configuration will be taken. In seldom cases it can be over 30 minutes!

Tuning

You can increase the parallel processing of the workers the more CPU cores. E.g. if you system has 8 cores you can assign 7 workers and still having 1 core free for your online users during high load. And during cron is doing nothing your users have the power of 8 cores.

Keep an eye on RAM, cpu usage and especially IOPS.

Starting the reindexing

With the following command your current index gets dropped and rebuild by the previously configured Schedulers

sudo -u otrs /opt/otrs/bin/otrs.Console.pl Maint::Ticket::FulltextIndex --rebuild

you can see the progress of the reindexing with

sudo -u otrs /opt/otrs/bin/otrs.Console.pl Maint::Ticket::FulltextIndex --status

Fully manual reindexing (not recommended)

Sometimes, e.g. the cron is not getting fired or you want to do more specific testing, you want to run the reindexing “now”. You can achieve this by stopping the daemons. As said in heading, this is NOT the recommended way! If you let it run in parallel to the cron it will create you tons of warning articles!

sudo service cron stop
sudo -u otrs /opt/otrs/bin/Cron.sh stop
sudo -u otrs /opt/otrs/bin/otrs.Daemon.pl stop

and running the above named rebuild command with “–rebuild” parameter.
After done run this command

sudo -u otrs /opt/otrs/bin/otrs.Console.pl Maint::Ticket::FulltextIndexRebuildWorker --children 5 --limit 99999999

This command rebuilds all articles (–limit) and runs 5 workers (–children)

If you get an error that it is already running ensure the rebuild is getting killed, e.g. by rebooting and restarting this manual process again. If it is still complaining run the following with –force-pid instead the command before

sudo -u otrs /opt/otrs/bin/otrs.Console.pl Maint::Ticket::FulltextIndexRebuildWorker --children 5 --limit 99999999 --force-pid

This ignores prior executions and runs forced (–force-pid)

Do you need help with Znuny / OTRS?
We have lot of experiences with OTRS and Znuny and can help you with your issues. Get in touch with us and we will check if and how we can help you.

Leave a Comment

Do you need help with Znuny / OTRS?​

We have lot of experiences with OTRS and Znuny.
We can help you with your issues to solve them.

From giving you support up to implementing integrations to your existing systems.

Get in touch with us and we will check if and how we can help you.​

Get OTRS/Znuny/OTOBO Support
Step 1 of 2
To get a quick and efficient clearance of your needs, our experts will call you.
We communicate in English.
Maybe we can communicate in your native language too. So please let us know your native written and spoken language.

Your environment

We have different partners for different tasks and company sizes.
To assign you the right partner and thus the proper system engineers, we would like to ask you for more details about your environment.
The more details we get the quicker we can narrow down to the right persons.