Suggestions to improve performance of Choco for upgrading and checking for outdated packages
- Dominant language
- C#
- Stars
- 11.5k
- Forks
- 960
- PR merge metrics
- No merged PRs in 30d
Description
I have a few questions and suggestions for the way Choco operates with acquiring package information.
- Why does Chocolatey query each package one by one? Why not concurrently?
- Why does the entire package information have to transfer for commands such as `choco outdated`?
- Why not have one query to the server that requests version numbers for all requested packages?
Currently `choco outdated` will issue GET requests one-by-one such as...
```
/api/v2/Packages()?$filter=(tolower(Id) eq 'audacity') and IsLatestVersion
/api/v2/Packages()?$filter=(tolower(Id) eq 'autohotkey') and IsLatestVersion
/api/v2/Packages()?$filter=(tolower(Id) eq 'ccleaner') and IsLatestVersion
```
Instead, consider one consolidated request such as...
`/api/v2/Packages()?$filter=('audacity','autohotkey','ccleaner')`
Example returned information:
```json
{
"audacity": "3.0.5",
"autohotkey": "1.1.33.10",
"ccleaner": "5.86.9258"
}
```
I realize this would take some additional work on the server side, but it would
1. Save a lot of traffic
2. Be much faster for users because only 1 GET request would take place
In addition, the amount of data returned by the API seems unnecessary for simple operations such as `choco outdated`.
[Example query](https://community.chocolatey.org/api/v2/Packages()?$filter=(tolower(Id)%20eq%20%27ccleaner%27)%20and%20IsLatestVersion) - 6 KB of data
Considering each request returns an average of 6 KB of data...
I have 193 packages... so it transfers 1.158 MB, which isn't a huge deal in terms of size, but having to process 193 GET requests of 6 KB each...takes a little bit, and for certain functions such as `choco outdated`, we don't need most of the data that is returned in each request.... we just need the version number.
Even if the team didn't want to implement a multi-package search in the API, an alternative solution would be:
- Return only the package version when requested
- Run the GET commands concurrently through async methods
Perhaps there is a backstory I am unaware of, or perhaps this is available in the business version (I only use it for personal use), but I happened to be Googling about this topic and came across this issue.
Thoughts?
Thank you guys for all the work you do on Chocolatey!
Contributor guide
Research direction
Start with the `choco outdated` flow and the `/api/v2/Packages()` queries shown in the issue. Determine whether the client or server must change, then define a settled requirement for consolidated, version-only, or concurrent requests; the issue currently does not specify files, tests, or a completion criterion.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- csharp
- Domain
- api, performance
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 20/100