[
https://issues.apache.org/jira/browse/CALCITE-5581?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17701490#comment-17701490
]
Julian Hyde commented on CALCITE-5581:
--------------------------------------
Implement Basic client side load balancing in Avatica
*Requirement*
As of now following options are available to support High availability in
clients
* Generic Load balancers: Allows DB services to be used behind any generic
load balancer, such as HAProxy, Nginx, or any similar load balancers
* Custom solutions like Client-side PQS discovery for Phoenix thin client see
PHOENIX-3654
But above solutions are a bit complicated, and practical when either “Generic
load balancer” is deployed or a Zookeeper based ecosystem is available for
service discovery. Also many Generic LBs can have issues with Kerberos
connections.
We need a simple client side load balancing solution similar to Mysql where
basic client side load balancing can be configured by few connection properties.
*Proposed solution*
Proposal here is to support a Thin client JDBC connection string like below
{noformat}
jdbc:phoenix:thin:
url=https://<host>:<port>;
serialization=PROTOBUF;
authentication=BASIC;
avatica_user=<userName>;
avatica_password=<userPw>
useClientSideLB: [true/false]
lbStrategy: [RandomDistribution/Sequential/RoundRobin]
lbURLs: <comma separated URls e.g. URL1, URL2,URL3,...URLn>
{noformat}
Here we need to add three connection properties
* {{useClientSideLB=true|false}} - will control whether we want to use client
side load balancing for the connection. This is optional property.
* {{lbStrategy=RandomDistribution|Sequential|RoundRobin}} - Initially we will
support three LB algorithms, but later on other algorithms can be added and
supported. This is optional property and if {{{}useClientSideLB=true{}}},
{{RandomDistribution}} will be used as a default algorithm
* lbURLs ( comma separated list of URLs) - This will be a comma separated list
of URLs for the servers.
Note: Initially We can keep 50 as limit for the number of URLs ( to keep this
list bounded)
The client side LB will pick up a URL from the list using the LB strategy. It
will then use this URL to initiate a connection with the appropriate server. If
the connection is unsuccessful, we will report it as a failure. We will not do
any failover to any other server. The LB strategy will not have any information
about active load on the servers, so it will not do smart routing based on Load
and locality.
Initially we will introduce this as a reference implementation in JAVA. But
Later we can add support for other languages.
Pros
* This feature will provide a basic capability to select servers among the
list and should support primitive high availability and load balancing
requirements.
* We don’t need dependency on a generic load balancer or a zookeeper.
* We are not overloading the client by restricting some load balancing
features ( e.g. services host liveliness checks, smart failover capabilities
etc).
* With this approach we can easily support kerberos authentication with the
servers, since we are creating a direct connection to the selected server .
Cons
* This is not a full fledged client side load balancing like Netflix Ribbon,
so it will have its own limitations.
* In basic implementation, we may not support a long list of query servers,
say 300. We will need a separate mechanism to ( see future work) to fetch a
list of servers.
> Implement Basic client side load balancing in Avatica Driver
> ------------------------------------------------------------
>
> Key: CALCITE-5581
> URL: https://issues.apache.org/jira/browse/CALCITE-5581
> Project: Calcite
> Issue Type: New Feature
> Components: avatica
> Affects Versions: 1.33.0
> Reporter: Vaibhav Joshi
> Assignee: Vaibhav Joshi
> Priority: Major
> Attachments: Avatica Basic client side load balancing.docx
>
>
> Implement mechanism to support Client side load balancing by configuring
> connection properties for load balancing
> {code:java}
> jdbc:phoenix:thin:
> url=https://<host>:<port>;
> serialization=PROTOBUF;
> authentication=BASIC;
> avatica_user=<userName>;
> avatica_password=<userPw>
> useClientSideLB: [true/false]
> lbStrategy: [RandomDistribution/Sequential/RoundRobin]
> lbURLs: <comma separated URls e.g. URL1, URL2,URL3,...URLn> {code}
> Client should connect to any of the URLs specified in lbURLs ( depending on
> LB strategy selected). Please refer to [^Avatica Basic client side load
> balancing.docx]for more details
>
--
This message was sent by Atlassian Jira
(v8.20.10#820010)