[sheepdog] add http transport stub

Liu Yuan namei.unix at gmail.com
Wed Jul 3 04:21:41 CEST 2013


On Wed, Jul 03, 2013 at 09:53:31AM +0900, MORITA Kazutaka wrote:
> At Tue,  2 Jul 2013 00:35:26 +0800,
> Liu Yuan wrote:
> > 
> > This patch set adds transport stub, on top of which we can build Swift or Amazon
> > S3 service.
> > 
> > Only HTTP GET/PUT/POST/HEAD/DELETE (RESTful API) is allowd to interface with
> > sheepdog storage.
> > 
> > The transport is implemented via fastcgi in the address space of sheepdog to
> > favor performance. It is currently disabled at compile time.
> > 
> > How To Test:
> > 
> > 1 install libfcgi-dev and nginx
> > 2 ./configure --enable-http
> > 3 run nginx as following:
> >   # edit ~/nginx.conf as following:
> > =======================================================
> > events {
> > 	worker_connections 1024;
> > }
> > 
> > http {
> > 	server {
> > 		listen 80;
> > 		server_name localhost;
> > 
> > 		location / {
> > 			fastcgi_pass   localhost:7100;
> > 
> > 			fastcgi_param   SCRIPT_NAME             $fastcgi_script_name;
> > 			fastcgi_param   REQUEST_METHOD          $request_method;
> > 			fastcgi_param	CONTENT_LENGTH		$content_length;
> > 			fastcgi_param   HTTP_RANGE              $http_range;
> > 		}
> > 	}
> > }
> > =======================================================
> >   # nginx -c ~/nginx.conf
> > 4 sheep/sheep -d -f -o store/ -c local -r localhost:7100
> > 5 use curl to test:
> >   $ curl -v -X GET http://localhost/test # issue a get request
> >   $ curl -v -X PUT -d "hello" http://localhost/test # issue a put request
> 
> Thanks a lot.  I like this simple implementation.
> 
> However, Joseph suggests using libmicrohttpd in the other thread.  Can
> you explain why you adopt FastCGI and Nginx?
> 

Because using fastcgi is simplest aaproach and it can work with all kinds of
http servers, to name a few, Apache, lighthttpd, nginx. Now http server acts
like a http proxy and sheep act like its backend and they can restart/shutdown
respectively on the same/diffrent node without affecting each other. You don't
want to run sheep directly as a public server, no? I guess there is many
security issues in sheep itself.

libmicrohttpd might be a good method to built-in the http server in sheep, but 
it means a lower level approach than fastcgi that need to handling http request
and response manually, and most important I guess it won't be effecient than
dedicated http server like nginx.

Thanks
Yuan



More information about the sheepdog mailing list