redis2-nginx-module icon indicating copy to clipboard operation
redis2-nginx-module copied to clipboard

Getting rid of the $number response without lua

Open svarogg opened this issue 12 years ago • 3 comments

Hello there. I'm willing to use the redis2 module to retrieve static files from my redis DB and to return them as is. For some reason, although according to documentation I get a $number as the first line of the response. The way it's described in the README: ... then GET /pipelined will yield two successive raw Redis responses +OK $5 world

It's not really clear why is the $5 ever needed. I understand I can use LUA to get rid of it, but that seems like an unnecessary overhead.

Thanks.

svarogg avatar Jan 08 '13 16:01 svarogg

Hello!

On Tue, Jan 8, 2013 at 8:19 AM, svarogg [email protected] wrote:

I'm willing to use the redis2 module to retrieve static files from my redis DB and to return them as is. For some reason, although according to documentation I get a $number as the first line of the response. The way it's described in the README: ... then GET /pipelined will yield two successive raw Redis responses +OK $5 world

It's not really clear why is the $5 ever needed.

As documented, ngx_redis2 returns the raw Redis responses. The "$5" stuff here is part of Redis' wire protocol format:

http://redis.io/topics/protocol

I understand I can use LUA to get rid of it, but that seems like an unnecessary overhead.

Have you ever actually measured the performance difference between these two? (You're recommended to use LuaJIT to speed it up.) If not, just try it and I think you'll probably be amazed :)

Best regards, -agentzh

agentzh avatar Jan 08 '13 19:01 agentzh

Can you help me to get rid of the number format using Lua or any other possible ways, Thanks

gauravt avatar Mar 08 '13 07:03 gauravt

Hello!

On Thu, Mar 7, 2013 at 11:55 PM, gauravt [email protected] wrote:

Can you help me to get rid of the number format using Lua or any other possible ways, Thanks

Just use the lua-resty-redis library:

https://github.com/agentzh/lua-resty-redis

Best regards, -agentzh

agentzh avatar Mar 08 '13 20:03 agentzh