I'll note that the lua-resty-memcache module has a set_keepalive option
https://github.com/openresty/lua-resty-memcached#set_keepalive
I haven't tested whether or not it works as expected. For the traditional
memcache module there is discussion about setting a nginx based keepalive
on the memcache pool:
https://github.com/openresty/memc-nginx-module#keep-alive-connections-to-memcached-servers
I don't know the answer to your second question. I'm curious why you
raise it, though? Are you looking to extend some of the logic or make
use of its behavior?
My vague impression from scanning examples of nginx code is that the
underlying async api works as a bucket brigade, and each interested
consumer needs to be able to deal with reading in chunks of data at a
time, vs the entire request. But I'm not sure that really has any impact
one way or the other vis-a-vis the PUT request.
Since the memcache daemon can only handle an atomic set operation, even
if srcache streams (and I don't know if that's the case or not), the memcache
processing layer probably still has to buffer up the entire response before it
can perform the actual set operation via its memcache connection.
On Monday, May 11, 2015 at 11:30:35 PM UTC-7, rvsw wrote:
Hello agentzh
I have started using sr cache and it has been very useful. Here are some queries that will help me understand and use it better.
1. when SR cache does a GET on the memcache, it seems that after sending the response (which is cache miss), memcache closes the connection. Will it be useful if we make this connection persistent.
2. in the current code, sr cache does a PUT when the upstream origin server sends a response. Is this PUT done after receiving the *entire* data from the server. If the server sends a large volume of data, then does sr cache have the capability of streaming the response to the cache. It is unclear from the manual page - I went through the following text
Nginx seems to allow only one upstream on a given request. So how does sr cache allow streaming support (assuming it does).