3 ms·
Doesn't the webserver have to seek from the beginning of the ~600mb file to the range you want, unless the file is in memory?
by winrid 6y ago
Doesn't the webserver have to seek from the beginning of the ~600mb file to the range you want, unless the file is in memory?
- philshem 6y agoNo, see here, for example https://news.ycombinator.com/item?id=27018194 https://news.ycombinator.com/item?id=27018194
- winrid 6y agoThat doesn't answer the question. Yes the web server supports range requests. Yes it only returns 50kb. But what mechanism is letting it scan to just those ranges in the binary file. Doesn't the file system make you seek to the starting block and then read from there? The point is, while it looks very efficient, there might be a crap ton of IO going on for your little 50kb response. EDIT: probably the webserver is doing an fseek(), and performance will vary based on file system impl. This is something I will need to benchmark.
- ric2b 6y agoFor most filesystems it should be no issue to seek directly to a specific offset on a file, it's just like accessing an array, if you know where it starts and the offset you just need to add them and tell the disk to read that address.