Skip to content

Performance is low for a monorepoΒ #94

@hkupty

Description

@hkupty

I'm working on a monorepo with >60 projects and about ~3k files. Using kotlin-lsp is much slower when compared to any other lsp - or intellij for that matter, though not by a large margin.


I ran a JFR and noted quite a few things down that maybe can explain that:

  • Threads seem to constantly lock each other, perhaps there's a bottleneck in a ConcurrentHashMap
    • This can also be seen both by the lock wait time (~2s out of a 2 minute recording) and by ConcurrentHashMap.get being the highest profiled method.
Image Image
  • There's a humongous number of NoSuchMethodExceptions being thrown by some dynamic dependency not being loaded correctly
    • Roughly ~100 exceptions per second are being thrown here
Image
  • Memory allocation is considerably higher than normal
    • OS reports ~19GB of mem usage;
    • JFR reports over 100GB of mem usage in the 2 minutes it ran;
    • This leads to few long pauses, like the almost 1sec GC pause.
Image Image Image
  • The unnecessary network roundtrip might just make things more complicated
    • I understand the architecture of using a client-server architecture, though I don't fully agree, but at least it could've been simplified to use a unix socket instead of TCP that goes on the public IP address (which I hid for obvious reasons)
Image

This is a surface-level analysis and I'm pretty sure that, by the looks of it, having a deeper look at the code there's more low-hanging fruit to be fixed which can yield a better performance.

Before any backlash, I do want to acknowledge that I believe this is an evolution from what we had before and I'm thankful that there's an officially supported LSP for kotlin now. Also, this is an invitation to to improve and I'm pretty sure not only me but other people in the community would be willing to help test, debug, measure and improve the software. Performance matters, specially when it comes to development experience.

I can provide as much information as necessary and help out in the process of making this run smoother. Thanks in advance for having a look at this.

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