Skip to content

Huge memory usage spike on startup #862

Description

@katafrakt

It was reported by some of my colleagues, and after that I noticed it myself, that on a large project during the startup Expert uses large amount of memory in peaks. Talking about memory usage reported by MacOS's Activity Monitor (so not just RAM) we are talking about up to 10GB on the manager node and 2.5GB on Engine node. After doing the whole startup the memory usage goes down to about 1.5GB on manager and similar on Engine.

My investigation traced it to the fact that we index the code in Engine and then we send the whole large list to Manager, which then sends it through couple of GenServers until it's batched and saved to SQLite.

I did a prototype with Codex, batching the index results with backpressure and calling garbage collection in few places aggressively. With that the manager node stayed under 600MB quite consistently. This leads me to believe that this is a direction worth pursuing. The prototype itself was a large change and not without issues on it's own, so I'm first creating this tracking issue, because it will probably be better to split the improvements into few more focused PR. Also I wonder what others think.

Activity

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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions