httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Brian Havard" <>
Subject Re: Buffered file I/O & thread safety
Date Mon, 12 Jun 2000 12:06:33 GMT
On Sun, 11 Jun 2000 12:26:38 -0700, Greg Stein wrote:

>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.

Ok, but then the flag would be, say, APR_ST (single thread).

 |  Brian Havard                 |  "He is not the messiah!                   |
 |  |  He's a very naughty boy!" - Life of Brian |

View raw message