About cleanup of subrequests

Chieu lfchieu at gmail.com
Wed Nov 17 11:33:37 MSK 2010

To agentzh,

I had read your lua, echo module.

I think the location.capture of lua module, and echo_location_async of
echo module may cause this problem, too

For example:

  location /main {

      # subrequests in parallel
      echo_location_async /sub1;
      echo_location_async /sub2;
      echo_location_async /subn;

      echo "took $echo_timer_elapsed sec for total.";

If there are many "echo_location_async /subX", echo subrequest will
occupy some memory. Lots of memory will not be free in time.
So,if  /main is requested a lot , the system memory will be run out.

Am I right? And what's your opinion?


2010/11/17 Chieu <lfchieu at gmail.com>:
> I have written a nginx module which may produce thousands of
> subrequests.Each subrequest may connect to the upstream and fetch
> data.
> Like map-reduce, my module map the main request to many subrequest and
> reduce the datas fetched from upstreams.
> So,the problem comes.  Since nginx free the memory when the main
> request ends, all my subrequest can't be cleaned up until the main
> request finished.
> The memory that subrequests occupied will become very large.
> Can somebody tell me how can free the memory which subrequests applied
> when this subrequest finished?
> Thanks
> --
> Regards
> LF Chieu

More information about the nginx mailing list