Skip to content

Draft: Cache issuables count for state

What does this MR do?

For the lists of issuables, at group and project level, we use IssuableFinder#count_by_state that performs an expensive COUNT query.

To improve performance, this MR adds the option to cache results at Gitlab::IssuablesCountForState level with a new argument store_in_redis_cache.

This argument is then set as true in IssuablesHelper#issuables_count_for_state, which will attempt to cache the count values for the issuable tabs.

The conditions for the caching are:

  • The feature flag :cached_issuables_state_count is enabled.
  • A parent is present (this the group or project defined by the finder).
  • There are no filters or search terms present.

The expiration time for the cached values is currently set as 10 minutes.

This implementation is being developed behind the FF :cached_issuables_state_count, which is disabled by default.

Screenshots (strongly suggested)

Issuables count in tabs COUNT query
Screen_Shot_2021-07-07_at_16.45.46 Screen_Shot_2021-07-07_at_16.45.32

Does this MR meet the acceptance criteria?

Conformity

Availability and Testing

Security

Does this MR contain changes to processing or storing of credentials or tokens, authorization and authentication methods or other items described in the security review guidelines? If not, then delete this Security section.

  • Label as security and @ mention @gitlab-com/gl-security/appsec
  • The MR includes necessary changes to maintain consistency between UI, API, email, or other methods
  • Security reports checked/validated by a reviewer from the AppSec team

Related to #325656 (closed)

Edited by Eugenia Grieff

Merge request reports