-
-
Notifications
You must be signed in to change notification settings - Fork 158
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Pegged at 100% CPU #81
Comments
My solagraph instance eats 100% CPU and a lot of RAM which makes it unusable. |
I'm in the middle of two sets of changes that should have a significant impact on performance and memory. The first set of changes involve the ApiMap and are currently in the master branch:
The second set of changes involve the YardMap. Solargraph uses YARD docs to provide data from the Ruby core, the stdlib, and any gems required by the codebase. I've known for a while that YARD queries were a good candidate for optimization, but when I profiled them recently, they turned out to be even less efficient than I expected. I've figured out a few ways to make them faster, most notably by storing the pins generated by the YardMap directly in the ApiMap store. Testing against the rails/rails repo, completion items are noticeably faster and the server process uses nearly 70% less memory. I expect to publish these updates in gem version 0.25.0. @AndrewRayCode Do you get those errors after running Go to Definition? I can't think of any other reason the client would send a |
All the ApiMap and YardMap enhancements are pushed to master. |
@castwide what's the ETA of the next release with these improvements? 🙂 |
@blackst0ne Most likely tomorrow. |
Gem version 0.25.0 is released. I tested it on 2 machines: a desktop with 32GB RAM and 8x4GHz CPU, and a laptop with 4 GB RAM and 2x2.6 GHz CPU. Both showed notable improvements in performance and memory usage. Opening castwide/solargraph in VS Code on the desktop, the language server took about 10 seconds to initialize. After that, most operations were noticeably faster. Completion requests were instantaneous. So was Go to Definition, for both workspace symbols (e.g., On the laptop, initialization took about 25 seconds and stayed between 30-60% CPU usage. Afterwards, CPU stayed under 5% and memory was around 240MB. For comparison, running castwide/solargraph with gem version 0.24 used up to 8 times as much CPU during editing (10%-15% on the desktop and up to 40% on the laptop) and about 430MB RAM. I also tried running rails/rails on the desktop. Initializing the language server took about 45 seconds. The first completion request lagged for about 10 seconds, but after that they were close to instantaneous (probably < 250ms). CPU usage hovered around 5-10% during active editing and memory usage was around 520MB, while gem 0.24 clocked at 10-15% CPU and over 2GB RAM. Some relevant statistics about each workspace:
A quick explanation of the changes affecting performance:
|
Gem version 0.27.0 includes more improvements that should reduce CPU usage. Mapping large workspaces can still take a while, but reindexing after the initial map is much faster. My tests with rails/rails yielded good results for completion requests. |
I have installed version 0.28.2 and still experiencing the same issue from time to time. How could I help to resolve it? |
@skyeagle One thing you could try is customizing which files are included in maps with a .solargraph.yml file. The default settings look like this (run
That configuration includes all .rb files except the spec and test folders. There might be other folders that are safe to exclude like |
The solargraph server is pegged at 100% CPU always for me. I'm using the
vscode-ruby
pluginI also regularly get these errors spat out from the "Ruby Language Server":
This is on a very large codebase, so it's probably impossible for me to narrow this down to a specific case.
The text was updated successfully, but these errors were encountered: