Blob Streaming with MySQL
April 16, 2008
I’m sitting in on the Blob Streaming with MySQL session. The project is at http://blobstreaming.org. Coincidentally, my brother had put together a proof of concept for streaming blobs from MySQL a few months ago before either of us heard about this project.
Why to put blobs in a database? The biggest pro seems to be for transactional reasons. File systems directly aren’t always transactional. Also replication and HA solutions then get applied right to that data as well as the rest of your data.
Are there reasons to not put blobs in a database? They can make the table slow, the database can become too big to snapshot or backup (practically, if not in theory), and replication can be too slow. The blobstreaming.org project seems to alleviate the replication slowness problem. How? The blobstreaming project stores the blob data in the database, but not in the rowdata itself (which just holds a reference). The goodness of the database functionality is there, but the replications aren’t slowed down by the blob data. I think I’m getting this right…
Basically the BlobStreamer is another engine type, but it’s not a table type you can create directly - it has to hook in to another table type. The only one demoed is PBXT (blobstreaming was put together by PrimeBase as well, so this makes sense). Perhaps this would work with innodb as well…? The BS engine type exposes an HTTP interface as well for basic reading and writing of blob data.
An interesting project which may come in handy for some large file/video projects.
Did you like this post? Buy me a hot chocolate!
Posted in




April 16th, 2008 at 6:31 pm
Interesting, I just blobbed (read “blogged”) about blob streaming.
I wrote a cheap-o function in the DB driver of cognifty to check the size of a blob and iteratively call “substr()” to get chunks of the data and send it back to PHP. This alows for much quicker responses than loading up 3-4, or 30-40, megs of data before shoving it to the user.
http://cognifty.com/blog.entry/id=3/Blob_Streaming_in_PHP
example of blob streaming here:
http://cognifty.com/main.page/cognifty_cms_content_demo.html
April 16th, 2008 at 6:31 pm
Opps, i forgot to mention, that’s MYSQL’s substr(), not PHP’s substr()