Re: Thrift + PHP: help!

2010-08-30 Thread Mike Peters

Juho, do you mind sharing your implementation with the group? 

We'd love to help as well with rewriting the thrift interface, specificaly
TSocket.php which seems to be where the majority of the problems are
lurking. 

Has anyone tried compiling native thrift support as described here 
https://wiki.fourkitchens.com/display/PF/Using+Cassandra+with+PHP
https://wiki.fourkitchens.com/display/PF/Using+Cassandra+with+PHP   
-- 
View this message in context: 
http://cassandra-user-incubator-apache-org.3065146.n2.nabble.com/Thrift-PHP-help-tp5437314p5478057.html
Sent from the cassandra-u...@incubator.apache.org mailing list archive at 
Nabble.com.


Re: Thrift + PHP: help!

2010-08-30 Thread Mike Peters

 Interesting! Thanks for sharing

Have you considered instead of retrying the failing node, to iterate 
through other nodes in your cluster?


If one node is failing (let's assume it's overloaded for a minute), 
you're probably going to be better off having the client send the insert 
to the next node in line.


Thoughts?

On 8/30/2010 9:17 AM, Juho Mäkinen wrote:


Yes, I've already planning to do so. The class has still some
dependencies into our other functions which I need to first clear out.

Basically each api call is wrapped inside a retry loop as we can
assume that each operation can be retried as many times as needed:
$tries = 0;
$this-last_exception = null;
$delay = 1000; // start with 1ms retry delay
do {
try {
$this-client-insert($this-keyspace, $key, 
$column_path, $value,
$timestamp, $consistency_level);
return;
} catch (cassandra_InvalidRequestException $e) {
Logger::error(InvalidRequestException:  . 
$e-why . ',
stacktrace: ' . $e-getMessage());
throw $e;
} catch (Exception $e) {
$this-last_exception = $e;
$tries++;

// sleep for some time and try again
usleep($delay);
$delay = $delay * 3;
$this-connect(); // Drop current server and 
reopen a connection
into another server
}



} while ($tries  4);
// Give up and throw the last exception
throw $this-last_exception;


  - Juho Mäkinen

On Mon, Aug 30, 2010 at 3:48 PM, Mike Peters
cassan...@softwareprojects.com  wrote:

Juho, do you mind sharing your implementation with the group?

We'd love to help as well with rewriting the thrift interface, specificaly
TSocket.php which seems to be where the majority of the problems are
lurking.

Has anyone tried compiling native thrift support as described here
https://wiki.fourkitchens.com/display/PF/Using+Cassandra+with+PHP
https://wiki.fourkitchens.com/display/PF/Using+Cassandra+with+PHP
--
View this message in context: 
http://cassandra-user-incubator-apache-org.3065146.n2.nabble.com/Thrift-PHP-help-tp5437314p5478057.html
Sent from the cassandra-u...@incubator.apache.org mailing list archive at 
Nabble.com.







Re: Thrift + PHP: help!

2010-08-30 Thread Juho Mäkinen
On Mon, Aug 30, 2010 at 4:24 PM, Mike Peters
cassan...@softwareprojects.com wrote:
 Have you considered instead of retrying the failing node, to iterate through
 other nodes in your cluster?


Yes, the $this-connect() does just that: it removes the previous node
from the node list and gives the list back to thrift connection
function. In case all nodes have been tried (and thus removed) it
refills the node list and starts looping it again. In practice this
will never happen but the code is there just to be sure :)

 - Juho Mäkinen




 If one node is failing (let's assume it's overloaded for a minute), you're
 probably going to be better off having the client send the insert to the
 next node in line.

 Thoughts?

 On 8/30/2010 9:17 AM, Juho Mäkinen wrote:

 Yes, I've already planning to do so. The class has still some
 dependencies into our other functions which I need to first clear out.

 Basically each api call is wrapped inside a retry loop as we can
 assume that each operation can be retried as many times as needed:
                $tries = 0;
                $this-last_exception = null;
                $delay = 1000; // start with 1ms retry delay
                do {
                        try {
                                $this-client-insert($this-keyspace,
 $key, $column_path, $value,
 $timestamp, $consistency_level);
                                return;
                        } catch (cassandra_InvalidRequestException $e) {
                                Logger::error(InvalidRequestException:  .
 $e-why . ',
 stacktrace: ' . $e-getMessage());
                                throw $e;
                        } catch (Exception $e) {
                                $this-last_exception = $e;
                                $tries++;

                                // sleep for some time and try again
                                usleep($delay);
                                $delay = $delay * 3;
                                $this-connect(); // Drop current server
 and reopen a connection
 into another server
                        }



                } while ($tries  4);
                // Give up and throw the last exception
                throw $this-last_exception;


  - Juho Mäkinen

 On Mon, Aug 30, 2010 at 3:48 PM, Mike Peters
 cassan...@softwareprojects.com  wrote:

 Juho, do you mind sharing your implementation with the group?

 We'd love to help as well with rewriting the thrift interface,
 specificaly
 TSocket.php which seems to be where the majority of the problems are
 lurking.

 Has anyone tried compiling native thrift support as described here
 https://wiki.fourkitchens.com/display/PF/Using+Cassandra+with+PHP
 https://wiki.fourkitchens.com/display/PF/Using+Cassandra+with+PHP
 --
 View this message in context:
 http://cassandra-user-incubator-apache-org.3065146.n2.nabble.com/Thrift-PHP-help-tp5437314p5478057.html
 Sent from the cassandra-u...@incubator.apache.org mailing list archive at
 Nabble.com.






Re: Thrift + PHP: help!

2010-08-23 Thread Juho Mäkinen
I have had to build a wrapper around php thrift calls which
automatically retry the cassandra thrift operation in case there was a
failure. It's not a proper sollution, but it has worked in our case
well enough to be reliable. Of course it would be nice if I wouldn't
need such ugly hack.

 - Garo

 On Wednesday, August 18, 2010, Jeremy Hanna jeremy.hanna1...@gmail.com
 wrote:
  As Jonathan mentioned in his keynote at the Cassandra Summit, the
  thrift + php has some bugs and is maintainerless right now.
 
  Is there anyone out there in the Cassandra community that is adept at
  PHP that could help out with the thrift + php work?  It would benefit all
  who use Cassandra with PHP.
 
  Bryan Duxbury, a thrift developer/committer, said if someone really
  wanted to have a go at making thrift php robust, i would assist them
  heavily.
 
  Please respond to this thread or ask Bryan in the channel.




 --
 Gabriel Sosa
 Si buscas resultados distintos, no hagas siempre lo mismo. - Einstein




Re: Thrift + PHP: help!

2010-08-19 Thread Dave Viner
I am a user of the perl api - so I'd like to lurk in case there are things
that can benefit both perl  php.

Dave Viner


On Wed, Aug 18, 2010 at 1:35 PM, Gabriel Sosa sosagabr...@gmail.com wrote:

 I would like to help with this too!


 On Wed, Aug 18, 2010 at 5:15 PM, Bas Kok bakot...@gmail.com wrote:

 I have some experience in this area and would be happy to help out as
 well.
 --
 Bas


 On Wed, Aug 18, 2010 at 8:26 PM, Dave Gardner 
 dave.gard...@imagini.netwrote:

 I'm happy to assist. Having a robust PHP implementation would help us
 greatly.

 Dave

 On Wednesday, August 18, 2010, Jeremy Hanna jeremy.hanna1...@gmail.com
 wrote:
  As Jonathan mentioned in his keynote at the Cassandra Summit, the
 thrift + php has some bugs and is maintainerless right now.
 
  Is there anyone out there in the Cassandra community that is adept at
 PHP that could help out with the thrift + php work?  It would benefit all
 who use Cassandra with PHP.
 
  Bryan Duxbury, a thrift developer/committer, said if someone really
 wanted to have a go at making thrift php robust, i would assist them
 heavily.
 
  Please respond to this thread or ask Bryan in the channel.





 --
 Gabriel Sosa
 Si buscas resultados distintos, no hagas siempre lo mismo. - Einstein



Re: Thrift + PHP: help!

2010-08-18 Thread Dave Gardner
I'm happy to assist. Having a robust PHP implementation would help us greatly.

Dave

On Wednesday, August 18, 2010, Jeremy Hanna jeremy.hanna1...@gmail.com wrote:
 As Jonathan mentioned in his keynote at the Cassandra Summit, the thrift + 
 php has some bugs and is maintainerless right now.

 Is there anyone out there in the Cassandra community that is adept at PHP 
 that could help out with the thrift + php work?  It would benefit all who use 
 Cassandra with PHP.

 Bryan Duxbury, a thrift developer/committer, said if someone really wanted 
 to have a go at making thrift php robust, i would assist them heavily.

 Please respond to this thread or ask Bryan in the channel.


Re: Thrift + PHP: help!

2010-08-18 Thread Bas Kok
I have some experience in this area and would be happy to help out as well.
-- 
Bas

On Wed, Aug 18, 2010 at 8:26 PM, Dave Gardner dave.gard...@imagini.netwrote:

 I'm happy to assist. Having a robust PHP implementation would help us
 greatly.

 Dave

 On Wednesday, August 18, 2010, Jeremy Hanna jeremy.hanna1...@gmail.com
 wrote:
  As Jonathan mentioned in his keynote at the Cassandra Summit, the thrift
 + php has some bugs and is maintainerless right now.
 
  Is there anyone out there in the Cassandra community that is adept at PHP
 that could help out with the thrift + php work?  It would benefit all who
 use Cassandra with PHP.
 
  Bryan Duxbury, a thrift developer/committer, said if someone really
 wanted to have a go at making thrift php robust, i would assist them
 heavily.
 
  Please respond to this thread or ask Bryan in the channel.



Re: Thrift + PHP: help!

2010-08-18 Thread Gabriel Sosa
I would like to help with this too!

On Wed, Aug 18, 2010 at 5:15 PM, Bas Kok bakot...@gmail.com wrote:

 I have some experience in this area and would be happy to help out as well.
 --
 Bas


 On Wed, Aug 18, 2010 at 8:26 PM, Dave Gardner dave.gard...@imagini.netwrote:

 I'm happy to assist. Having a robust PHP implementation would help us
 greatly.

 Dave

 On Wednesday, August 18, 2010, Jeremy Hanna jeremy.hanna1...@gmail.com
 wrote:
  As Jonathan mentioned in his keynote at the Cassandra Summit, the thrift
 + php has some bugs and is maintainerless right now.
 
  Is there anyone out there in the Cassandra community that is adept at
 PHP that could help out with the thrift + php work?  It would benefit all
 who use Cassandra with PHP.
 
  Bryan Duxbury, a thrift developer/committer, said if someone really
 wanted to have a go at making thrift php robust, i would assist them
 heavily.
 
  Please respond to this thread or ask Bryan in the channel.





-- 
Gabriel Sosa
Si buscas resultados distintos, no hagas siempre lo mismo. - Einstein