|
![]() |
SCGI Rails Runner FAQOne of the things I really hate about techies is that they answer questions or criticism with explanations. You ask them, “Hey, how come your fucking program doesn’t compile?” And they respond, “You see an LRk parser operates with a finite state machine that…” I promise in this FAQ that I’ll give the minimum of explanation, and either say why it don’t work, or how you can fix it. GeneralQ: Why bother? This works great with FastCGI. A: Well, aren’t you snotty. Seriously though, FastCGI is really getting old and is too hard to install. Many times people post to the Rails list with complaints and woes related to FastCGI. I also added lots of nice features to SRR that you just don’t get out of FastCGI like a nice status file. But the best reason is that the SRR package is a tiny pure Ruby implementation that seems to be just as fast as the FastCGI configurations, and is so easy to setup you can even cluster the hell out of it without much fuss. Feel free though to try them both, and then give me feedback on which you like best and what I can add. Q: It's really slow when I start it up and seems to leak memory. A: You’re running it in development mode. You most likely configured your processor with “-e development” so all you need to do is:
This “merges” (-M) your previous configuration with the new config of “-e development” and then restarts your processor. Q: Why doesn't the script just automatically go into the production mode? A: It now defaults to production mode. If you think you’re in development mode then double check your config/scgi.yaml file for the :env: setting. Q: Does it work with SwitchTower yet? A: I’m working on getting to be SwitchTower enabled soon. The main thing that seems to block SwitchTower is the fact that ssh refuses to break the connection until all processes with open IO have finished. Seems the only way around this is to do the usual daemonize process which I’ll work out pretty soon. Q: Is there an easy way to reload? I don't want to take the whole thing down just to deploy new code. A: Yep, it now does soft reload and graceful restart. Soft reload is where you just reload the config/scgi.yaml file so that it gets a few new configuration parameters. This works for things like the throttle settings and the maxconns. Graceful restart is where the processor is allowed to valve current customers off (let them finish) and then it shutsdown. After this shutdown it reruns the command that started it and you get your restart. The command to soft reconfigure is:
The command to graceful restart is:
And you can use the -f option to force the restart. Win32 ProblemsQ: Why do I get errors about unsupported signals? A: Windows doesn’t support the POSIX signal system so you’re only allowed to use the DRb control method. When you configure your processor use the -S option to turn signals off:
Q: How come it says I can't start because I'm missing 'fork'. I have all of my pronged eating implements right here. A: Win32 also doesn’t support the POSIX fork method, so you won’t be able to easily use the scgi_ctrl start method. Instead, you have to run the scgi_service script directly. In the near future Win32 will get a real NT service for all of this. Max OSX
Linux
ApacheLighttpdQ: If I restart the SCGI processor I seem to have to restart the lighttpd as well. You said this wasn't necessary. A: When you’re under a heavy load, the lighttpd server will “shutdown” the connection to the scgi_service backend if it thinks it crashed. It will bring it back up after a few seconds (sometimes 60). There is an option to turn set this to a reasonable time limit. Refer to the lighttpd documentation for mod_fastcgi (which has the same options as mod_scgi). Q: When I try to shutdown lighttpd it crashes with a SEGFAULT. A: Make sure you’re running a recent version of lighttpd. I found this happened when I ran anything before 1.4.3. It also happens in other versions at odd times on start-up. Q: When I try to shutdown lighttpd it locks up on me and I have to force it to quit with a KILL. A: Yep, lighttpd tries to do a graceful shutdown. Not so graceful eh? Q: I get tons of messages in the lighttd_error.log file when running SCGI. A: You probably have scgi.debug=3 but you need to have it set to 0 (zero). |