-
-
Notifications
You must be signed in to change notification settings - Fork 4.6k
api: Add all in-flight requests /reverse_proxy/upstreams (#7277) #7281
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
base: master
Are you sure you want to change the base?
Conversation
| di.Upstream.Host.countRequest(-1) | ||
| inflightHost := inflightHosts.Load(di.Address) | ||
| if inflightHost != nil { | ||
| host, _ := inflightHost.(*Host) | ||
| host.countRequest(-1) |
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.
di.Upstream.Host and inflightHost.(*Host) could point to the same Host, so countRequest(-1) might be applied twice.
| host := new(Host) | ||
| existingHost, loaded := inflightHosts.LoadOrStore(u.String(), host) | ||
| if loaded { | ||
| host = existingHost.(*Host) | ||
| } | ||
| _ = host.countRequest(numRemaiRequests) | ||
| u.Host = host |
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.
Just a thought - would it be simpler to just add the old host to inflightHosts rather than creating a new one?
|
Wondering if a UsagePool is really the right abstraction for this. UsagePools are useful specifically for managing an allocated value based on reference counting. If the goal is to just count active requests per upstream, maybe a map of |
Assistance Disclosure
No AI was used.
Fixes: #7277
Introducing new usagePool named
inflightHostswhich store the host is still in-flight upstream in reverse proxy Cleanup phase. and when proxyLoopIteration returns done, the inflightHost drain in the usagePool.Here is scope for improvement because it is draft status now.