Chapter 7. Performance Tuning

Table of Contents

OTRS
TicketIndexModule
Ticket Search Index
Article Storage (Email, Phone and Internal Articles)
Archiving Tickets
Cache
Database
MySQL
PostgreSQL
Webserver
Pre-established database connections
Preloaded modules - startup.pl
Reload Perl modules when updated on disk
Choosing the Right Strategy
mod_gzip/mod_deflate

Abstract

Presented below is a list of performance enhancing techniques for your OTRS installation, including configuration, coding, memory use, and more.

OTRS

There are several options for improving OTRS performance.

TicketIndexModule

There are two backend modules for the index for the ticket queue view:

Kernel::System::Ticket::IndexAccelerator::RuntimeDB

This is the default option, and will generate each queue view on the fly from the ticket table. You will not have performance trouble until you have about 60,000 open tickets in your system.

Kernel::System::Ticket::IndexAccelerator::StaticDB

The most powerful module, should be used when you have above 80,000 open tickets. It uses an extra ticket_index table, which will be populated with keywords based on ticket data. Use bin/otrs.Console.pl Maint::Ticket::QueueIndexRebuild for generating an initial index after switching backends.

You can change the used IndexAccelerator module via SysConfig.

Ticket Search Index

OTRS uses a special search index to perform full-text searches across fields in articles from different communication channels.

To create an initial index, use bin/otrs.Console.pl Maint::Ticket::FulltextIndex --rebuild.

Note

Actual article indexing happens via an OTRS daemon job in the background. While articles which were just added in the system are marked for indexing immediately, it could happen their index is available within a few minutes.

There are some options available for fine tuning the search index:

Ticket::SearchIndex::IndexArchivedTickets

Defines if archived tickets will be included in the search index (off by default). This is advisable to keep the index small on large systems with archived tickets. If this is turned off, archived tickets will not be found by full-text searches.

Ticket::SearchIndex::Attribute

The attribute WordCountMax defines the maximum number of words which will be processed to build up the index. For example only the first 1000 words of an article body are stored in the article search index. The attributes WordLengthMin and WordLengthMax are used as word length boundaries. Only words with a length between these two values are stored in the article search index.

Ticket::SearchIndex::Filters

There are three default filters defined:

  • The first filter strips out special chars like: , & < > ? " ! * | ; [ ] ( ) + $ ^=

  • The second filter strips out words which begin or ends with one of following chars: ' : .

  • The third filter strips out words which do not contain a word-character: a-z, A-Z, 0-9, _

Ticket::SearchIndex::StopWords

There are so-called stop-words defined for some languages. These stop-words will be skipped while creating the search index.

Article Storage (Email, Phone and Internal Articles)

There are two different backend modules for the article storage of phone, email and internal articles (configured via Ticket::Article::Backend::MIMEBase::ArticleStorage):

Kernel::System::Ticket::Article::Backend::MIMEBase::ArticleStorageDB

This default module will store attachments in the database.

Note

Don't use it with large setups.

Pro: works with multiple front end servers.

Con: requires much storage space in the database.

Kernel::System::Ticket::Article::Backend::MIMEBase::ArticleStorageFS

Use this module to store attachments on the local file system.

Note

Recommended for large setups.

Pro: It is fast!

Con: If you have multiple front end servers, you must make sure the file system is shared between the servers. Place it on an NFS share or preferably a SAN or similar solution.

Note

You can switch from one back-end to the other on the fly. You can switch the backend in the SysConfig, and then run the command line utility bin/otrs.Console.pl Admin::Article::StorageSwitch to put the articles from the database onto the filesystem or the other way around. You can use the --target option to specify the target backend. Please note that the entire process can take considerable time to run, depending on the number of articles you have and the available CPU power and/or network capacity.

shell> bin/otrs.Console.pl Admin::Article::StorageSwitch --target ArticleStorageFS
                

Script: Switching storage back-ends from database to filesystem.

If you want to keep old attachments in the database, you can activate the SysConfig option Ticket::Article::Backend::MIMEBase::CheckAllStorageBackends to make sure OTRS will still find them.

Archiving Tickets

As OTRS can be used as an audit-proof system, deleting closed tickets may not be a good idea. Therefore we implemented a feature that allows you to archive tickets.

Tickets that match certain criteria can be marked as "archived". These tickets are not accessed if you do a regular ticket search or run a Generic Agent job. The system itself does not have to deal with a huge amount of tickets any longer as only the "latest" tickets are taken into consideration when using OTRS. This can result in a huge performance gain on large systems.

To use the archive feature simply follow these steps:

  1. Activate the archive system in SysConfig

    In the Admin page, go to SysConfig and select the group Ticket. In Core::Ticket you find the option Ticket::ArchiveSystem which is set to "no" by default. Change this setting to "yes" and save this change.

  2. Define a GenericAgent job

    On the Admin page, select GenericAgent and add a new job there.

    1. Job Settings

      Provide a name for the archiving job, and select proper options to schedule this job.

    2. Ticket Filter

      The ticket filter is searches for tickets that match the selected criteria. It might be a good idea to only archive those tickets in a closed state that have been closed a few months before.

    3. Ticket Action

      In this section, set the field labeled "Archive selected tickets" to "archive tickets".

    4. Save the job

      At the end of the page you will find an option to save the job.

    5. Affected tickets

      The system will display all tickets which will be archived when executing the Generic Agent job.

  3. Ticket Search

    When you search for tickets, the system default is to search tickets which are not archived. If you want to search through archived tickets also, simply add "archive search" while defining search criteria.

Cache

OTRS caches a lot of temporary data in /opt/otrs/var/tmp. Please make sure that this uses a high performance file system/storage. If you have enough RAM, you can also try to put this directory on a ramdisk like this:

shell> /opt/otrs/bin/otrs.Console.pl Maint::Session::DeleteAll
shell> /opt/otrs/bin/otrs.Console.pl Maint::Cache::Delete
shell> sudo mount -o size=16G -t tmpfs none /opt/otrs/var/tmp

# add persistent mount point in /etc/fstab
                

Note

Please note that this will be a non-permanent storage that will be lost on server reboot. All your sessions (if you store them in the filesystem) and your cache data will be lost.

There is also a centralized memcached based cache backend available for purchase from OTRS Group.