evseevnn-zz / php-cassandra-binary

PHP library for Cassandra database via a binary protocol.
http://evseevnn.github.io/php-cassandra-binary/
MIT License
69 stars 33 forks source link

Multi-threading #50

Open ocyedwin opened 9 years ago

ocyedwin commented 9 years ago

Hi,

What is the equivalent of Java multi-threading or executeAsync() when using php-cassandra-binary or developing for Cassandra in PHP in general?

How do I achieve non-blocking, concurrent read/writes to boost throughput?

Thanks, Edwin

LarsFronius commented 9 years ago

Assuming you are not trolling PHP here. There is in fact no real async/threading option available in PHPs core. You can do some hacks on socket connections as we use them in this library by closing them before waiting for replies and setting them to non blocking. This is not async, this has nothing do to with threading and you won't get to know response values. https://segment.com/blog/how-to-make-async-requests-in-php/

ocyedwin commented 9 years ago

Haha, no I'm not trolling. I've did some benchmark with cassandra-stress, and it seems like they are achieving their high throughput by threading. I'm wondering how can i achieve such performance using PHP. Any advice?

danielsand commented 9 years ago

hurm :) like Lars pointed out before - there is no easy way of doing this in PHP - because its not designed for this :P the blog post he posted is an approach of trying to achieve what you are looking for...