Hi Everyone, I got the SCGI server I''d been working on to run Rails last night. Anyone who''s interested can download an extremely alpha release at: http://www.zedshaw.com/projects/ruby_event/ruby_event.tar.bz2 To use it you do the following: 1. Intall libevent 1.1a from http://www.monkey.org/~provos/libevent/ 2. Install the Ruby/Event framework: a. Untar the ruby_event.tar.bz2 b. sudo ruby setup.rb 3. Copy the examples/scgi_server.rb to the root of your Rails application. *NOT* into your public directory. *NOT* into your config directory. The one above those two. 4. Run it with: ruby scgi_server.rb localhost 9999 5. Use the included examples/lighttpd.conf to see how you get lighttpd to connect to it. a. Remember that if you want lighttpd to be on a different machine than use 0.0.0.0 in #4 above. b. You''ll have to change the "/test" URI used in the config file to a URI your rails app understands. The only thing at the moment is that the lighttpd.conf I''m using routes one URL (/test) to the Rails application, and I can''t figure out how to "peel" off a base URL. For example, have "/myapp/search" go to the SCGI server and have Rails understand it as "/search". Anyway, enjoy the show. Feedback more than welcome. Zed A. Shaw http://www.zedshaw.com/
Just what *is* SCGI? Okay, I did a bit of research first: The SCGI protocol is a replacement for the Common Gateway Interface (CGI) protocol. It is a standard for applications to interface with HTTP servers. It is similar to FastCGI but is designed to be easier to implement. http://python.ca/nas/scgi/protocol.txt On 7/25/05, Zed A. Shaw <zedshaw-dd7LMGGEL7NBDgjK7y7TUQ@public.gmane.org> wrote:> Hi Everyone, > > I got the SCGI server I''d been working on to run Rails last night. > Anyone who''s interested can download an extremely alpha release at: > > http://www.zedshaw.com/projects/ruby_event/ruby_event.tar.bz2 > > To use it you do the following: > > 1. Intall libevent 1.1a from http://www.monkey.org/~provos/libevent/ > 2. Install the Ruby/Event framework: > a. Untar the ruby_event.tar.bz2 > b. sudo ruby setup.rb > 3. Copy the examples/scgi_server.rb to the root of your Rails > application. *NOT* into your public directory. *NOT* into your config > directory. The one above those two. > 4. Run it with: ruby scgi_server.rb localhost 9999 > 5. Use the included examples/lighttpd.conf to see how you get lighttpd > to connect to it. > a. Remember that if you want lighttpd to be on a different machine than > use 0.0.0.0 in #4 above. > b. You''ll have to change the "/test" URI used in the config file to a > URI your rails app understands. > > The only thing at the moment is that the lighttpd.conf I''m using routes > one URL (/test) to the Rails application, and I can''t figure out how to > "peel" off a base URL. For example, have "/myapp/search" go to the SCGI > server and have Rails understand it as "/search". > > Anyway, enjoy the show. Feedback more than welcome. > > Zed A. Shaw > http://www.zedshaw.com/ > > _______________________________________________ > Rails mailing list > Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > http://lists.rubyonrails.org/mailman/listinfo/rails >-- rick http://techno-weenie.net
zedshaw-dd7LMGGEL7NBDgjK7y7TUQ@public.gmane.org
2005-Jul-25 17:20 UTC
Why SCGI Anyway? (Was: [ANN] SCGI Server [Very Very Alpha])
Rick, Another way to look at SCGI is as an alternative to the current FCGI way of running Rails in production. Right now SCGI does pretty much what FCGI does, and turns out to be just as fast. My next move is to make SCGI deployment and management do the things I (and others) want for deploying Rails applications in production. Right now I''ve got the following requests from people: 1. Works the same on all platforms. 2. No more memory leaks or crashes. 3. No more "Oh, well the C bindings don''t have blah but Ruby bindings do." 4. Easier to deploy with DRY applied to the deployment. 5. Reasonable defaults on the config so people don''t have to go insane tracking down Ruby code to get the thing working right. 6. Simpler clustering (auto-clustering was one option). Actually looking at server socket multi-plexing so you just start as many as you want and they figure out how to handle the load. 7. Fast, Fast, Fast. 8. Better monitoring of the backend(s) for activity, performance, failure, etc. 9. Quicker turn-around on restart. Most of the requested stability features are there, but the monitoring and deployment features are planned. Finally, I did some informal (that''s *i* *n* *f* *o* *r* *m* *a* *l*) performance and stability tests with these results thus far: - A simple Rails app with one controller, one .rhtml file, returning "TESTED". - All tests done with httperf against the above scenario. - Exact same lighttpd server fronting both. * 55 req/s with 1 SCGI server vs. 50 req/s with 1 FCGI server. * FCGI seemed to handle 60 req/s, but 1/3 of the time it would choke and the backend would stop functioning entirely. It would only reliably handle 50 req/s and anything above that caused the failures. * SCGI definately handled being pounded a lot better by kicking out unresponsive clients and not choking. Anyway, that''s the report thus far. Comments are welcome. Zed> Just what *is* SCGI? > > Okay, I did a bit of research first: > > The SCGI protocol is a replacement for the Common Gateway Interface > (CGI) protocol. It is a standard for applications to interface with > HTTP servers. It is similar to FastCGI but is designed to be easier > to implement. > > http://python.ca/nas/scgi/protocol.txt > >
Hi Zed, I''m curious to try this using Webrick as the HTTP server ... Can you help with instructions? Neville -----Original Message----- From: rails-bounces-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org [mailto:rails-bounces-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org] On Behalf Of Zed A. Shaw Sent: Monday, 25 July 2005 11:33 PM To: Ruby On Rails List Subject: [Rails] [ANN] SCGI Server [Very Very Alpha] Hi Everyone, I got the SCGI server I''d been working on to run Rails last night. Anyone who''s interested can download an extremely alpha release at: http://www.zedshaw.com/projects/ruby_event/ruby_event.tar.bz2 To use it you do the following: 1. Intall libevent 1.1a from http://www.monkey.org/~provos/libevent/ 2. Install the Ruby/Event framework: a. Untar the ruby_event.tar.bz2 b. sudo ruby setup.rb 3. Copy the examples/scgi_server.rb to the root of your Rails application. *NOT* into your public directory. *NOT* into your config directory. The one above those two. 4. Run it with: ruby scgi_server.rb localhost 9999 5. Use the included examples/lighttpd.conf to see how you get lighttpd to connect to it. a. Remember that if you want lighttpd to be on a different machine than use 0.0.0.0 in #4 above. b. You''ll have to change the "/test" URI used in the config file to a URI your rails app understands. The only thing at the moment is that the lighttpd.conf I''m using routes one URL (/test) to the Rails application, and I can''t figure out how to "peel" off a base URL. For example, have "/myapp/search" go to the SCGI server and have Rails understand it as "/search". Anyway, enjoy the show. Feedback more than welcome. Zed A. Shaw http://www.zedshaw.com/ _______________________________________________ Rails mailing list Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org http://lists.rubyonrails.org/mailman/listinfo/rails
Hmmm, I''ve got no idea. I don''t think Webrick even support SCGI as a client like lighttpd and Apache do. Sorry. On Tue, 2005-07-26 at 09:29 +1000, Neville Burnell wrote:> Hi Zed, > > I''m curious to try this using Webrick as the HTTP server ... Can you > help with instructions? > > Neville >
On 7/25/05, Zed A. Shaw <zedshaw-dd7LMGGEL7NBDgjK7y7TUQ@public.gmane.org> wrote:> Anyway, enjoy the show. Feedback more than welcome.Is it possible to get this working such that lighttpd starts and manages the SCGI daemon on it''s own? (sort of the way lighttpd already can launch it''s own fastcgi daemons and manage them). Having to start a separate daemon that lighttpd connects to seems kinda flaky to me (well, maybe not flaky, but it just adds another layer of complexity into the app). -- Urban Artography http://artography.ath.cx
On 7/26/05, Rob Park <rbpark-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Is it possible to get this working such that lighttpd starts and > manages the SCGI daemon on it''s own? (sort of the way lighttpd already > can launch it''s own fastcgi daemons and manage them). Having to start > a separate daemon that lighttpd connects to seems kinda flaky to meOn some scalability level it''s usual to move the scgi listeners on the different machines, so the current way is maybe better. Also it''s good to have a way to reboot only the listeners, not the server itself (it can serve different content - static pages, php etc.)
On 7/26/05, Stoyan Zhekov <stoyan-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> On some scalability level it''s usual to move the scgi listeners on the > different machines, so the current way is maybe better. Also it''s good > to have a way to reboot only the listeners, not the server itself (it can > serve different content - static pages, php etc.)Mainly I''m just worried about an SCGI server crashing, and then staying dead until I rush in to resurrect it. I''d like some mechanism for automatically respawning dead servers so that it doesn''t require my intervention to fix. -- Urban Artography http://artography.ath.cx