GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — [Feature] Support ManagedLedger EntryCache cache entires before the slowest cursor · Issue #14495 · apache/pulsar

[Feature] Support ManagedLedger EntryCache cache entires before the slowest cursor #14495

New issue
Copy link
New issue
Copy link
Closed
Closed
[Feature] Support ManagedLedger EntryCache cache entires before the slowest cursor#14495
Copy link
Labels
Stalearea/MLlifecycle/staletype/featureThe PR added a new feature or issue requested a new feature

Description

@aloyszhang
aloyszhang
opened on Feb 28, 2022
Issue body actions

Is your feature request related to a problem? Please describe.
A topic may have lots of subscriptions in some scenes like an advertising recommendation system. This kind of system may update very frequently and at which point all subscriptions need to seek back to a fixed time(one or two hours).

We have a pulsar cluster for a recommendation business, every topic has 200~400 subscriptions, and all subscriptions need to seek back for 2 hours when the recommendation system restart(update or upgrade). And we want to catch up on all backlogs ASAP.

I.e. all subscriptions are consuming data in tailing read way in peacetime, and if the user's system restarts, all subscriptions will seek to 2 hours ago then read all backlogs and continue consuming new data.

But even after we turning both the managedLedgerCacheEvictionTimeThresholdMillis and managedLedgerCursorBackloggedThreshold to a very large value, the EntryCache still missed after consumer.seek(). This is caused by the cacheEvictionTask, which will always remove all entries already read by active cursors.

void doCacheEviction(long maxTimestamp) {
        // Always remove all entries already read by active cursors
        PositionImpl slowestReaderPos = getEarlierReadPositionForActiveCursors();
        if (slowestReaderPos != null) {
            entryCache.invalidateEntries(slowestReaderPos);
        }

        // Remove entries older than the cutoff threshold
        entryCache.invalidateEntriesBeforeTimestamp(maxTimestamp);
    }

Describe the solution you'd like
We can add a new configuration managedLedgerCacheEvictionSkipSlowestCursor to control whether the cacheEvictionTask will remove entries read by all active cursors.
And by default, the managedLedgerCacheEvictionSkipSlowestCursor is false, which will keep compatible with logic before. But for scenes that need to read backlog from EntryCachel, the user can set managedLedgerCacheEvictionSkipSlowestCursor to true which will cache all entries until reach the managedLedgerCacheEvictionTimeThresholdMillis.

Activity

  1. aloyszhang
    added
    type/featureThe PR added a new feature or issue requested a new feature
    on Feb 28, 2022
  2. codelipenghui commented on Mar 1, 2022

    @codelipenghui
    codelipenghui
    on Mar 1, 2022
    Contributor
    More actions

    Looks like we want to add a catchup entry cache. The current entry cache is used for the tailing messages. The current solution looks like to provide a catchup cache by extending the tailing cache, but I think it will not work for the cases that have multiple cursors read from an earlier position such as 3 days but only have entry cache in 2 hours. Essentially, the issue is how to use the cache to speed up multiple subscription catchup reads.

    It's better to start a discussion in the dev email thread or start with a proposal.

  3. aloyszhang commented on Mar 2, 2022

    @aloyszhang
    aloyszhang
    on Mar 2, 2022
    ContributorAuthor
    More actions

    The current solution looks like to provide a catchup cache by extending the tailing cache, but I think it will not work for the cases that have multiple cursors read from an earlier position such as 3 days but only have entry cache in 2 hours.

    Yes, it re-uses the entry cache and will fail if we read entry out of the range of the cached data.

    But if we support another catchup cache, the catchup-cache and tailing-cache may have an intersection, this may waste some memory.

    It's better to start a discussion in the dev email thread or start with a proposal.

    Agree, we can discuss it first.

  4. github-actions commented on Apr 2, 2022

    @github-actions
    github-actionsBot
    on Apr 2, 2022
    More actions

    The issue had no activity for 30 days, mark with Stale label.

  5. github-actions
    added
    lifecycle/stale
    on Apr 2, 2022
  6. github-actions commented on May 28, 2022

    @github-actions
    github-actionsBot
    on May 28, 2022
    More actions

    The issue had no activity for 30 days, mark with Stale label.

  7. hzh0425 commented on Nov 12, 2022

    @hzh0425
    hzh0425
    on Nov 12, 2022
    Member
    More actions

    Hi, what is the current status of this issue? Can I take this issue and implement it? @aloyszhang @codelipenghui

  8. merlimat
    added
    area/ML
    on Oct 24, 2026
  9. merlimat commented on Oct 24, 2026

    @merlimat
    merlimat
    on Oct 24, 2026
    Contributor
    More actions

    Thanks @aloyszhang. PIP-430 (#24623, released in 4.1.0) addresses this. With cacheEvictionByExpectedReadCount=true, which is the default, the broker no longer drops every entry behind the slowest active cursor. Entries that other cursors are expected to read stay in the cache until managedLedgerCacheEvictionTimeThresholdMillis or the cache size limit applies, and managedLedgerCacheEvictionExtendTTLOfRecentlyAccessed can extend that. Many subscriptions seeking back to the same point can then share cached entries. Closing as completed; please open a new issue with numbers if catch-up reads still miss the cache on 4.1+.

  10. merlimat
    closed this as completedon Oct 24, 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

    Labels

    Stalearea/MLlifecycle/staletype/featureThe PR added a new feature or issue requested a new feature

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      You are visitor 01402775 — GeezerVison does not store the pages you look up.
      Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.