2 ms·
I thought the issues with blobs in databases is that when you pull a file out of a DB to serve it on a website, you get something like this: 1. Database pulls
by kalleboo 15y ago
I thought the issues with blobs in databases is that when you pull a file out of a DB to serve it on a website, you get something like this:
1. Database pulls file off disk, or out of cache, reads into memory buffer
2. Memory buffer is copied to a new buffer in SQL client library (over a socket or whatever)
3. Memory buffer is copied to a new buffer in your scripting language
4. Which is then written to the web server's memory buffer, where it gets served to the client.
Which ends up being a whole lot of copying (and a whole lot of work even when the data is cached in the DB) compared to:
1. Web server mmap's file
2. Web server streams file out to client
Is this situation no longer true? Are there newer tools that handle "serve a file from a BLOB" more efficiently? Do they also handle things like seeking (resumes) in a non-wasteful manner? Or is memory performance so good and the blobs we're talking about so small (bytes, not kilobytes) that it doesn't matter?
- mistercow 15y agoI'm by no means a DB expert, but that was basically my understanding of the disadvantages as well. As other people have pointed out, you can use caching to fix a lot of those performance issues. Of course, the author of the article also believes that every database is hooked to a web server that will be constantly pushing its data to hundreds of thousands/millions of users, that every 10 milliseconds lost means another 1% of your users abandon ship, and that if you claim to have some other circumstances, you are pleading "unique snowflake" status and should just get shut up and follow his advice anyway.