Hi Ian,
> Redis (with another for instance MySQL). I was originally running
> Redis on it's own instance and accessing over the internal network but
> when comparing performance to running it on localhost, the difference
> was huge.
This is due to the effects of network round-trip times and it isn't
really something exclusively related to Redis or the client being
used.
> Does anyone have any different experience or advice on the different
> clients?
I can't say anything about Rediska since I don't know how anything
about how it works or how it's implemented.
As the author of Predis, all I can say is that if you are using Redis
on the localhost and you are more interested in raw speed and reduced
memory usage than features and extensibility, then you should just
stick with phpredis. Everything changes once you start connecting to
Redis instances over the network since the differences in speed
between the two gets more or less negligible. This is something that
comes up pretty often with Predis, so you can read more about the
comparison with phpredis here:
http://github.com/nrk/predis/blob/master/FAQ.PERFORMANCES.markdown
By the way, Predis is most likely failing when pipelining those 500000
operations because it's reaching the memory_limit set for a PHP
process.
> My other question was about pipelining - there doesn't seem to be much
> information about how this actually works and should be used with PHP
> but from my tests above, the gain is significant, particularly on
> phpredis.
Pipelining works pretty much the same for all the client libraries
implemented in any language, you can read about the concept of it here
http://redis.io/topics/pipelining. To sum it up briefly, when using
pipelining you are sending multiple commands to Redis without reading
their replies. Redis will queue up the replies for those commands so
that you can read them back later by reading the network stream thus
greatly reducing the side-effects of the network round-trip times.
> What I can't get working is pipelining for retrieval operations (eg:
> gets). Is this possible?
It's not that retrieval operations aren't working, it's just that you
are queueing them up in the pipeline which means that you won't be
able to get the results until you read the stream of replies back from
Redis. Pipelining can be applied only in certain scenarios, for
example you can't perform conditional operations while pipelining (at
least not without using a second connection).
The following example should help clarify things a bit
http://github.com/nrk/predis/blob/master/examples/PipelineContext.php
Cheers,
Daniele
--
Daniele Alessandri
http://clorophilla.net/
http://twitter.com/JoL1hAHN