Proxy timeouts as milliseconds?

hi all

does anybody know if it is possible to set millisecond values for:

    proxy_connect_timeout
    proxy_send_timeout
    proxy_read_timeout

my usecase is to have fallbacks for requests that take longer than about
200 milliseconds, especially for use with SSI

thx, bernd

Posted at Nginx Forum:

dobe wrote:

does anybody know if it is possible to set millisecond values for:

    proxy_connect_timeout    
    proxy_send_timeout         
    proxy_read_timeout     

proxy_connect_timeout 200ms;

should work:

http://translate.googleusercontent.com/translate_c?hl=en&ie=UTF-8&sl=ru&tl=en&u=http://sysoev.ru/nginx/docs/syntax.html&prev=_t&rurl=translate.google.com&twu=1&usg=ALkJrhiPIr-K56soM05_MMx-BlABaoJkxA


Anton Y.

wow, thanks for the information, it works!

i must have missed something in the documentation

thx, bernd

Posted at Nginx Forum:

Hello!

On Wed, Dec 09, 2009 at 05:54:50AM -0500, dobe wrote:

hi all

does anybody know if it is possible to set millisecond values for:

    proxy_connect_timeout    
    proxy_send_timeout         
    proxy_read_timeout     

my usecase is to have fallbacks for requests that take longer than about 200 milliseconds, especially for use with SSI

Try something like this:

proxy_connect_timeout  200ms;
proxy_send_timeout     200ms;
proxy_read_timeout     200ms;

Note well: such small values may produce a somewhat unexpected results,
since
nginx uses lazy timer updating. Quoting src/event/ngx_event_timer.h:

: #define NGX_TIMER_LAZY_DELAY 300

: static ngx_inline void
: ngx_event_add_timer(ngx_event_t *ev, ngx_msec_t timer)
: {

: /*
: * Use a previous timer value if difference between it and a
new
: * value is less than NGX_TIMER_LAZY_DELAY milliseconds: this
allows
: * to minimize the rbtree operations for fast connections.
: */

As a result, in the above configuration it is likely
that response time will be limited by 200ms in total. And big
responses will eventually timeout even if no real pauses happen
in connection.

Depending on your needs you may consider lowering
NGX_TIMER_LAZY_DELAY.

Maxim D.