Redisent, alternative PHP interface

43 views
Skip to first unread message

Justin

unread,
Jun 2, 2009, 7:59:24 PM6/2/09
to Redis DB
I just finished the first version of my Redis interface for PHP,
Redisent. I built it to be small (73 sloc), flexible, and tolerant of
changes in Redis' API. To do that, rather than defining a method in
the class for each of Redis' commands I made it so Redisent would
recognize command and response types and format them accordingly.

I didn't do much benchmarking, but the time difference in 10,000 SET
and DEL operations between Redisent and Redis is negligable:
Redisent completed in 1.511457 seconds
Redis completed in 0.157829 seconds

Everything is on the GitHub project page here:
http://github.com/jdp/redisent/tree/master

Let me know what you think :)

Justin

Aman Gupta

unread,
Jun 2, 2009, 8:09:00 PM6/2/09
to redi...@googlegroups.com
On Tue, Jun 2, 2009 at 7:59 PM, Justin <jd...@njit.edu> wrote:
>
> I just finished the first version of my Redis interface for PHP,
> Redisent. I built it to be small (73 sloc), flexible, and tolerant of
> changes in Redis' API. To do that, rather than defining a method in
> the class for each of Redis' commands I made it so Redisent would
> recognize command and response types and format them accordingly.
>
> I didn't do much benchmarking, but the time difference in 10,000 SET
> and DEL operations between Redisent and Redis is negligable:
>    Redisent completed in 1.511457 seconds
>    Redis completed in 0.157829 seconds

Are these numbers correct. Redisent is almost 10x slower?

Aman

Ericson Smith

unread,
Jun 2, 2009, 8:09:37 PM6/2/09
to redi...@googlegroups.com
It looks pretty good!

I'd only say in the constructor have it select a database after connection, just so that it conforms to the Ruby version. Sometime we forget to connect to the proper database before a command :-)

- Ericson Smith
CTO
http://www.funadvice.com

On Tue, Jun 2, 2009 at 7:59 PM, Justin <jd...@njit.edu> wrote:

Justin

unread,
Jun 3, 2009, 4:48:37 AM6/3/09
to Redis DB
> > I didn't do much benchmarking, but the time difference in 10,000 SET
> > and DEL operations between Redisent and Redis is negligable:
> >    Redisent completed in 1.511457 seconds
> >    Redis completed in 0.157829 seconds
>
> Are these numbers correct. Redisent is almost 10x slower?

Whoops! I had the Redisent test doing 10,000 iterations and Redis
doing 1,000. Updated the benchmark, the (not very thorough) code is
available here: http://gist.github.com/122882

Justin Poliey

unread,
Jul 6, 2009, 3:25:18 AM7/6/09
to Redis DB
I did a lot more work on Redisent tonight, I felt like doing a couple
quick hacks :)

The better part of what I've done is added consistent hashing, which
in the test suite results in about 40% of the keys having to be
remapped. I know that's not optimal, but it is the first version :)
There's also some nice bits of convenience, like the ability to assign
aliases to specific servers so that you can still access them to use
commands that are non-hashable, like INFO, SAVE, RANDOMKEY, etc.

Its homepage is still at its Github page, which is available right
here:
http://github.com/jdp/redisent/tree/master

Again, let me know what you think :)

Justin
Reply all
Reply to author
Forward
0 new messages