Summary:ASTERISK-07310: [patch] Speed increase by doing a directory walk instead of repeated stat(2) calls
Reporter:Tilghman Lesher (tilghman)Labels:
Date Opened:2006-07-09 00:38:48Date Closed:2006-09-27 16:42:34
Versions:Frequency of
Environment:Attachments:( 0) 20060709__speedup_vmbox_scanning.diff.txt
( 1) 20060715__bug7507.diff.txt
Description:I've measured and found that walking a directory of voicemail, mapping existence into a table, then iterating over that table is much faster than iterating through a list of expected filenames and doing a stat(2) on each one.

The benefit comes with less contention over a directory lock, which will allow more concurrent messages to be left in a mailbox.


A speed increase is evident, even when the directory is empty!
Comments:By: Jason Parker (jparker) 2006-07-14 10:32:12

If the dir can't be locked, it'll return ERROR_LOCK_PATH...but that return value is never checked, so you could essentially create (or..try) an interestingly named file, right?

By: Tilghman Lesher (tilghman) 2006-07-14 13:10:31

Correct.  Since this is a critical path, we should also lock the directory prior to calling last_message_index(), though, which should resolve that issue.

By: Serge Vecher (serge-v) 2006-09-01 14:19:00

any movement on this?

By: Tilghman Lesher (tilghman) 2006-09-03 09:24:53

There was movement the day after.  The new patch has been there since July 15th.

By: Joshua C. Colp (jcolp) 2006-09-27 16:42:11

Put into trunk as of revision 43827 and 43829 ... don't ask.