You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@cassandra.apache.org by ruslan usifov <ru...@gmail.com> on 2012/05/14 15:57:52 UTC

get dinamicsnith info from php

Hello

I want to route request from php client to minimaly loaded node, so i need
dinamicsnitch info and gosip, how can i get this info fro php. Perhaps need
some daemon that can communicate with cassandra gosip and translate this
info to php (socket for example)???

Re: get dinamicsnith info from php

Posted by "R. Verlangen" <ro...@us2.nl>.
I struggled with this before and decided to use HAProxy which suits my
needs, you can read a little more about it at my personal blog:

http://www.robinverlangen.nl/index/view/4fa902c1596cb-44a627/how-to-solve-the-pain-of-stateless-php-with-cassandra.html


Good luck with it!

2012/5/14 Viktor Jevdokimov <Vi...@adform.com>

>  Let say you have 8 nodes cluster with replication factor 3. If one node
> is down, for its token range you have only 2 nodes left, not 7, which can
> process you requests – other nodes will forward requests to the nearest
> (depends on snitch) or with lower latency (depends on dynamic snitch) of 2
> remaining.****
>
> ** **
>
> I have no idea about PHP and its multithreading capabilities, if it’s
> impossible to run background thread to return dead endpoint to the list,
> instead of checking it on HTTP request thread, you’re stacked. For the
> lower latencies dynamic snitch already do a job for you, selecting a node
> with lower latencies.****
>
> ** **
>
> If you’d like Cassandra to avoid forwarding requests to appropriate node,
> but making a direct request to a node where data is, you need smarter
> client, capable to select node by key and other things to do to achieve
> this.****
>
> ** **
>
> ** **
>
>
>    Best regards / Pagarbiai
> *Viktor Jevdokimov*
> Senior Developer
>
> Email: Viktor.Jevdokimov@adform.com
> Phone: +370 5 212 3063, Fax +370 5 261 0453
> J. Jasinskio 16C, LT-01112 Vilnius, Lithuania
> Follow us on Twitter: @adforminsider <http://twitter.com/#!/adforminsider>
> What is Adform: watch this short video <http://vimeo.com/adform/display>
>  [image: Adform News] <http://www.adform.com>
>
> Disclaimer: The information contained in this message and attachments is
> intended solely for the attention and use of the named addressee and may be
> confidential. If you are not the intended recipient, you are reminded that
> the information remains the property of the sender. You must not use,
> disclose, distribute, copy, print or rely on this e-mail. If you have
> received this message in error, please contact the sender immediately and
> irrevocably delete this message and any copies.
>
> *From:* ruslan usifov [mailto:ruslan.usifov@gmail.com]
> *Sent:* Monday, May 14, 2012 17:41
> *To:* user@cassandra.apache.org
> *Subject:* Re: get dinamicsnith info from php****
>
> ** **
>
> Sorry for my bad english.
>
>
> I want to solve follow problem. For example we down one node for
> maintenance reason, for a long time (30 min). Now we use TSocketPool for
> polling connection to cassandra, but this poll implementation is as i think
> not so good, it have a custom parameter setRetryInterval, with allow off
> broken node (now we set i to 10sec), but this mean that every 10sec pool
> will try to connet down node (i repeat we shutdown node for maintance
> reason), because it doesn't know node dead or node, but cassandra cluster
> know this, and this connection attempt is senselessly, also when node make
> compact it can be heavy loaded, and can't serve client reqest very good (at
> this moment we can got little increase of avg backend responce time)****
>
> 2012/5/14 Viktor Jevdokimov <Vi...@adform.com>****
>
> I’m not sure, that selecting node upon DS is a good idea. First of all
> every node has values about every node, including self. Self DS values are
> always better than others.****
>
>  ****
>
> For example, 3 nodes RF=2:****
>
>  ****
>
> N1****
>
> N2****
>
> N3****
>
> N1****
>
> 0.5ms****
>
> 2ms****
>
> 2ms****
>
> N2****
>
> 2ms****
>
> 0.5ms****
>
> 2ms****
>
> N3****
>
> 2ms****
>
> 2ms****
>
> 0.5ms****
>
>  ****
>
> We have monitored many Cassandra counters, including DS values for every
> node, and graphs shows that latencies is not about load.****
>
>  ****
>
> So the strategy should be based on use case, node count, RF, replica
> placement strategy, read repair chance, and more, and more…****
>
>  ****
>
> What do you want to achieve?****
>
>  ****
>
>  ****
>
> ** **
>
> Best regards / Pagarbiai****
>
> *Viktor Jevdokimov*****
>
> Senior Developer****
>
> ** **
>
> Email: Viktor.Jevdokimov@adform.com****
>
> Phone: +370 5 212 3063, Fax +370 5 261 0453****
>
> J. Jasinskio 16C, LT-01112 Vilnius, Lithuania****
>
> Follow us on Twitter: @adforminsider<http://twitter.com/#%21/adforminsider>
> ****
>
> What is Adform: watch this short video <http://vimeo.com/adform/display>**
> **
>
> [image: Adform News] <http://www.adform.com>****
>
>
> Disclaimer: The information contained in this message and attachments is
> intended solely for the attention and use of the named addressee and may be
> confidential. If you are not the intended recipient, you are reminded that
> the information remains the property of the sender. You must not use,
> disclose, distribute, copy, print or rely on this e-mail. If you have
> received this message in error, please contact the sender immediately and
> irrevocably delete this message and any copies. ****
>
> ** **
>
> *From:* ruslan usifov [mailto:ruslan.usifov@gmail.com]
> *Sent:* Monday, May 14, 2012 16:58
> *To:* user@cassandra.apache.org
> *Subject:* get dinamicsnith info from php****
>
>  ****
>
> Hello
>
> I want to route request from php client to minimaly loaded node, so i need
> dinamicsnitch info and gosip, how can i get this info fro php. Perhaps need
> some daemon that can communicate with cassandra gosip and translate this
> info to php (socket for example)???****
>
> ** **
>



-- 
With kind regards,

Robin Verlangen
www.robinverlangen.nl

RE: get dinamicsnith info from php

Posted by Viktor Jevdokimov <Vi...@adform.com>.
Let say you have 8 nodes cluster with replication factor 3. If one node is down, for its token range you have only 2 nodes left, not 7, which can process you requests - other nodes will forward requests to the nearest (depends on snitch) or with lower latency (depends on dynamic snitch) of 2 remaining.

I have no idea about PHP and its multithreading capabilities, if it's impossible to run background thread to return dead endpoint to the list, instead of checking it on HTTP request thread, you're stacked. For the lower latencies dynamic snitch already do a job for you, selecting a node with lower latencies.

If you'd like Cassandra to avoid forwarding requests to appropriate node, but making a direct request to a node where data is, you need smarter client, capable to select node by key and other things to do to achieve this.




Best regards / Pagarbiai
Viktor Jevdokimov
Senior Developer

Email: Viktor.Jevdokimov@adform.com<ma...@adform.com>
Phone: +370 5 212 3063, Fax +370 5 261 0453
J. Jasinskio 16C, LT-01112 Vilnius, Lithuania
Follow us on Twitter: @adforminsider<http://twitter.com/#!/adforminsider>
What is Adform: watch this short video<http://vimeo.com/adform/display>

[Adform News] <http://www.adform.com>


Disclaimer: The information contained in this message and attachments is intended solely for the attention and use of the named addressee and may be confidential. If you are not the intended recipient, you are reminded that the information remains the property of the sender. You must not use, disclose, distribute, copy, print or rely on this e-mail. If you have received this message in error, please contact the sender immediately and irrevocably delete this message and any copies.

From: ruslan usifov [mailto:ruslan.usifov@gmail.com]
Sent: Monday, May 14, 2012 17:41
To: user@cassandra.apache.org
Subject: Re: get dinamicsnith info from php

Sorry for my bad english.


I want to solve follow problem. For example we down one node for maintenance reason, for a long time (30 min). Now we use TSocketPool for polling connection to cassandra, but this poll implementation is as i think not so good, it have a custom parameter setRetryInterval, with allow off broken node (now we set i to 10sec), but this mean that every 10sec pool will try to connet down node (i repeat we shutdown node for maintance reason), because it doesn't know node dead or node, but cassandra cluster know this, and this connection attempt is senselessly, also when node make compact it can be heavy loaded, and can't serve client reqest very good (at this moment we can got little increase of avg backend responce time)
2012/5/14 Viktor Jevdokimov <Vi...@adform.com>>
I'm not sure, that selecting node upon DS is a good idea. First of all every node has values about every node, including self. Self DS values are always better than others.

For example, 3 nodes RF=2:


N1

N2

N3

N1

0.5ms

2ms

2ms

N2

2ms

0.5ms

2ms

N3

2ms

2ms

0.5ms


We have monitored many Cassandra counters, including DS values for every node, and graphs shows that latencies is not about load.

So the strategy should be based on use case, node count, RF, replica placement strategy, read repair chance, and more, and more...

What do you want to achieve?



Best regards / Pagarbiai
Viktor Jevdokimov
Senior Developer

Email: Viktor.Jevdokimov@adform.com<ma...@adform.com>
Phone: +370 5 212 3063, Fax +370 5 261 0453
J. Jasinskio 16C, LT-01112 Vilnius, Lithuania
Follow us on Twitter: @adforminsider<http://twitter.com/#%21/adforminsider>
What is Adform: watch this short video<http://vimeo.com/adform/display>

[Adform News]<http://www.adform.com>


Disclaimer: The information contained in this message and attachments is intended solely for the attention and use of the named addressee and may be confidential. If you are not the intended recipient, you are reminded that the information remains the property of the sender. You must not use, disclose, distribute, copy, print or rely on this e-mail. If you have received this message in error, please contact the sender immediately and irrevocably delete this message and any copies.

From: ruslan usifov [mailto:ruslan.usifov@gmail.com<ma...@gmail.com>]
Sent: Monday, May 14, 2012 16:58
To: user@cassandra.apache.org<ma...@cassandra.apache.org>
Subject: get dinamicsnith info from php

Hello

I want to route request from php client to minimaly loaded node, so i need dinamicsnitch info and gosip, how can i get this info fro php. Perhaps need some daemon that can communicate with cassandra gosip and translate this info to php (socket for example)???


Re: get dinamicsnith info from php

Posted by ruslan usifov <ru...@gmail.com>.
Sorry for my bad english.


I want to solve follow problem. For example we down one node for
maintenance reason, for a long time (30 min). Now we use TSocketPool for
polling connection to cassandra, but this poll implementation is as i think
not so good, it have a custom parameter setRetryInterval, with allow off
broken node (now we set i to 10sec), but this mean that every 10sec pool
will try to connet down node (i repeat we shutdown node for maintance
reason), because it doesn't know node dead or node, but cassandra cluster
know this, and this connection attempt is senselessly, also when node make
compact it can be heavy loaded, and can't serve client reqest very good (at
this moment we can got little increase of avg backend responce time)

2012/5/14 Viktor Jevdokimov <Vi...@adform.com>

>  I’m not sure, that selecting node upon DS is a good idea. First of all
> every node has values about every node, including self. Self DS values are
> always better than others.****
>
> ** **
>
> For example, 3 nodes RF=2:****
>
> ** **
>
> N1****
>
> N2****
>
> N3****
>
> N1****
>
> 0.5ms****
>
> 2ms****
>
> 2ms****
>
> N2****
>
> 2ms****
>
> 0.5ms****
>
> 2ms****
>
> N3****
>
> 2ms****
>
> 2ms****
>
> 0.5ms****
>
> ** **
>
> We have monitored many Cassandra counters, including DS values for every
> node, and graphs shows that latencies is not about load.****
>
> ** **
>
> So the strategy should be based on use case, node count, RF, replica
> placement strategy, read repair chance, and more, and more…****
>
> ** **
>
> What do you want to achieve?****
>
> ** **
>
> ** **
>
>
>    Best regards / Pagarbiai
> *Viktor Jevdokimov*
> Senior Developer
>
> Email: Viktor.Jevdokimov@adform.com
> Phone: +370 5 212 3063, Fax +370 5 261 0453
> J. Jasinskio 16C, LT-01112 Vilnius, Lithuania
> Follow us on Twitter: @adforminsider<http://twitter.com/#%21/adforminsider>
> What is Adform: watch this short video <http://vimeo.com/adform/display>
>  [image: Adform News] <http://www.adform.com>
>
> Disclaimer: The information contained in this message and attachments is
> intended solely for the attention and use of the named addressee and may be
> confidential. If you are not the intended recipient, you are reminded that
> the information remains the property of the sender. You must not use,
> disclose, distribute, copy, print or rely on this e-mail. If you have
> received this message in error, please contact the sender immediately and
> irrevocably delete this message and any copies.
>
> *From:* ruslan usifov [mailto:ruslan.usifov@gmail.com]
> *Sent:* Monday, May 14, 2012 16:58
> *To:* user@cassandra.apache.org
> *Subject:* get dinamicsnith info from php****
>
> ** **
>
> Hello
>
> I want to route request from php client to minimaly loaded node, so i need
> dinamicsnitch info and gosip, how can i get this info fro php. Perhaps need
> some daemon that can communicate with cassandra gosip and translate this
> info to php (socket for example)???****
>

RE: get dinamicsnith info from php

Posted by Viktor Jevdokimov <Vi...@adform.com>.
I'm not sure, that selecting node upon DS is a good idea. First of all every node has values about every node, including self. Self DS values are always better than others.

For example, 3 nodes RF=2:


N1

N2

N3

N1

0.5ms

2ms

2ms

N2

2ms

0.5ms

2ms

N3

2ms

2ms

0.5ms


We have monitored many Cassandra counters, including DS values for every node, and graphs shows that latencies is not about load.

So the strategy should be based on use case, node count, RF, replica placement strategy, read repair chance, and more, and more...

What do you want to achieve?




Best regards / Pagarbiai
Viktor Jevdokimov
Senior Developer

Email: Viktor.Jevdokimov@adform.com<ma...@adform.com>
Phone: +370 5 212 3063, Fax +370 5 261 0453
J. Jasinskio 16C, LT-01112 Vilnius, Lithuania
Follow us on Twitter: @adforminsider<http://twitter.com/#!/adforminsider>
What is Adform: watch this short video<http://vimeo.com/adform/display>

[Adform News] <http://www.adform.com>


Disclaimer: The information contained in this message and attachments is intended solely for the attention and use of the named addressee and may be confidential. If you are not the intended recipient, you are reminded that the information remains the property of the sender. You must not use, disclose, distribute, copy, print or rely on this e-mail. If you have received this message in error, please contact the sender immediately and irrevocably delete this message and any copies.

From: ruslan usifov [mailto:ruslan.usifov@gmail.com]
Sent: Monday, May 14, 2012 16:58
To: user@cassandra.apache.org
Subject: get dinamicsnith info from php

Hello

I want to route request from php client to minimaly loaded node, so i need dinamicsnitch info and gosip, how can i get this info fro php. Perhaps need some daemon that can communicate with cassandra gosip and translate this info to php (socket for example)???