Skip to content

[spring-index] optimize cache operations #1071

Closed

Description

@martinlippert

At the moment, the index cache that keeps symbols, bean index, and potentially additional information in a cache on disc offers room for improvement. At the moment, the cache structure is kept in memory and updated internally and written to disc on every change. This causes frequent cache writes to disc as well as consumes additional memory all the time for the full cache content.

Two thoughts:

  • the cache writes to disc don't need to happen on every event, they could be accumulated in memory and then written to disc on specific events only (once an hour, after x number of changes, or something else)

  • the internal cache structure on disc could be changed towards an incremental model, where individual change events (deltas) are written to disc in an append mode. At specific moments (initial cache read, after certain events, or something else) those delta could be merged into the overall cache

Activity

  1. added
    for: eclipse
    for: vscode
    on Jul 12, 2023
  2. added this to the Backlog milestone on Jul 12, 2023
  3. added a commit that references this issue on Dec 30, 2024
  4. martinlippert commented on Dec 30, 2024

    @martinlippert
    MemberAuthor

    The default cache implementation is switched over to the new delta-based cache implementation, which doesn't keep the cached data (symbols, diagnostics, etc.) in memory anymore. Instead, delta operations are appended to the cache file on disc. The cache does a compacting operation (folding all delta operations into the main cache storage) after every 20 operations.

    This makes cache updates on individual file save events a lot faster than before, since not the full cache is serialized to JSON and stored on disc anymore. Instead, only the updated content of the saved file is appended as a delta object.

    This also allows us to not keep the entire cached data in memory anymore. This only happens during compacting operations, where the cache is read, delta operations are folded in, and then stored again. This reduces the overall memory footprint of the language server process significantly - of course depending on the size of the projects of the workspace.

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

    for: eclipsefor: vscodetheme: performancetheme: spring index & symbolstheme: validationtype: enhancement

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions