httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Greg Stein <>
Subject Re: Buffered file I/O & thread safety
Date Sun, 11 Jun 2000 19:26:38 GMT
On Sun, Jun 11, 2000 at 11:07:28PM +1000, Brian Havard wrote:
> Some benchmarking clearly shows (at least on OS/2, I expect other platforms
> to be similar) that the mutex lock used to make the buffered file I/O
> thread safe is quite expensive (a lock & unlock for every byte read in some
> cases). It is also usually not necessary. The only situation it's needed is
> when the same ap_file_t object is used in multiple threads (EG a log file
> used by all threads). 
> In the case of mod_include or config file reading only 1 thread will ever
> touch the ap_file_t so a serious speed boost can be achieved by turning off
> the locking. To this end I propose adding a flag value for ap_open() to
> indicate if the handle needs to be thread safe, say APR_MT.
> Any objections?

Sounds like a good plan. Default should be "safe", meaning locking. Add the
APR_MT to get the speed.



Greg Stein,

View raw message