views:

26

answers:

1

I am designing an app that requires that all requests to our servers be routed through a single 'dispatcher'-type server. This server will, based on an API key sent in the request, forward the request on to an appropriate backend server, than relay the response back to the client.

eg., an incoming request could be http://example.com:6578/<api_key>/create?name=example&date=title

My first instinct is to use PHP with Lighttpd for the dispatcher, and store the api-key / server mappings with membase. However, this router could end up routing a huge number of requests, so performance is key.

At the same time, Lighty with APC is quite fast, and horizontally scalable.

Any suggestions for languages / architectures that should be used for something like this?

Edit: Key-value pairs would be fetched from membase or a similar key-value store. So, for and api_key of 1234, membase will return the IP 123.456.789.101. We would then forward perform the request to http://123.456.789.101/<client>/create?name=example, and return the response back to the client.

A: 

This seems to me like something that you should do with nginx. Nginx is used all the time for forwarding/proxying connections. If you wanted to scale horizontally, throw a bunch of the nginx boxes behind a load balancer.

mattbasta
I asked in the #nginx IRC room, and it seems like this can only really be done by compiling in Lua, and then using Lua to fetch value from Memcache, and grab the remote page, and display the response. It's an idea, certainly.
BrianV