Welcome! Log In Create A New Profile

Advanced

[ANNOUNCE] ngx_echo v0.29: major core refactoring and more robust sequential subrequests

agentzh
May 05, 2010 05:20AM
Hi, list!

I'm happy to announce the v0.29 release of the ngx_echo module:

http://github.com/agentzh/echo-nginx-module/tarball/v0.29

As mentioned in some other threads on the nginx mailing list, I've
completed the big refactoring of the ngx_echo module's core in this
version to reflect my latest understanding (hopefully being quite
complete and correct already) of the nginx internals.

Now the implementation of echo_subrequest, echo_location, echo_sleep,
and echo_read_request_body directives has been massively rewritten.
I'm trying to set up a design pattern for nginx content handlers that
require to do various kinds of non-blocking I/O during its lifetime
(similar to upstream modules but for different tasks like subrequests
and others).

For sequential subrequests issued by the echo module's content
handler, we now use a totally different approach.

Instead of issuing subrequests directly in our post_subrequest
callback (as fed into the ngx_http_subrequest call), we now postpone
firing the subrequests in a custom write event handler which will be
called automatically once the current subrequest in question gets
completely finalized (that post_subrequest callback is called by
ngx_http_finalize_request of the subrequest in question).

This works because the parent request will always be waken up once its
subrequest completes. (This is done by ngx_http_finalize_request via
posting the parent request into the "posted requests" queue and the
posted requests will be always called at the end of the top-level
read/write event handler, i.e., ngx_http_request_handler).

This solves a lot of issues like mangled r->main->count and the
following alert message when nginx is configured with the --with-debug
option, for instance,

2010/05/05 16:46:14 [alert] 23853#0: *1 http finalize non-active
request: "/main?" ...

We'll apply this trick to the upcoming ngx_lua and ngx_srcache modules soon :)

I've Cc'd the nginx-devel mailing list because other nginx developers
might find this useful.

Stay tuned!
-agentzh

P.S. See the ngx_echo module's wiki page for more information:
http://wiki.nginx.org/NginxHttpEchoModule

_______________________________________________
nginx mailing list
nginx@nginx.org
http://nginx.org/mailman/listinfo/nginx
Subject Author Posted

[ANNOUNCE] ngx_echo v0.29: major core refactoring and more robust sequential subrequests

agentzh May 05, 2010 05:20AM

Re: [ANNOUNCE] ngx_echo v0.29: major core refactoring and more robust sequential subrequests

Sergey A. Osokin May 05, 2010 05:38AM

Re: [ANNOUNCE] ngx_echo v0.29: major core refactoring and more robust sequential subrequests

agentzh May 05, 2010 05:54AM

Re: [ANNOUNCE] ngx_echo v0.29: major core refactoring and more robust sequential subrequests

agentzh May 06, 2010 07:52AM

Re: [ANNOUNCE] ngx_echo v0.29: major core refactoring and more robust sequential subrequests

Matthieu Tourne May 06, 2010 02:06PM

Re: [ANNOUNCE] ngx_echo v0.29: major core refactoring and more robust sequential subrequests

agentzh May 06, 2010 09:58PM

Re: [ANNOUNCE] ngx_echo v0.29: major core refactoring and more robust sequential subrequests

Matthieu Tourne May 07, 2010 12:46PM

Re: [ANNOUNCE] ngx_echo v0.29: major core refactoring and more robust sequential subrequests

agentzh May 09, 2010 11:46PM

Re: [ANNOUNCE] ngx_echo v0.29: major core refactoring and more robust sequential subrequests

Matthieu Tourne May 10, 2010 03:16PM

Re: [ANNOUNCE] ngx_echo v0.29: major core refactoring and more robust sequential subrequests

peterjanovsky May 10, 2010 04:12PM

Re: [ANNOUNCE] ngx_echo v0.29: major core refactoring and more robust sequential subrequests

agentzh May 10, 2010 11:14PM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 179
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready