<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>small files &#8211; Matthew Petroff</title>
	<atom:link href="https://mpetroff.net/tag/small-files/feed/" rel="self" type="application/rss+xml" />
	<link>https://mpetroff.net</link>
	<description>mpetroff.net</description>
	<lastBuildDate>Tue, 24 Nov 2015 00:53:44 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	
	<item>
		<title>An Efficient Method of Serving Many Small Files</title>
		<link>https://mpetroff.net/2015/09/an-efficient-method-of-serving-many-small-files/</link>
					<comments>https://mpetroff.net/2015/09/an-efficient-method-of-serving-many-small-files/#comments</comments>
		
		<dc:creator><![CDATA[Matthew Petroff]]></dc:creator>
		<pubDate>Wed, 30 Sep 2015 23:27:08 +0000</pubDate>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[filesdb]]></category>
		<category><![CDATA[server]]></category>
		<category><![CDATA[small files]]></category>
		<category><![CDATA[web]]></category>
		<guid isPermaLink="false">http://mpetroff.net/?p=1967</guid>

					<description><![CDATA[Certain types of web content, such as map tiles and image pyramids1, require serving many small files, but this can often be inconvenient. Transferring a large number of small files over SCP or SFTP is very slow, and managing these &#8230; <a href="https://mpetroff.net/2015/09/an-efficient-method-of-serving-many-small-files/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
										<content:encoded><![CDATA[<p><span class="dropcap">C</span>ertain types of web content, such as map tiles and <a href="https://en.wikipedia.org/wiki/Pyramid_(image_processing)">image pyramids</a><sup id="rf1-1967"><a href="https://mpetroff.net/2015/09/an-efficient-method-of-serving-many-small-files/#fn1-1967" title="Used by &lt;a href=&quot;https://pannellum.org/&quot;&gt;Pannellum&lt;/a&gt;&rsquo;s multires format, for example." rel="footnote">1</a></sup>, require serving many small files, but this can often be inconvenient. Transferring a large number of small files over SCP or SFTP is very slow, and managing these files on disk can also be unpleasant. The transfer problem can be solved by adding the files to a tarball before transferring them, transferring the tarball, and untarring them once transfered. However, this is an extra step, and it doesn&#8217;t address the file management problem. Mapbox devised a solution for this problem for map tiles with their <a href="https://github.com/mapbox/mbtiles-spec">MBTiles format</a>. This container format stores map tiles in a SQLite database, and a server implementation is then used to serve tiles directly from the container. This cleanly solves the aforementioned transfer and storage problems, but it is not general purpose and only works for map tiles. This specialization allows for additional optimizations such as deduplicating identical map tiles, but it means it can&#8217;t be used for storing image pyramids or other uses.</p>
<p>The use of a SQLite database container format can also work as a general purpose solution, provided a general purpose database key is used. Thus, I propose a general purpose &#8220;FilesDB&#8221; format as a generic solution. This format consists of an SQLite database containing a <code>files</code> table, which in turn contains a <code>filename</code> column of type <code>text</code> and a <code>data</code> column of type <code>blob</code>. A directory of files is stored in the format by storing each files in the directory in the database with the file&#8217;s path relative to the the base directory<sup id="rf2-1967"><a href="https://mpetroff.net/2015/09/an-efficient-method-of-serving-many-small-files/#fn2-1967" title="Using Unix directory separators (&lt;code&gt;/&lt;/code&gt;)&lt;!-- --&gt;" rel="footnote">2</a></sup> as the <code>filename</code> and the file&#8217;s contents as the <code>data</code>. As a proof of concept, I wrote a Python script for generating a <code>.filesdb</code> container and a rudimentary server for serving the files from the format in Go. These, along with a basic specification document, are available from a <a href="https://github.com/mpetroff/filesdb-spec">repository on GitHub</a>.</p>
<hr class="footnotes"><ol class="footnotes" style="list-style-type:decimal"><li id="fn1-1967"><p >Used by <a href="https://pannellum.org/">Pannellum</a>&rsquo;s multires format, for example.&nbsp;<a href="https://mpetroff.net/2015/09/an-efficient-method-of-serving-many-small-files/#rf1-1967" class="backlink" title="Return to footnote 1.">&#8617;</a></p></li><li id="fn2-1967"><p >Using Unix directory separators (<code>/</code>)<!-- -->&nbsp;<a href="https://mpetroff.net/2015/09/an-efficient-method-of-serving-many-small-files/#rf2-1967" class="backlink" title="Return to footnote 2.">&#8617;</a></p></li></ol>]]></content:encoded>
					
					<wfw:commentRss>https://mpetroff.net/2015/09/an-efficient-method-of-serving-many-small-files/feed/</wfw:commentRss>
			<slash:comments>1</slash:comments>
		
		
			</item>
	</channel>
</rss>

<!--
Performance optimized by W3 Total Cache. Learn more: https://www.boldgrid.com/w3-total-cache/?utm_source=w3tc&utm_medium=footer_comment&utm_campaign=free_plugin

Page Caching using Disk: Enhanced 
Content Delivery Network via Amazon Web Services: CloudFront: cdn0.mpetroff.net
Minified using Disk

Served from: mpetroff.net @ 2026-03-31 01:32:11 by W3 Total Cache
-->