Welcome! Log In Create A New Profile

Advanced

busywaiting without blocking event loop OR timers

fin
August 26, 2011 07:42AM
hello devel,

i'm working on a module that uses ngx_event_connect to connect to a
3rdparty service and parses its request.
the answer depends on the request hostname, so now i'm implementing a
cache in shared memory to cache the responses on a hostname basis.

i'm protecting access to every cache entry using a ngx_atomic_t.

now i'd like to prevent multiple concurrent connections from requests
to the same hostname to the 3rd party service.

i see two ways to solve that:
* busy-wait on ngx_atomic_t as long as a request to the service is open
* create an event and wait for it

now, how can i busy-wait on a ngx_atomic_t without blocking the
handling of other requests in the same process?
(these requests can last up to 10 seconds in worst-case)
-> can i yield to the event loop while busy-waiting?

can i create events independent of I/O, like timer events?

thanks in advance
-fin

PS:
our howto on doing what we're doing in our module:
http://blog.efficientcloud.com/2011/08/24/nginx-upstream/

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

busywaiting without blocking event loop OR timers

fin 2113 August 26, 2011 07:42AM



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

Online Users

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