[ANN] ngx_echo v0.35: ability to POST/PUT local files as subrequest bodies

agentzh agentzh at gmail.com
Thu Mar 10 11:28:54 MSK 2011

On Thu, Mar 10, 2011 at 4:16 PM, Elena Zwetkow <ezwetkow at gmx.de> wrote:
> Hello,
> could this be a way to put POST multipart uploads to redis/memcache?

Yes :)

> I am right, if i use a fileread with lua in nginx the script is blocking?


> Any ideas how i can store POST multipart uploads nonblocking?

Use echo_subrequest POST /foo -f /path/to/file for that (combined with
ngx_upload, maybe).

> I know there is a great file upload module for nginx, but what happens if i use lua to work on an uploaded file like move / rename / copy uploaded files, this blocks nginx?

Yes. Most disk operations will block nginx (or some other processes like php).

> How can i check if something block nginx?

Maybe configure only 1 nginx worker and try

    ab -c 100 -n 10000 http://...

and check the results? ;)

There will be a "body_file" option for ngx_lua's
"ngx.location.capture" and "ngx.location.capture_multi" Lua functions,
similar to echo_subrequest's -f option.

But nginx may also block even if itself does the disk operations.

A work-around is to start a few more nginx worker processes, just like
how apache and php-fpm has been doing for years ;)


More information about the nginx mailing list