<p>Hi,</p><p>thanks for your reply!</p><p><br>my current solution ismodified limit_con module.i add an counter in share mem. when a request have a prev request it will blocked and recheck the counter in 500ms by using nginx timer. </p>
<p><br>
your solution is better than mine, but i still have a question .<b>a finished request is how to notify a blocked request which is in the same worker?</b></p>
<div class="gmail_quote">ÔÚ 2012/10/29 11:08 AM£¬"chen cw" <<a href="mailto:crk_world@yahoo.com.cn" target="_blank">crk_world@yahoo.com.cn</a>>дµÀ£º<br type="attribution"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
On Fri, Oct 26, 2012 at 2:38 AM, Jossan Davis <span dir="ltr"><<a href="mailto:jossandavis@gmail.com" target="_blank">jossandavis@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div>Hi</div><div><br></div><div>nginx module limit_req only can limit request frequency by url param key. it delay a request by "ngx_add_timer(r->connection->write, delay)".</div><div><br></div><div>my requirement is a little bit different. i need the next request be process immediately after the prev one have done.</div>
<div>i have tried to use "ngx_http_cleanup_add". but it seem that the ngx_http_request_t is not in shared mem, i can't use "ngx_add_timer(r->connection->write, 0)" to notify the next request.</div>
<div><br></div></blockquote><div><br></div><div>you can store the counter in share mem as module limit_req, and also store blocked requests list in global queue for each worker, such as module upstream_keeplive. so when you use "ngx_http_cleanup_add", you can get the ngx_http_request_t in such list. I think this method meets your requirement.</div>
<br>-- <br>
<p><span lang="EN-US">--</span></p>
<p><span lang="EN-US">Charles Chen</span></p>
<p><span lang="EN-US">Software Engineer</span></p>
<p><span lang="EN-US">Server Platforms Team at Taobao.com</span><br></p><br>
<br>_______________________________________________<br>
nginx-devel mailing list<br>
<a href="mailto:nginx-devel@nginx.org" target="_blank">nginx-devel@nginx.org</a><br>
<a href="http://mailman.nginx.org/mailman/listinfo/nginx-devel" target="_blank">http://mailman.nginx.org/mailman/listinfo/nginx-devel</a><br></blockquote></div>