Am 18. Januar 2023 23:20:29 MEZ schrieb Christopher Schultz 
<ch...@christopherschultz.net>:
>Thomas,
>
>On 1/17/23 13:33, Thomas Meyer wrote:
>> Does Tomcat's CP support exponential backoff in case DB is unavailable for 
>> some reason?
>> I didn't find anything in the documentation in this regards.
>
>I don't think is supports any such thing. What would be the purpose of 
>exponential back-off... don't you want to connect ASAP?

Hi,

Not really sure, but I think the idea is to protect the database from getting 
overloaded with requests once it's coming up again.

Sadly the description given in
https://cloud.google.com/sql/docs/postgres/manage-connections#backoff

Is very vague and I think won't really help much to mitigate above problem, if 
any.

I found this interesting article and test class that tries to demonstrate the 
resp. behavior of the situation:
https://github.com/brettwooldridge/HikariCP/wiki/Bad-Behavior:-Handling-Database-Down
https://github.com/brettwooldridge/HikariCP-benchmark/blob/master/src/test/java/com/zaxxer/hikari/benchmark/DbDownTest.java

There seems also to be an reply to above benchmark from the vibur dbcp author, 
which has some interesting points:
https://github.com/brettwooldridge/HikariCP/issues/230

While investigating the reason of why exponential backoff would make sense I 
also did stumble across this article:
https://aws.amazon.com/de/blogs/architecture/exponential-backoff-and-jitter/

This article make much more sense in my head, I.e. use exponential backoff with 
jitter to protect the restarting database from getting "flooded".

But HikariCP does only support plain exponential backoff and probably won't 
help much in above described situation, because once the database is starting 
to accept connections again, all HikariCP connections will probably align at 
the same time to start creating connections again.

>
>-chris
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
>For additional commands, e-mail: users-h...@tomcat.apache.org
>

-- 
Diese Nachricht wurde von meinem Android-Gerät mit K-9 Mail gesendet.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org

Reply via email to