-
Notifications
You must be signed in to change notification settings - Fork 9.2k
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
Client-side load balancing #4530
Comments
1 to preallocated connections, I've done horrors like this before https://github.com/yschimke/okurl/blob/master/src/test/kotlin/commands/uberprices.kts#L18
|
How intelligent do you plan the load balancing strategies to be? Or round robin. Do you want resilience by connecting to multiple backends when multiple ips are available. |
I think we probably want to make the load balancing strategies pluggable. I’m generally not into pluggable things (why not just include a good implementation in the box!) but in this case I think being pluggable gives us options we can’t build otherwise. One strategy I really like is from what gRPC calls an external load balancer. |
I am interested in seeing this happen, primarily for increased resilience by always being connected to multiple backends, spreading requests among them.
|
|
Is this still a 4.1 target? |
Dropped to backlog. 4.1 should be small! |
Also related to #5424 Servers may indicate they don't want coalescing. |
Implicit requirement: Need visibility into effectiveness of these controls, whether servers are misconfigured and working against it, and whether there is pathological behaviour e.g. connection churn due to connection pool mis-sizing. Ideally APIs would also allow for handling two cases
|
@swankjesse Any interest in kicking off discussion? |
Yes! Gimme a couple days to write up some use cases. Can you write some too? I'd like to start by scoping what problems we're interested in addressing, and then move to modeling a solution. |
Actor: Developer working on Android network performance For my app, I want to understand performance related metrics. Particularly before and after tuning the connection pool or making server related changes.
|
Actor: Developer working on Android app functionality If I have issues with certain phones and faulty connections, I'd like ways to debug and report problems. What network type (wifi, cell) is a connection over. Close a connection that is persistently failing (ideally this is fixed by OkHttp without intervention). Expose enough state to allow hooking tightly into developer tooling like fbflipper, chucker, to provide visibility into app performance. |
Actor: Developer working on Android app functionality I only want to download video over fast connections, or hit an intranet API when over a corporate wifi. Close an existing low latency stream and proactively reconnect on a fast stream before first use. Hook into Android network events to optimise. Relate this to app foreground state, or battery usage. |
These can be different requirements, wholly distinct features but they seems best addressed cohesively e.g. when do you want to proactively open and hold onto connections? When do you want to close/avoid persistent connections to save battery in the background? When do you want your app to start downloading and cache content opportunistically. When is load balancing appropriate? Observe, understand, tune/optimise. |
Also relates to #3997 "Tune ConnectionPool pruning" |
Hello, what is the status of the task? We have a scenario when we try to send logs to and our backend guys give us a bunch of host URLs, So we have to The code is ugly but works, so I interested in advice maybe OkHttpClient has a better API for our scenario |
@sboishtyan that solution isn't that ugly! It's potentially part of what a load balancer would do. Biggest challenge on this issue is what the API looks like. It has the potential to be too simple or too complex! |
@swankjesse Could I help you with something that helps you design the API? |
I’m not interested in contributions here right now. But if you have further details on your use case, please share. |
We’re using OkHttp for server-to-server connections on high-latency HTTP/2 connections. I’d like some load-balancing features:
Multiple HTTP/2 connections to the same hostname IP address. We currently have code that aggressively tries to deduplicate connections to the same destination. But our destinations are virtual server-side load balancers that front application servers. We want to cycle out these application servers without clients having to wait for TLS handshakes.
Preallocated connections. Seeding the connection pool before we need it, so when we do we don’t have to pay for a TLS handshake.
Client-side connection TTLs. Long-lived connections can hide problems. By forcing connections to be recreated at a regular interval (say, 1 hour) we can detect performance problems (thundering herds, etc.) before they bite.
The text was updated successfully, but these errors were encountered: