On Nov 23, 6:58 am, Sergey Shepelev <
temo...@gmail.com> wrote:
> On Mon, Nov 23, 2009 at 7:42 AM, Joubin Houshyar <
suno...@gmail.com> wrote:
> >> * More than 1 connection from single client (process) to single Redis
> >> does not make sense at all. You don't win a thing if you make more
> >> than one connection.
>
> > Sergey,
>
> > That's not true. If the client you are using is providing synchronous
> > request/reply semantics, then your N requests must line up. The most
> > expensive costs are the network IOs. If you have more than one
> > connection, you can be writing in one while reading from another.
>
> I'm sorry, i actually didn't use Java Redis client, i'm talking more
> about network peers in general.
That's fine. I was responding to your statement regarding the merits
of having more than a "single client (process) to single Redis
[server]", which was false (regardless of the client implementation
language).
> If the client is providing synchronous *semantics*, it is a useful
> feature, it is nice. Writing
Redis protocol has some interesting features (which greatly ease
adoption):
- it is a request/reply protocol.
- there is no distinction between physical and logical clients.
- (thus) There is no distinction between physical and logical
messages.
(Fire up a telnet session: what you see is what you get. (Type
really fast (/g/) and you will see pipelining in action.))
So what this means is that synchronous client semantics are a natural
expression of the redis protocol. To provide asynchronous semantics
on the client side, the client needs to provide the magic.
> But if client is truly making synchronous connect/read/write under the
> hood, it is done wrong, sorry.
I suggest you try implementing a barebones client (in the language of
your choice) using an event based IO lib that provides PING, SET, GET,
and EXISTS commands for a concurrent set of processes using a single
connection. That exercise would shed some light on the topic at hand.
Event based network IO addresses server side issues (e.g. C10K) and
brings little to the table on the client side beyond unnecessary
complexity.
> See, e.g. in Python libraries called gevent/Eventlet/diesel/etc allows
> you to continue use synchronous semantics while they actually use
> asynchronous sockets under the hood, thus combining best of two
> worlds: nice semantics and good performance.
http://www.netstate.com/states/intro/mo_intro.htm