KirillovDenis/feature/use_chi_instead_of_gorilla #149
Labels
No labels
P0
P1
P2
P3
good first issue
Infrastructure
blocked
bug
config
discussion
documentation
duplicate
enhancement
go
help wanted
internal
invalid
kludge
observability
perfomance
question
refactoring
wontfix
No project
No assignees
3 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference: TrueCloudLab/frostfs-s3-gw#149
Loading…
Add table
Reference in a new issue
No description provided.
Delete branch "dkirillov/frostfs-s3-gw:KirillovDenis/feature/use_chi_instead_of_gorilla"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Reopen to not forget about this draft
1 min, 10 buckets, writers 300 VUs, readers 300 VUs
resolve_bucket
format in docs 6eb7966800obtain-secret
result 8fcaf76f41aaab1138ab
to3620357d4a
WIP: KirillovDenis/feature/use_chi_instead_of_gorillato KirillovDenis/feature/use_chi_instead_of_gorilla@ -19,6 +19,7 @@ import (
"git.frostfs.info/TrueCloudLab/frostfs-s3-gw/api/data"
"git.frostfs.info/TrueCloudLab/frostfs-s3-gw/api/errors"
"git.frostfs.info/TrueCloudLab/frostfs-s3-gw/api/layer"
"git.frostfs.info/TrueCloudLab/frostfs-s3-gw/api/middleware"
Is it dependency requirement or a bit of refactoring for cleaner code?
It's consequence of the refactoring.
api/middleware
now containsReqInfo
@ -0,0 +43,4 @@
BucketResolveFunc func(ctx context.Context, bucket string) (*data.BucketInfo, error)
// cidResolveFunc is a func to resolve CID in Stats handler.
cidResolveFunc func(ctx context.Context, reqInfo *ReqInfo) (cnrID string)
By the way, is it necessary to have a separate type for these functions? Are they being used in tests or can they?
I moved this to separate type just for convenience (for the sake of readability in
Stats
function)@ -0,0 +37,4 @@
// HeadersMatch adds a matcher for header values.
// It accepts a sequence of key/value pairs. Values may define variables.
// Panics if number of parameters is not even.
// Supports only exact matching.
Did you consider support of regexp values like in mux?
There are couple of good regexp checks in the mux configration, e.g.
"partNumber", "{partNumber:[0-9]+}"
. Or we are going to parse number anyway in the handler so it doesn't matter much?I wanted to add the minimal and simple filters that we need. And yes, we will parse such numbers further anyway
@ -0,0 +124,4 @@
if !r.URL.Query().Has(query.Key) || queryVal != "" && query.Value != queryVal {
continue LOOP
}
}
I expect this to work faster than mux parsing because there is no regex matching. Maybe we can try to benchmark it just for internal research.
@ -496,0 +503,4 @@
throttleOps := middleware.ThrottleOpts{
Limit: a.settings.maxClient.count,
BacklogTimeout: a.settings.maxClient.deadline,
}
It does work the same as it was implemented manually for the mux or is there some difference? Based on the naming, throttler and limiter might work a bit differently.
When I checked code of
middleware.ThrottleOpts
previously, it seemed to be almost the same. I'll check it again// Throttle is a middleware that limits number of currently processed requests
// at a time across all users. Note: Throttle is not a rate-limiter per user,
// instead it just puts a ceiling on the number of currentl in-flight requests
// being processed from the point from where the Throttle middleware is mounted.
So it's what we need. There are some difference though:
http.StatusTooManyRequests
error, our previous implementation returnshttp.StatusServiceUnavailable
3620357d4a
toa3ae0004b6