Timeouts

Theo Schlossnagle jesus at omniti.com
Sun Mar 1 18:16:25 CET 2009


On Mar 1, 2009, at 11:49 AM, Nils Goroll wrote:

> Theo,
>
>> http://bugs.opensolaris.org/view_bug.do?bug_id=4641715
>> Either that or application level support for timeouts.  Given  
>> Varnish's design, this wouldn't be that hard, but still a bit of  
>> work.
>
> thank you for your answer. I was hoping that someone might had  
> started work on this, but I understand that this won't be too easy  
> to implement.

I see two approaches:

(1) the traditional: change all the the read/write/readv/writev/send/ 
recv/sendfile calls with non-blocking counterparts and wrap them in a  
poll loop with the timeout management.

(2) the contemporary: create a timeout management thread that  
orchestrates interrupting the system calls in the threads.  It's kinda  
magical.  It's basically and implementation of alarm() in each thread  
where the alarms are actually managed in a watching thread and it  
raises a signal in the requested thread by using pthread_kill  
explicitly.  I've implemented this before and it works.  But, it is a  
bit painful and given that this implementation would exist to work  
around _only_ the kernel lacking in Solaris, it seems crazy.  I think  
I'll go with the general Varnish developer attitude here: "we expect  
the OS to support the advanced features we need."  Upside is that it  
would work well with sendfile.

I still wish all network I/O was done in an event system... and we  
just had a lot of concurrently operating event loops all consuming  
events full-tilt.  I've had better success with that. Que sera sera.   
Varnish is still the fastest thing around.

--
Theo Schlossnagle
Principal/CEO
OmniTI Computer Consulting, Inc.
Web Applications & Internet Architectures
w: http://omniti.com   p: +1.443.325.1357 x201   f: +1.410.872.4911







More information about the varnish-dev mailing list