You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@cassandra.apache.org by Shaurya Gupta <sh...@gmail.com> on 2023/08/25 17:38:45 UTC

Testing Cassandra connectivity at application startup

Hi community

We want to validate cassandra connectivity from the application container
when it starts up and before it reports as healthy to K8s. Is doing

> select * from our_keyspace.table limit 1

fine Or is it an inefficient query and should not be fired on a prod
cluster ?

Any other suggestions ?

-- 
Shaurya Gupta

Re: Testing Cassandra connectivity at application startup

Posted by "C. Scott Andreas" <sc...@paradoxica.net>.
“select * from …” without a predicate from a user table would be very expensive, yes.

A query from a small, node-local system table such as “select * from system.peers” would make a better health check. 👍

- Scott

> On Aug 25, 2023, at 10:58 AM, Raphael Mazelier <ra...@futomaki.net> wrote:
> 
> 
> Mind that a new connection is really costly for C*.
> So at startup it's fine. but not in a  liveness or readiness check imo. For the query why not select 1; ?
> 
> --
> 
> Raphael Mazelier
> 
> 
> 
> On 25/08/2023 19:38, Shaurya Gupta wrote:
>> Hi community
>> 
>> We want to validate cassandra connectivity from the application container when it starts up and before it reports as healthy to K8s. Is doing 
>>> select * from our_keyspace.table limit 1
>> fine Or is it an inefficient query and should not be fired on a prod cluster ?
>> 
>> Any other suggestions ?
>> 
>> --
>> Shaurya Gupta
>> 
>> 

Re: Testing Cassandra connectivity at application startup

Posted by Andrew Weaver <an...@gmail.com>.
For a readiness probe and for ongoing ECV checks, just making sure the
driver is initialized is enough. I've seen problems recently with
applications running "select cluster_name from system.local" for ECV
checks.  We haven't dug into it in detail yet but with a large number of
clients it puts a lot of load on just a handful of nodes in the cluster. So
as always, test it well before putting something like this in production
especially for large deployments.

On Fri, Aug 25, 2023, 1:19 PM Raphael Mazelier <ra...@futomaki.net> wrote:

> That's a good way to it!
> On 25/08/2023 20:10, Shaurya Gupta wrote:
>
> We don't plan to open a new connection. It should use the same
> connection(s) which the application will use.
>
> On Fri, Aug 25, 2023 at 10:59 AM Raphael Mazelier <ra...@futomaki.net>
> wrote:
>
>> Mind that a new connection is really costly for C*.
>> So at startup it's fine. but not in a  liveness or readiness check imo.
>> For the query why not select 1; ?
>>
>> --
>>
>> Raphael Mazelier
>>
>>
>> On 25/08/2023 19:38, Shaurya Gupta wrote:
>>
>> Hi community
>>
>> We want to validate cassandra connectivity from the application container
>> when it starts up and before it reports as healthy to K8s. Is doing
>>
>>> select * from our_keyspace.table limit 1
>>
>> fine Or is it an inefficient query and should not be fired on a prod
>> cluster ?
>>
>> Any other suggestions ?
>>
>> --
>> Shaurya Gupta
>>
>>
>>
>
> --
> Shaurya Gupta
>
>
>

Re: Testing Cassandra connectivity at application startup

Posted by Raphael Mazelier <ra...@futomaki.net>.
That's a good way to it!

On 25/08/2023 20:10, Shaurya Gupta wrote:

> We don't plan to open a new connection. It should use the same connection(s) which the application will use.
>
> On Fri, Aug 25, 2023 at 10:59 AM Raphael Mazelier <ra...@futomaki.net> wrote:
>
>> Mind that a new connection is really costly for C*.
>> So at startup it's fine. but not in a liveness or readiness check imo. For the query why not select 1; ?
>>
>> --
>>
>> Raphael Mazelier
>>
>> On 25/08/2023 19:38, Shaurya Gupta wrote:
>>
>>> Hi community
>>>
>>> We want to validate cassandra connectivity from the application container when it starts up and before it reports as healthy to K8s. Is doing
>>>
>>>> select * from our_keyspace.table limit 1
>>>
>>> fine Or is it an inefficient query and should not be fired on a prod cluster ?
>>>
>>> Any other suggestions ?
>>> --
>>>
>>> Shaurya Gupta
>
> --
>
> Shaurya Gupta

Re: Testing Cassandra connectivity at application startup

Posted by Shaurya Gupta <sh...@gmail.com>.
We don't plan to open a new connection. It should use the same
connection(s) which the application will use.

On Fri, Aug 25, 2023 at 10:59 AM Raphael Mazelier <ra...@futomaki.net> wrote:

> Mind that a new connection is really costly for C*.
> So at startup it's fine. but not in a  liveness or readiness check imo.
> For the query why not select 1; ?
>
> --
>
> Raphael Mazelier
>
>
> On 25/08/2023 19:38, Shaurya Gupta wrote:
>
> Hi community
>
> We want to validate cassandra connectivity from the application container
> when it starts up and before it reports as healthy to K8s. Is doing
>
>> select * from our_keyspace.table limit 1
>
> fine Or is it an inefficient query and should not be fired on a prod
> cluster ?
>
> Any other suggestions ?
>
> --
> Shaurya Gupta
>
>
>

-- 
Shaurya Gupta

Re: Testing Cassandra connectivity at application startup

Posted by Raphael Mazelier <ra...@futomaki.net>.
Mind that a new connection is really costly for C*.
So at startup it's fine. but not in a liveness or readiness check imo. For the query why not select 1; ?

--

Raphael Mazelier

On 25/08/2023 19:38, Shaurya Gupta wrote:

> Hi community
>
> We want to validate cassandra connectivity from the application container when it starts up and before it reports as healthy to K8s. Is doing
>
>> select * from our_keyspace.table limit 1
>
> fine Or is it an inefficient query and should not be fired on a prod cluster ?
>
> Any other suggestions ?
> --
>
> Shaurya Gupta