[asterisk-dev] How to improve astdb? Any ideas?

Ron Arts ron.arts at netland.nl
Mon Sep 6 09:05:06 CDT 2010


Op 06-09-10 15:46, Mark Murawski schreef:
>   Don't fear the fsync
> http://www.linuxfoundation.org/news-media/blogs/browse/2009/03/don%E2%80%99t-fear-fsync
>
> Why would running fsync in a loop be any different in performance than running fsync in the thread waiting to hear back from astdb put? The loop approach would also be beneficial in *reducing* fsyncs, since you could batch say 10 writes at a time
> (assuming the underlying storage supports it).. with a 60 second timeout where if you didn't fill up the write bucket it would write them out anyway. Otherwise the thread would be idle and waiting for put requests.
>
>
> On 09/06/10 09:37, Ron Arts wrote:
>> Op 06-09-10 15:10, Mark Murawski schreef:
>>> Here is one fix for the fsync problem.
>>>
>>> Spawn an astdb put worker thread. (Same goes for using any database
>>> backend) Writers will dump their changes to a linked list and return
>>> immediately. The writer will write whenever it gets a chance. if there
>>> are big or small slowdowns in fsync it wont affect any running threads.
>>> And if you lose power, well... you would have lost the unwritten data
>>> anyway because you would have been waiting on it anyway.
>>>
>>
>> Please note: if any process or thread on a system is doing fsync()
>> in a loop, the entire system will slow to a crawl.
>>
>> Ron
>>


fsync writes all buffers to disk, it blocks until this is done. This means that C library
will push out all its buffers to the OS, and the OS will push out everything to disk.
This will result in hard disk head movements. If you call fsync in a tight loop,
and there are modified buffers each iteration, then the other processes in the system
will have a hard time getting the head to move in their direction.

Ron






-- 
Netland Internet Services BV
bedrijfsmatige internetoplossingen

http://www.netland.nl  Science Park 140           1098 XG Amsterdam
info: 020-5628282      servicedesk: 020-5628282   fax: 020-5628281
KvK Amsterdam 33253286

Op dit bericht is de volgende disclaimer van toepassing:
http://www.netland.nl/maildisclaimer



More information about the asterisk-dev mailing list