Skip to content
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

Investigate flood of suggestionsDatabaseUpdate messages on startup #6706

Closed
hubertp opened this issue May 16, 2023 · 9 comments · Fixed by #6755
Closed

Investigate flood of suggestionsDatabaseUpdate messages on startup #6706

hubertp opened this issue May 16, 2023 · 9 comments · Fixed by #6755

Comments

@hubertp
Copy link
Collaborator

hubertp commented May 16, 2023

Separated the issue from ticket #6630.

On a relatively modest project, on startup, we appear to send hundreds of small messages from language server with suggestions updates. This is intentional, to some extent, because we abandoned batch updates, but Apparently it can put a strain on IDE to handle them, especially within such a short period of time.

@hubertp hubertp self-assigned this May 16, 2023
@hubertp hubertp moved this from ❓New to 🔧 Implementation in Issues Board May 16, 2023
@enso-bot
Copy link

enso-bot bot commented May 16, 2023

Hubert Plociniczak reports a new STANDUP for yesterday (2023-05-15):

Progress: Investigating reported performance issues on #6630. Initial assessment of #6691. #6655 revealed problems with caching on circular dependencies, will need further investigation for a proper fix. It should be finished by 2023-05-18.

Next Day: Next day I will be working on the #6706 task. Continue investigating perf issues.

@wdanilo
Copy link
Member

wdanilo commented May 16, 2023

What is the reason batch updates were "abandoned"? If they were abandoned, there has to be reason for it. Instead of fixing this issue now somehow, we should chat about what was the reason and what is the proper solution here.

For example, if batch updates were too big to sent via network, flooding GUI with a lot of updates might be a good idea, but we should then implement their batching on our side. Anyway, this needs discussion/proper information before implementation.

@hubertp
Copy link
Collaborator Author

hubertp commented May 16, 2023

What is the reason batch updates were "abandoned"? If they were abandoned, there has to be reason for it. Instead of fixing this issue now somehow, we should chat about what was the reason and what is the proper solution here.

DB updates for libraries suggestions were previously created during the startup. There were a lot of them and they were batched. Now we don't batch them but actually create a single message per library. So that was a typo on my side.

The flooding that happens appears to be related to regular updates as things are processed. I'm saying "appears to be" because that's part of the investigation and part of the process. That's why I don't see the reason for "chatting about it" with GUI folks, yet. Maybe it's a problem on LS maybe GUI but unless we are actually given time to investigate I can't tell.

I can sense the urgency in your tone but I also don't intend to involve too many folks, too early, for obvious resourcing reasons.

@wdanilo
Copy link
Member

wdanilo commented May 16, 2023

Makes sense, thanks for the info. Regarding chatting – let's do it when we will have enough information, of course. If the problem with GUI is because it is being re-rendered a lot of times after these updates, it is not necessarily problem with the amount of updates – maybe we should just batch incoming updates in GUI and apply then next frame / after few frames. Sending updates as a batch might cause network issues and performance drop there (it might not, batched updates might be sent faster). Anyway, all these aspects need to be taken into consideration when we will have the information after the investigation :)

Regarding "urgency" in my tone – that was definitely not intentional. The only thing I wanted to catch early here is that the fix for the issue is not obvious and fixes on GUI side might be needed as much as on the engine side. So before we get to implementation, I'd like to have a sync call between all parts here.

@enso-bot
Copy link

enso-bot bot commented May 17, 2023

Hubert Plociniczak reports a new STANDUP for yesterday (2023-05-16):

Progress: Trying to understand how suggestions are being produced. One thing which stands out is that we seem to update suggestions for the expressions with the same type multiple times. Will try to follow that lead. It should be finished by 2023-05-18.

Next Day: Next day I will be working on the #6706 task. Continue investigating perf issues.

@hubertp
Copy link
Collaborator Author

hubertp commented May 17, 2023

Followed the hunch and it appears that we issue multiple suggestions updates even if the return type of expressions does not change. This is apparently especially painful if the graph has errors or panics. For the sake of the argument I turned those off and GUI became very responsive.
After discussing this with @4e6, it looks like this condition was changed in #3729, so I will try to resurrect the check and not break the "pending nodes" functionality.

This sounds vaguely similar to #6639.

So far it looks like an issue on LS-side.

@hubertp
Copy link
Collaborator Author

hubertp commented May 17, 2023

Timed.zip
Attaching here a project that Jaroslav once used to testing pending computations (was in Pivotal but that is apparently gone).

@enso-bot
Copy link

enso-bot bot commented May 18, 2023

Hubert Plociniczak reports a new STANDUP for yesterday (2023-05-17):

Progress: Identified the problem. We now update suggestions iff the type of the expression changes, as it was a while ago. Did some extensive testing and adapting tests. It should be finished by 2023-05-18.

Next Day: Next day I will be working on the #6706 task. Finish adapting tests and create a PR.

@mergify mergify bot closed this as completed in #6755 May 18, 2023
mergify bot pushed a commit that referenced this issue May 18, 2023
The change adds an additional field to `ExpressionUpdates` messages sent by `ProgramExecutionSupport` to indicate if the type of value (or its method pointer) has changed and therefore would potentially require a suggestions' update.

Prior to #3729 that check was done during the instrumentation. However we still want to continue to support "pending expression" functionality therefore `SuggestionsHandler` will use the additional information to filter only the required expression updates.

Most of the changes are related to adapting our tests to the new field.

Closes #6706.

# Important Notes
The associated project now loads and navigates smoothly.
Also attaching a screenshot from the project that illustrates that pending functionality continues to work:
[Kazam_screencast_00006.webm](https://github.com/enso-org/enso/assets/292128/35918841-f84f-4e1c-b1b0-40e45d97e111)
@github-project-automation github-project-automation bot moved this from 🔧 Implementation to 🟢 Accepted in Issues Board May 18, 2023
@enso-bot
Copy link

enso-bot bot commented May 19, 2023

Hubert Plociniczak reports a new STANDUP for yesterday (2023-05-18):

Progress: Finished adapting tests and created a PR. Quite happy with resulting perf improvements. Started digging into several reported issues. Trying to reproduce #6766, #6763, #6756. Created #6767 for another renaming issue. It should be finished by 2023-05-18.

Next Day: Next day I will be working on the #6766 task. Continue trying to reproduce reported bugs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

2 participants