Skip to content

Content Drive/Site Browser: undersized user cache causes repeated user_ lookups during folder listings #37186

Description

@ihoffmann-dot

Problem Statement

A single POST /api/v1/drive/search request can execute select * from user_ where userid=? between 363 and 1,025 times. Root cause: cache.userdotcmscache.size is commented out in dotmarketing-config.properties, falling back to cache.default.size=1000. A reference instance with 1,828 active users exceeds that capacity, so the cache evicts continuously during normal listing navigation — and each eviction is amplified up to 8x, because the same modUser/owner gets resolved multiple times per row through different code paths (audit properties, version properties, URL building).

Two earlier hypotheses were investigated and ruled out: this is not a classic per-row N+1 access pattern, and it is not missing negative-caching for nonexistent users (zero were found in the test data).

Confirmed empirically: raising the cache size to 4000 dropped lookups per request from an average of ~688 to 1-2.

Decision: ship a larger static default (not auto-computed sizing) — the tested value (4000) resolved the reference instance with margin; auto-sizing was rejected as disproportionate effort for a problem a documented, generous default already resolves in practice.

Steps to Reproduce

  1. On an instance with more active users than cache.default.size (1000), list a folder whose content spans many distinct authors, via Content Drive or Site Browser
  2. Observe user_-by-id query volume via pg_stat_statements

Expected vs Actual

Expected: user lookups converge to a small, stable number after warm-up. Actual: lookups remain in the hundreds indefinitely because the cache never has room to hold the working set.

Acceptance Criteria

  • Default cache.userdotcmscache.size raised from the effective 1000 to a documented value with real headroom (reference: 4000 resolved 1828 users)
  • User-record lookup volume per request drops by at least an order of magnitude on an instance whose user count exceeds the old default
  • Returned rows, display names, and fallback labels for missing users are unchanged
  • Folder-listing permission-filtering behavior is unchanged for both an administrator and a permission-restricted user
  • (Optional, may be descoped if the above alone resolves the bulk of the churn) Redundant same-user resolution within a single row is reduced

Related, out of scope for this issue

Two findings surfaced during investigation, tracked separately if pursued: BrowserAPIImpl transforms all subfolders before paging (wastes owner resolution on discarded subfolders); two filterCollection calls use the non-batch overload where the codebase's own standard prefers batch.

Parent Epic

#36814

Activity

  1. moved this from New to In Review in dotCMS - Product Planningon Aug 27, 2026
  2. removed their assignment
    on Sep 14, 2026
  3. rjvelazco commented on Sep 16, 2026

    @rjvelazco
    Member

    QA Passed

    • dotCMS Docker Image: [dotcms/dotcms:trunk_8f0c9fa]

    Video

    video-qa.mov
  4. added a commit that references this issue on Nov 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions