Retrieving sound files from DB as opposed to filesystem

Home » Asterisk Users » Retrieving sound files from DB as opposed to filesystem
Asterisk Users 4 Comments

Just from my experience with different DBs, stay away from BLOB data
types as much as possible.

On Mon, May 2, 2011 at 3:15 AM, A E [Gmail] wrote:
> Hello All,
> Probably a silly question, but we’re wondering if people have had any
> experience and have data to demonstrate if the performance of the Asterisk
> system might suffer in terms of latency etc. if we’re to have it retrieve
> sound files from a database using odbc as opposed to storing them locally on
> the filesystem. Note, these are not prompts…these are sound files that are
> being created through a web-app and being stored in the DB as BLOB or
> similar datatype that’s good/efficient to store audio/video files in a DB.
> We need these be made available through the asterisk system to play over the
> phone. Although the DB uses a SAN, the Asterisk System has no connectivity
> to the SAN but is connected on the same physical ethernet switch with a
> multi-Gbps backplane.
> The way the system is being designed, it’s possible for us to end up with
> 000s of these sound files stored in the DB, not to mention several asterisk
> systems in a pool/cluster/farm requesting these files, so using the local
> filesystem might not be scalable or efficient.
> Any advice/comments/suggestions welcome 🙂
> —
> _____________________________________________________________________
> — Bandwidth and Colocation Provided by
> New to Asterisk? Join us for a live introductory webinar every Thurs:
> asterisk-users mailing list
> To UNSUBSCRIBE or update options visit:

4 thoughts on - Retrieving sound files from DB as opposed to filesystem

  • any particular reason why? I’ve had a good experience with it, in fact
    that’s recommended by DB developers when it’s a case of small files. They
    say only larger files greater than 500K-1MB should be stored on the
    filesystem using filestream or similar etc.

    Although at this point, this might be a moot point, as so far no one’s been
    able to suggest a way to be able to stream the content of the BLOB field to
    Asterisk over the AGI connection into the current channel, such that
    Asterisk can just play it on the fly. We’ll have to just go with getting the
    file to the requesting * server and then play it

  • Short answer: Asterisk has support for playing local files. As for
    performance: The file system already caches reading the file once it has
    been read once, so you’re likely to read it from memory. Especialy small
    files and frequently-used files. If you want to play sounds from a DB,
    you’ll need to provide some infrastructure.

    The sound file to be played is a file that should be read and consumed
    (played by Asterisk into a channel) in a steady manner. You can’t afford
    any delays. That’s not a typical constraint with e.g. web content
    serving where you can easily wait a while to cache content.

  • Note: by using a temporary file, as opposed to a permanent local file,
    you get much less file-system caching. If you expect the same files to
    be played many times, this is a waste of I/O. Though with some luck
    you’ll always still have the temporary files in the cache.

  • Like I said it’s based on experience, I can try hacking my brain and
    come up with particular reasons that can be written down, however I
    don’t really have the time for that right now.
    In any event, my experience has only been with larger files (1MB up to
    25MB). I never tried smaller ones, and since I just don’t use it
    anymore I doubt I will find out any time soon.