Welcome! Log In Create A New Profile

Advanced

Re: Event based implementation in http module

agentzh
May 08, 2012 08:16AM
On Tue, May 8, 2012 at 1:46 PM, vivek goel <goelvivek2011@gmail.com> wrote:
> Sorry just clearing my doubt.
> Again I have one doubt.
> Work I am doing in  clcf->handle is a blocking io call.
> Now if I am running nginx with 2 worker process and function I am calling in
> clcf->handle takes 200 ms to generate response.
> So it means that I will not able to server other clients from same worker
> process withing 200 ms time  ?
>

Sure. The worker process is single-threaded. And by using blocking
calls in the content handler essentially turns nginx into an apache
server with the prefork mpm. Some inexperienced nginx developers have
been making such serious mistakes in their nginx modules.

> If yes ,
>   How can I make it non-blocking so that I can server multiple clients ?
>

Just use nonblocking calls and leverage the nginx event model. You can
check out all those nginx upstream modules out there, ngx_memcached,
ngx_redis2, ngx_memc, ngx_drizzle, ngx_postgres, ngx_proxy, ngx_lua,
ngx_beanstalkd, and etc etc etc.

Regards,
-agentzh

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

Event based implementation in http module

goelviek2011@gmail.com 1515 May 07, 2012 10:50AM

Re: Event based implementation in http module

Maxim Dounin 532 May 07, 2012 01:14PM

Re: Event based implementation in http module

goelviek2011@gmail.com 692 May 07, 2012 01:28PM

Re: Event based implementation in http module

agentzh 557 May 08, 2012 01:14AM

Re: Event based implementation in http module

goelviek2011@gmail.com 703 May 08, 2012 01:48AM

Re: Event based implementation in http module

agentzh 738 May 08, 2012 08:16AM

Re: Event based implementation in http module

goelviek2011@gmail.com 759 May 12, 2012 03:58AM



Sorry, you do not have permission to post/reply in this forum.

Online Users

Guests: 196
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