Hello, the Tornado community :-).
I just looked at tornado-redis code, and terrified:
1. It use blocking function socket.connect to establish TCP connection
to the Redis server.
2. It's recommendded (as followed from demos) to use a single db
connection for all requests. It is terrible if you using redis
transactions in your code. And from other side, it is bad to make a new
connection for every request, even if we didn't had to have the problem
with blocking "connect" function.
3. It goes wrong way by defining statically all redis commands in Client
class. This is ugly and not natural for such a dynamic language, as Python.
There are a good points, how to fix that problems in other redis library
for tornado:
1. Use the tornado IOStream correctly.
2. Implement a connection pooling mechanism, which (in trivial case)
would delegate a separate redis connection to every request or (in the
ideal case) would monitor the usage of transactions and using redis
request pipelining persistently for single requests, switching between
free established connections in round-robin.
3. Use the metaprogramming techniques to populate the Client class with
all redis commands, having proper docstrings, processing arguments and
return values correctly.
So, here I go. Join to me, if you like to use redis in tornado. It is
probably the best storage to use with it, as it is simple and fast,
exactly like the tornado :-).
The interesting thing - I started to implement all of these from
scratch, and named the repository "toredis". Then, when I thought that
it is time to push the initial code to the Github, I accidently found
the existing toredis project by @joshmarshall on github, which already
partically applies to specifed points :-). Thanks, Josh. Do you have any
plans to evolve the toredis?
The original toredis repo:
https://github.com/joshmarshall/toredis
My toredis repo:
https://github.com/ei-grad/toredis
Comments, suggestions and other participation in toredis development are
welcome :-).
PS, join to the redis-db@ discussion
https://groups.google.com/forum/?fromgroups=#!topic/redis-db/WwIWZkfKf7A:
-------- Исходное сообщение --------
Тема: OBJECT and SHOWLOG commands in commands.json and docs
Дата: Tue, 25 Sep 2012 20:57:46 +0400
От: Andrew Grigorev <
and...@ei-grad.ru>
Кому:
redi...@googlegroups.com
Hello.
I am working on toredis, a redis client for tornado, which using
metaprogramming to construct the Client class from commands.json file. I
have a several questions about redis docs and that file:
1. Is it a good idea to use it for redis clients in dynamic languages?
What is the status of that file?
2. I want to add the "return" field to commands.json commands, is this
reasonable?
3. Don't you think, that it is strange to have a single command for
OBJECT REFCOUNT|ENCODING|IDLETIME subcommands in docs, while there are
different DEBUG OBJECT|SEGFAULT commands? The second approach looks
better for me. Also, there is a SHOWLOG command, joining three
subcommands in one, too. Are there any chances for pull-request,
splitting OBJECT command and SHOWLOG command to different commands, to
be merged in redis-docs? If not, then what if them would be splitted at
least in commands.json? Basically, this question is a blocker for the
second question, because subcommands of that commands return different
values.
Thank you for your attention.
--
Andrew