1 +Static Files 2 +============ 3 +Multimedia Files 4 +---------------- 5 +I use `filed` on my home network on my fileserver to serve out my media library over HTTP to various clients around my house. It's extremely fast and threaded, which works well for my underpowered file server. All logs are generated asynchronously which also helps because I/O to my disks may be under contention when files are being served out. 6 + 7 +Here is my particular invocation: 8 + 9 +> `# ionice -c 1 -n 0 /usr/local/bin/filed --user nobody --root /var/www --port 80 --log /var/log/filed --daemon` 10 + 11 +Content Distribution 12 +-------------------- 13 +`filed` works well for content distribution of static data. The ideal filesystem layout for this particular use case is likely the common SHA1-style directory tree idiom (e.g., `<root>/a/9/3/6/f/f/a936ff9cf08e1e4ad1cbf0c775e690ae9375cd58`). 14 + 15 +Files can be placed there atomically from outside the root to prevent them from being served out prematurely. 16 + 17 +Since the filesystem layout may be complex, it may be desirable to increase the number of cache entries. This will reduce the number of lookups that will need to be done to the filesystem. Keep in mind that each active cache entry will hold a file descriptor so the number of file descriptors should be increased to prevent filed from exhausting all of its file descriptors with files and preventing clients from being accepted.