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

Maven Central search results should be cached #263 #453

Conversation

vrubezhny
Copy link
Contributor

Fixes: #263

@vrubezhny
Copy link
Contributor Author

Some quick measurements:

First request for groupIDs: [Trace - 9:11:37 PM] Received response 'textDocument/completion - (103)' in 7828ms.
Next request for groupIDs: [Trace - 9:11:40 PM] Received response 'textDocument/completion - (105)' in 81ms.

First request for artifacts [for selected groupID): [Trace - 9:36:17 PM] Received response 'textDocument/completion - (649)' in 871ms.
Next request for artifacts [in selected groupID): [Trace - 9:36:22 PM] Received response 'textDocument/completion - (654)' in 37ms.

First request for versions (for selected groupID/artifactID): [Trace - 9:12:28 PM] Received response 'textDocument/completion - (206)' in 2820ms.
Next request for versions (for selected groupID/artifactID): [Trace - 9:13:07 PM] Received response 'textDocument/completion - (273)' in 20ms.

@vrubezhny vrubezhny force-pushed the fixCacheValuesInRemoteCentralRepositorySearcher branch from d8ac4c5 to ff9d063 Compare July 25, 2023 20:04
@angelozerr
Copy link
Contributor

@mickaelistria
Copy link
Contributor

I'm still not sure about the probability that the same request gets processed many times in a short time frame.

@vrubezhny
Copy link
Contributor Author

I'm still not sure about the probability that the same request gets processed many times in a short time frame.

It's not only about "the same request":

  • if you get completions for <groupId>|</groupId> the cache gets filled with all the available groupId values. All the following calls to complete <groupId>|</groupId> in any document in your workspace will be fed from the cache instead of sending requests to/receiving responses from Maven Search server.
  • next you'll probably select and insert some groupId and try to get completions for <artifactId>|</artifactId> - cache will be filled with all the artifacts of the selected group. All the following calls to complete ``|` in any document for that (already fetched group) in your workspace will be fed from the cache instead of sending requests to/receiving responses from Maven Search server.
  • The save goes for the versions of the selected artifact - here Maven Search API has some nuances, but still at least some of the following tries to complete versions for the same group : artifact will be fed from the cache.

In any POM of the workspace for the following 15 minutes (changeable).

@vrubezhny vrubezhny force-pushed the fixCacheValuesInRemoteCentralRepositorySearcher branch from ff9d063 to 71b92d7 Compare July 26, 2023 04:17
@vrubezhny vrubezhny marked this pull request as draft July 26, 2023 04:17
@vrubezhny
Copy link
Contributor Author

@vrubezhny for managing cache, I suggest that you use CacheBuilder from guave. We did that in LemMinx https://github.com/eclipse/lemminx/blob/d808ae7fc32f269ecdd7d737a413ab40e1671873/org.eclipse.lemminx/src/main/java/org/eclipse/lemminx/uriresolver/CacheResourcesManager.java#L144

The current PR version uses guava Cache and CacheBuilder, however this still needs to be improved in order to not block on waiting for the results to be obtained from Maven Search API.

@vrubezhny vrubezhny force-pushed the fixCacheValuesInRemoteCentralRepositorySearcher branch 6 times, most recently from 43d48ec to 205fa40 Compare July 28, 2023 03:48
@vrubezhny vrubezhny marked this pull request as ready for review July 28, 2023 13:17
@vrubezhny vrubezhny marked this pull request as draft July 28, 2023 13:17
@vrubezhny vrubezhny force-pushed the fixCacheValuesInRemoteCentralRepositorySearcher branch from 205fa40 to ebbc5db Compare July 28, 2023 13:49
@vrubezhny vrubezhny marked this pull request as ready for review July 28, 2023 14:18
@vrubezhny vrubezhny merged commit 9814a22 into eclipse:master Jul 28, 2023
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Maven Central search results should be cached
3 participants