You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@cassandra.apache.org by Tomas Nunez <to...@groupalia.com> on 2012/12/18 10:37:49 UTC

Monitoring the number of client connections

Hi!

I want to know how many client connections has each one of my cluster nodes
(to check if my load balancing is spreading in a balanced way, to check if
increase in the cluster load can be related to an increase in the number of
connections, and things like that). I was thinking about going with
netstat, counting ESTABLISHED connections to port 9160, but then I thought
maybe there is some way in cassandra to get that information (maybe a
counter of connections in the JMX?). I've tried installing MX4J and going
over all MBeans, but I haven't found any with a promising name, they all
seem unrelated to this information. And I can't find anything skimming the
manual, so...

Can you think a better way than "netstat" to get this information? Better
yet, is there anything similar to "Show processlist" in mysql?

Thanks!

-- 
[image: Groupalia] <http://es.groupalia.com/>
www.groupalia.com <http://es.groupalia.com/>Tomàs NúñezIT-SysprodTel. + 34
93 159 31 00 Fax. + 34 93 396 18 52Llull, 95-97, 2º planta, 08005
BarcelonaSkype:
tomas.nunez.groupaliatomas.nunez@groupalia.com<no...@groupalia.com>[image:
Twitter] Twitter <http://twitter.com/#%21/groupaliaes>    [image: Twitter]
 Facebook <https://www.facebook.com/GroupaliaEspana>    [image: Twitter]
 Linkedin <http://www.linkedin.com/company/groupalia>

Re: Monitoring the number of client connections

Posted by Edward Capriolo <ed...@gmail.com>.
In the TCP mib for SNMP (Simple Network Management Protocol) this
information is available

http://www.simpleweb.org/ietf/mibs/mibSynHiLite.php?category=IETF&module=TCP-MIB

On Wed, Dec 19, 2012 at 12:22 AM, Michael Kjellman
<mk...@barracuda.com>wrote:

> netstat + cron is your friend at this point in time
>
> On Dec 18, 2012, at 8:25 PM, "aaron morton" <aa...@thelastpickle.com>
> wrote:
>
> AFAIK the count connections is not exposed.
>
> Cheers
>
> -----------------
> Aaron Morton
> Freelance Cassandra Developer
> New Zealand
>
> @aaronmorton
> http://www.thelastpickle.com
>
> On 18/12/2012, at 10:37 PM, Tomas Nunez <to...@groupalia.com> wrote:
>
> Hi!
>
> I want to know how many client connections has each one of my cluster
> nodes (to check if my load balancing is spreading in a balanced way, to
> check if increase in the cluster load can be related to an increase in the
> number of connections, and things like that). I was thinking about going
> with netstat, counting ESTABLISHED connections to port 9160, but then I
> thought maybe there is some way in cassandra to get that information (maybe
> a counter of connections in the JMX?). I've tried installing MX4J and going
> over all MBeans, but I haven't found any with a promising name, they all
> seem unrelated to this information. And I can't find anything skimming the
> manual, so...
>
> Can you think a better way than "netstat" to get this information? Better
> yet, is there anything similar to "Show processlist" in mysql?
>
> Thanks!
>
> --
> <groupalia.jpg> <http://es.groupalia.com/>
> www.groupalia.com <http://es.groupalia.com/> Tomàs Núñez IT-Sysprod Tel. +
> 34 93 159 31 00 Fax. + 34 93 396 18 52 Llull, 95-97, 2º planta, 08005
> BarcelonaSkype: tomas.nunez.groupalia tomas.nunez@groupalia.com<no...@groupalia.com>
> <twitter.png> Twitter <http://twitter.com/#%21/groupaliaes>
> <facebook.png> Facebook <https://www.facebook.com/GroupaliaEspana>
> <linkedin.png> Linkedin <http://www.linkedin.com/company/groupalia>
>
>
>
> ----------------------------------
> Join Barracuda Networks in the fight against hunger.
> To learn how you can help in your community, please visit:
> http://on.fb.me/UAdL4f
>   ­­
>

Re: Monitoring the number of client connections

Posted by Michael Kjellman <mk...@barracuda.com>.
netstat + cron is your friend at this point in time

On Dec 18, 2012, at 8:25 PM, "aaron morton" <aa...@thelastpickle.com>> wrote:

AFAIK the count connections is not exposed.

Cheers

-----------------
Aaron Morton
Freelance Cassandra Developer
New Zealand

@aaronmorton
http://www.thelastpickle.com

On 18/12/2012, at 10:37 PM, Tomas Nunez <to...@groupalia.com>> wrote:

Hi!

I want to know how many client connections has each one of my cluster nodes (to check if my load balancing is spreading in a balanced way, to check if increase in the cluster load can be related to an increase in the number of connections, and things like that). I was thinking about going with netstat, counting ESTABLISHED connections to port 9160, but then I thought maybe there is some way in cassandra to get that information (maybe a counter of connections in the JMX?). I've tried installing MX4J and going over all MBeans, but I haven't found any with a promising name, they all seem unrelated to this information. And I can't find anything skimming the manual, so...

Can you think a better way than "netstat" to get this information? Better yet, is there anything similar to "Show processlist" in mysql?

Thanks!

--
<groupalia.jpg><http://es.groupalia.com/>
www.groupalia.com<http://es.groupalia.com/>
Tomàs Núñez
IT-Sysprod
Tel. + 34 93 159 31 00
Fax. + 34 93 396 18 52
Llull, 95-97, 2º planta, 08005 Barcelona
Skype: tomas.nunez.groupalia
tomas.nunez@groupalia.com<ma...@groupalia.com>
<twitter.png> Twitter<http://twitter.com/#%21/groupaliaes>    <facebook.png> Facebook<https://www.facebook.com/GroupaliaEspana>    <linkedin.png> Linkedin<http://www.linkedin.com/company/groupalia>





Join Barracuda Networks in the fight against hunger.
To learn how you can help in your community, please visit: http://on.fb.me/UAdL4f




Re: Monitoring the number of client connections

Posted by aaron morton <aa...@thelastpickle.com>.
AFAIK the count connections is not exposed. 

Cheers

-----------------
Aaron Morton
Freelance Cassandra Developer
New Zealand

@aaronmorton
http://www.thelastpickle.com

On 18/12/2012, at 10:37 PM, Tomas Nunez <to...@groupalia.com> wrote:

> Hi!
> 
> I want to know how many client connections has each one of my cluster nodes (to check if my load balancing is spreading in a balanced way, to check if increase in the cluster load can be related to an increase in the number of connections, and things like that). I was thinking about going with netstat, counting ESTABLISHED connections to port 9160, but then I thought maybe there is some way in cassandra to get that information (maybe a counter of connections in the JMX?). I've tried installing MX4J and going over all MBeans, but I haven't found any with a promising name, they all seem unrelated to this information. And I can't find anything skimming the manual, so...
> 
> Can you think a better way than "netstat" to get this information? Better yet, is there anything similar to "Show processlist" in mysql?
> 
> Thanks!
> 
> -- 
> <groupalia.jpg>
> www.groupalia.com	
> Tomàs Núñez
> IT-Sysprod
> Tel. + 34 93 159 31 00 
> Fax. + 34 93 396 18 52
> Llull, 95-97, 2º planta, 08005 Barcelona
> Skype: tomas.nunez.groupalia
> tomas.nunez@groupalia.com
> <twitter.png> Twitter    <facebook.png> Facebook    <linkedin.png> Linkedin
> 


Re: Monitoring the number of client connections

Posted by Rob Coli <rc...@palominodb.com>.
For those playing along at home, I have filed
https://issues.apache.org/jira/browse/CASSANDRA-5084 ("Cassandra
should expose connected client state via JMX") as a result of this
thread.

=Rob

-- 
=Robert Coli
AIM&GTALK - rcoli@palominodb.com
YAHOO - rcoli.palominob
SKYPE - rcoli_palominodb

Re: Monitoring the number of client connections

Posted by Rob Coli <rc...@palominodb.com>.
On Thu, Dec 20, 2012 at 12:41 PM, Rob Coli <rc...@palominodb.com> wrote:
> So, by default Cassandra does in fact use one thread per thrift connection.

Also of note is that even with hsha, an *active* connection (where
synchronous storage backend is doing something) consumes a thread.
Some more background at :
https://issues.apache.org/jira/browse/CASSANDRA-4277

=Rob

-- 
=Robert Coli
AIM&GTALK - rcoli@palominodb.com
YAHOO - rcoli.palominob
SKYPE - rcoli_palominodb

Re: Monitoring the number of client connections

Posted by Rob Coli <rc...@palominodb.com>.
On Wed, Dec 19, 2012 at 4:20 PM, Hiller, Dean <De...@nrel.gov> wrote:
> What????? I thought cassandra was using nio so thread per connection is not true?

Here's the monkey test I used to verify my conjecture.

1) ps -eLf |grep jsvc |grep cassandra | wc -l # note number of threads
2) for name in {1..300}; do  cassandra-cli -h `hostname` -k validkeyspace & done
3) ps -eLf |grep jsvc | grep cassandra | wc -l # note much higher
number of threads
4) for name in {1..300}; do kill "%$name" done
5) ps -eLf |grep jsvc | grep cassandra | wc -l # note that thread
count drops like a rock as connections are GCed

Via aaron_morton, here's the relevant chunk of cassandra.yaml :

https://github.com/apache/cassandra/blob/trunk/conf/cassandra.yaml#L347
"
# sync  -> One thread per thrift connection.
..
# hsha  -> Stands for "half synchronous, half asynchronous."
..
# The default is sync because on Windows hsha is about 30% slower.  On Linux,
# sync/hsha performance is about the same, with hsha of course using
less memory.
"

So, by default Cassandra does in fact use one thread per thrift connection.

=Rob

-- 
=Robert Coli
AIM&GTALK - rcoli@palominodb.com
YAHOO - rcoli.palominob
SKYPE - rcoli_palominodb

Re: Monitoring the number of client connections

Posted by "Hiller, Dean" <De...@nrel.gov>.
What????? I thought cassandra was using nio so thread per connection is not true?

Dean

From: Rob Coli <rc...@palominodb.com>>
Reply-To: "user@cassandra.apache.org<ma...@cassandra.apache.org>" <us...@cassandra.apache.org>>
Date: Wednesday, December 19, 2012 4:49 PM
To: "user@cassandra.apache.org<ma...@cassandra.apache.org>" <us...@cassandra.apache.org>>
Subject: Re: Monitoring the number of client connections

On Tue, Dec 18, 2012 at 1:37 AM, Tomas Nunez <to...@groupalia.com>> wrote:
Can you think a better way than "netstat" to get this information? Better yet, is there anything similar to "Show processlist" in mysql?

An easy/not very accurate proxy for this is the thread count within the jvm. An open connection has a thread associated with it.

ps -eLf

etc.

=Rob

--
=Robert Coli
AIM&GTALK - rcoli@palominodb.com<ma...@palominodb.com>
YAHOO - rcoli.palominob
SKYPE - rcoli_palominodb



Re: Monitoring the number of client connections

Posted by Rob Coli <rc...@palominodb.com>.
On Tue, Dec 18, 2012 at 1:37 AM, Tomas Nunez <to...@groupalia.com>wrote:

> Can you think a better way than "netstat" to get this information? Better
> yet, is there anything similar to "Show processlist" in mysql?


An easy/not very accurate proxy for this is the thread count within the
jvm. An open connection has a thread associated with it.

ps -eLf

etc.

=Rob

-- 
=Robert Coli
AIM&GTALK - rcoli@palominodb.com
YAHOO - rcoli.palominob
SKYPE - rcoli_palominodb