Skip to content

[bug] StatementsVolatileCache a cause of large memory usage when cache not in use #9899

@dkarlovi

Description

@dkarlovi

When implementing #9889, a discussion about resource usage vs performance pointed me to investigate why Psalm is using as much memory as it is. It seems StatementsVolatileCache is at fault, it can keep a lot of memory in use, making Psalm even unusable in some cases with very very large memory footprint (@orklah claims 8GB+).

It seems there would be a better way to find a tradeoff here, Psalm shouldn't hog all the memory.

Suggested fixes in Symfony Slack:

  1. @dantleech - add a TTL to the cache entries
  2. @ciaranmcnulty - Least Recently Used policy (this seems to already be implemented)
  3. Gzip content of cache (in which case it also needs marshalling)
  4. write content into php:temp (this seems like the existing cache system)

Maybe we could even consider what happens if we disable this cache fully? It doesn't seem to do that much, but I didn't test that throughly.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions