Static Files
Multimedia Files
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.
Here is my particular invocation:
# ionice -c 1 -n 0 /usr/local/bin/filed --user nobody --root /var/www --port 80 --log /var/log/filed --daemon
Content Distribution
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
).
Files can be placed there atomically from outside the root to prevent them from being served out prematurely.
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.