Skip to content
This repository has been archived by the owner on Apr 3, 2019. It is now read-only.

Optimize the multi-bulk reply handling #36

Open
mikegreen7892003 opened this issue Jun 2, 2013 · 9 comments
Open

Optimize the multi-bulk reply handling #36

mikegreen7892003 opened this issue Jun 2, 2013 · 9 comments

Comments

@mikegreen7892003
Copy link

SyncMset is much quicker than AsyncMset. Is that right?

I ran the demos/benchmark/app.py and found that SyncMset is much quicker than AsyncMset. Is it work right?
My logging:
INFO:tornado.access:200 GET /redis-py/mset (192.168.1.100) 83.39ms
WARNING:tornado.access:404 GET /favicon.ico (192.168.1.100) 0.41ms
INFO:tornado.access:200 GET /mset (192.168.1.100) 1736.85ms
WARNING:tornado.access:404 GET /favicon.ico (192.168.1.100) 0.40ms

I installed tornado, redis, redis-py, torando-redis today.
tornado version is 3.0.1.
redis-py version is 2.7.5.
tornado-redis version 2.4.2.
Redis server v=2.6.13 sha=00000000:0 malloc=jemalloc-3.2.0 bits=32

By the way, my linux version is "centOS 6.2(Final)" and "kernel linux 2.6.32-220.e16.i686".

@leporo
Copy link
Owner

leporo commented Jun 3, 2013

Yes, you're right. The processing of the multi-bulk replies if far more efficient in redis-py client.

I'll add a note on Redis client usage to the README file to indicate it.

@mikegreen7892003
Copy link
Author

Thank you very much. I guess the reason is because the use of hiredis. 👍

@leporo
Copy link
Owner

leporo commented Jun 3, 2013

No. Tornado-redis is MUCH slower even if hiredis is not being used by redis-py. The current implementation of multi-bulk reply processing in tornado-redis creates a callback to virtually every received byte of data and this is the main reason of such a poor performance.

I plan to refactor this code and add the hiredis support to tornado-redis.

However, at this moment it's better to use redis-py for non-blocking commands.

@leporo
Copy link
Owner

leporo commented Jun 4, 2013

Don't you mind if I rename the issue to 'Optimize the multi-bulk reply handling'?

@goldalworming
Copy link

how to use redis-py for non-blocking pub-sub command??

@leporo
Copy link
Owner

leporo commented Jun 4, 2013

I suggest using tornado-redis for these.
Please check this websockets demo: https://github.com/leporo/tornado-redis/tree/master/demos/websockets

But you may use redis-py in your Tornado application for GET's, MGET's and other non-blocking commands and get the faster and easier-to-maintain code.

@leporo
Copy link
Owner

leporo commented Jun 4, 2013

I've added a note to the README file on this matter: https://github.com/leporo/tornado-redis#tornado-redis-vs-redis-py

@mikegreen7892003
Copy link
Author

Thank you for your kindness. I don't mind you rename the issue. I'm also excited about how the performance changes after the issue be finished.

@goldalworming
Copy link

ok thank you..because I don't get better implemetation redis pub/sub beside this library
combination is a good choice..

thanks

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants