I agree, this is rather domain specific, and therefore not too useful. I
propose instead to add a general purpose reproxy module to nginx, which
would keep the domain specific url rewriting in your http/fcgi backend,
but let nginx still do the webserving. Perlbal has this feature, and but
I don't think either lighttpd or nginx do. To be fair, lighttpd 1.5 sort
of has it, though it needs to know about all the mogstore daemons ahead
of time. The way perlbal (or squid) does it you just pass back a full
url in a header, and it just does the request, making it much more
flexible. Since lighttpd/nginx don't do this, our Ruby code is doing
both the url translation and the request to the mogstored, which is much
less efficient than Ruby just did the url translation and let
lighttpd/nginx do the mogstore proxying.
Timo
Mark Smith wrote:
The biggest thing I am wondering is how to map a URL request into a
unique MogileFS key that can be created from PHP (or whatever
application) - the idea is to have nginx talk to the tracker, then
fetch from mogstored and skip needing any application-level (PHP,
etc.) interaction.
Well, typically this happens in the application because it is very
domain specific. For example, LiveJournal has URLs such as this:
http://userpic.livejournal.com/123/456
Which gets translated into a MogileFS lookup on:
up:123
You could of course use the URI as the unique identifier and request
"/foo/bar.jpg" and that would work. The downside to this will be long
key prefixes if you have long paths, which might be an impact on your
database speed of lookups? (I seem to recall something about MySQL
and key prefixes of certain lengths... but I might be mistaken.)
There is a plugin for using paths that would help here and let you do
this actually, it is somewhat designed for this use case, and you
might be able to drop it in and go.
Perhaps some people on this list have some ideas of how to resolve URL
-> key, and how to determine the future URL of a file ahead of time so
you can generate the key...
Well, if you use the paths plugin, then you just use the URI as the
key and you're done.
nginx already has http upstream/proxy support, so it would be very
easy once you talk to a tracker and get the file locations, you could
probably easily use some nginx proxy code to grab the file right from
the specific mogstored...
Cool. :)