Setting `$WebFlushDbCacheEveryRequest` to 0

The documentation for RT 5.0.4 states that setting ‘WebFlushDbCacheEveryRequest’ to 0 in the RT_Config.pm will result in the following:

#$WebFlushDbCacheEveryRequest

By default, RT clears its database cache after every page view. This ensures that you’ve always got the most current information when working in a multi-process (mod_perl or FastCGI) Environment. Setting $WebFlushDbCacheEveryRequest to 0 will turn this off, which will speed RT up a bit, at the expense of a tiny bit of data accuracy.

In my experience, setting this variable to zero has a dramatic impact, significantly speeding up RT. This performance boost may be particularly noticeable in high-usage environments like mine, which has a large database. But what exactly does ‘at the expense of a tiny bit of data accuracy’ mean? Could someone please elaborate on this topic? I appreciate all the help you can provide.

Hey,

A grep of the RT code base shows that if $WebFlushDbCacheEveryRequest is set, then DBIx::SearchBuilder::Record::Cachable->FlushCache is called before each query (in RT::Interface::Web::Hander::CleanupRequest).

What happens if that is set to 0? Then DBIx::SearchBuilder::Record::Cachable will cache database results. Looking in that module, I see that the default cache period is 5 seconds. But things are never that simple. RT::Record changes the default to 30 seconds (in _CacheConfig), which means that if you turn off DBIx::SearchBuilder::Record::Cachable you may see data that is up to 30 seconds old when viewing a ticket.

RT::Transaction and RT::Attachment set much longer timeouts, but since they aren’t updated after being created, that is of little concern.

Cheers,
Andrew