Quick dispatch from nginx -> php/whatever cgi -> mogileFS?

I think that is what is going on here… but it seems to be missing a
step. Has anyone else tried this? Basically using PHP (or whatever
language) very quickly to do the lookup of the domain/key (the two
things you need in MogileFS) and then sending the request on to the
mogileFS engine and freeing up the PHP layer?

http://d.hatena.ne.jp/perezvon/20080418/1208531594

From what I can tell, the request comes in:

  1. http://foo.com/images/foo.gif
  2. nginx has /images set to proxy_pass to php or something else
  3. php does a lookup based on that URL and returns a valid mogileFS
    storage node (this is where I am not sure it is bulletproof)
  4. it says “X-Accel-Redirect: /reproxy” and throws in the standard
    perlbal header “x-reproxy-url”
  5. nginx takes that header and dynamically proxy_pass’es to that URL

Does that make sense? This was my next step once I get my normal web
serving solid, to look into integrating MogileFS-based storage nodes
as close to nginx as possible, and take advantage of X-Accel-Redirect
(or try to get a module created that worked like it with MogileFS
directly?)

Extra bonus: nginx can be used instead of mogstored for the webdav as
well… :slight_smile:

In theory every webserver machine can have PHP/whatever + memcached +
mogstored + nginx. Nginx could do all 3 functions: web serving +
fastcgi proxy + mogstored all in one!

I believe that solution would allow for almost near infinite
shared-nothing horizontal scalability (until your MogileFS database
becomes too big and you have to scale that)

Thoughts?