[ 
https://issues.apache.org/jira/browse/CALCITE-5581?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17703554#comment-17703554
 ] 

Istvan Toth commented on CALCITE-5581:
--------------------------------------

Thank you [~vjoshi] .

I have left some comments on the PR.

However, there are some broader issues that may be better discussed directly on 
the ticket.

Your current PR is very minimal, I would consider adding two more features, 
that would add useful functionality without bloating the client, or adding too 
much complexity:

1. 
Maintaining a list of servers with recently failed connections.
This does not need a backround liveness check, we can use two sources:
- Note whenever a new connection attempt fails, which is simple
- Note when an existing connection fails, evaluate the reason, and check if it 
was caused by a server failure. This one less straightforward, and probably not 
worth it for a first cut.

We can
 * simply move failing servers to the end of the list. (Only works for round 
robin)
 * or maintain a failed server list for a period of time. This one is more 
complex, we have to handle each server getting on the failed list, and removing 
servers from there.

2.
Automatically re-trying the connection on failure.
The current implementation leaves the reconnection attempt to the application, 
which it should ideally handle anyway.
However, we could also handle the failing connections within Avatica.

This could work by defining a timeout for connecting, and automatically failing 
over to another server if the connection returns an error, or if it is not 
connecting successfully within the timout.
We need to decide or mak configurable things like what the connection timeout 
is, how long do we keep trying before reporting failure to the client, etc.

> 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
>              Labels: pull-request-available
>         Attachments: Avatica Basic client side load balancing.docx
>
>          Time Spent: 0.5h
>  Remaining Estimate: 0h
>
> 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)

Reply via email to