-
Notifications
You must be signed in to change notification settings - Fork 64
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
[YUNIKORN-2249] Add Accept-Encoding header when fetch queue application API #158
base: master
Are you sure you want to change the base?
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #158 +/- ##
=======================================
Coverage 66.66% 66.66%
=======================================
Files 1 1
Lines 30 30
=======================================
Hits 20 20
Misses 7 7
Partials 3 3 ☔ View full report in Codecov by Sentry. |
@@ -82,8 +82,10 @@ export class SchedulerService { | |||
|
|||
fetchAppList(partitionName: string, queueName: string): Observable<AppInfo[]> { | |||
const appsUrl = `${this.envConfig.getSchedulerWebAddress()}/ws/v1/partition/${partitionName}/queue/${queueName}/applications`; | |||
const headers = new HttpHeaders(); | |||
headers.set('Accept-Encoding', 'gzip') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does it work with scheduler without apache/yunikorn-core#757 ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it should just be ignored if the server does not support it. Fallback will always be identity transform (i.e. no compression)
More general: should we not be setting this on all requests that we do? I can see requests also get large when we do get a large number of nodes etc. |
Most browsers automatically include 'Accept-Encoding: gzip, deflate' in the request header, so adding it is redundant. Additionally, we may not need to compress or decompress all the data on web at present. Simply providing a compression option for the user may be enough. |
Personally, gzip is good enough |
Except not all clients are browsers (and the header is not added by default to things like API calls from javascript in many frameworks). The purpose of the By the way -- I'm not trying to be obnoxious with the MUST and MUST NOT terminology; those are taken directly from the language used by the RFCs that define how HTTP is supposed to work. https://datatracker.ietf.org/doc/html/rfc9110#name-accept-encoding Note that some of the tests given that RFC aren't completely practical; For example, "If no Accept-Encoding header field is in the request, any content coding is considered acceptable by the user agent" -- this isn't really ever true in practice. If I want to return a resource encoded as |
What is this PR for?
When the API response size is large, it takes a long time to transfer data.
This PR adds a 'Accept-Encoding' request header. If the client (web side) indicates gzip encoding, the scheduler will compress the data before sending it back. So it can reduce the data size and transfer time.
What type of PR is it?
Todos
N/A
What is the Jira issue?
YUNIKORN-2249
How should this be tested?
local build
Screenshots (if appropriate)
N/A
Questions:
N/A