ruby server stability on windows - ruby-on-rails

My RoR app on windows (xp as well as server 2008) stops responding after maybe a couple of days.
Using guidance from stackoverflow as well, I set up services to run the server automatically at startup. I tried different products: webrick, mongrel with mongrel_service, thin – both standalone or with an apache proxy. They start ok and work fine, but after a certain amount of time (rather than load) it stops responding.
I don't see anything in the logs either, even if I have the server run from the command line I don't get any error messages there nor does the process end, the server just does not answer anymore. Has anybody else come across this?
Andreas

There are so many issues with windows that our whole company switched to ubuntu. I would not advise this as a production solution.

Related

How to monitor mongrel server running ROR application on Windows?

I have a Ruby on rails application that freezes over time. The rails logs are clean and donotshow anything. I suspect it freezes without any activity.
Is there a way i can monitor and profile the mongrel server for leaks and errors?
If yes how do i go about doing it.
There are tools like 'bleak_house' which work only for unix.
Thanks
Shaunak
As far as I know there are no tools to monitor mongrel on windows

Monitoring ROR server (thin or mongrel) for resources and availability in WINDOWS and re-spawn

First thing I would like to say is, i know deploying ror applications in windows is not recommended, but in this case i have no choice due to some client restrictions.
I am looking for a tool like Upstart for windows which will moniter my instance of Thin or Mongrel and will 're-spawn' in case of crashes or availability.
Now I looked around quite a bit and most solutions like UpStart, or Passenger server are only available for Unix environments.
Any known tools for windows? and how to use them?
I am also open to any alternative ror servers for windows that can do this automatically like passenger does.
Thanks
Shaunak
Maybe a bat script as a scheduled task to run wmic process, scan to find Mongrel, and if it's not found to run it?
Sorry, I'd do it in bash, or I'd have a code example for you.
This would also make a good python script, in my opinion.

aws memory high usage

Recently I configured my instance into a micro environment in EC2 with glassfish and mysql in windows..
I deployed my war and i was able to access my site through http.
I changed my application and redeployed the war and it also worked.
When I was about to redeploy the war for 4th or 5th time, the application got deployed, I saw the message in the log file. But I was unable to access the site through http.
Then I tried the command "asadmin list-applications" and I got the following message.
Error occurred during initialization of VM
Could not reserve enough space for object heap
After that I was not able to connect to my instance through RDP and I had to reboot, I was able to access it again after that. I started the servers again (glassfish mysql), but no luck.
I noticed that the memory usage is around 90% or more. CPU isage is low.
now I can not access my site through http. what shall i do ?
Thanks in advance !
Honestly, there are a couple issues working against you here:
1) Windows requires FAR more RAM than Ubuntu to run at a minimum decent level.
2) GlassFish has a much larger footprint than Tomcat or Jetty.
Is there any particular reason you need Windows? Like is there a specific need that your server run some executables for file processing or something like that outside the JVM? Most would agree that Linux (Ubuntu or other) will give you much better results in performance and stability to run an App Server like GlassFish in any environment.

Run thin webserver as a windows service

i'm trying to deploy in production Redmine application. I heard that thin is the fastest ruby on rails webserver so I installed it. Now I have a really simple problem: i must start it every time i reboot the machine via cmd because there isn't a prebuilt windows service or something similar that allow me to autostart it. How could i fix the problem? I saw that there is a bat file, so i tried to make a C# windows service like this and it starts correctly but if I stop it the service stops but the webserver is still active and it will never shutdown. The only way to stop thin is to reboot the machine. Maybe I'm wrong, could someone post an example of how should i run thin as a windows service?
i've written a blogpost about this a while ago, but most of it should still be applicable. Hope it helps.
But to be honest, i always deploy on windows using the mongrel-service gem, and configure an apache in front to load-balance between 3 mongrels. Much easier.
Also the big advantage for me was that if something went wrong with thin-service, it didn't restart automatically, while the mongrel-service guards your mongrel process, and if it for whatever reason goes down, it will restart it again. For me that was something i could not miss.

What can I use to host a Rails site on Windows?

Okay, before you guys go nuts -- this is just a small site, temporary setup. Right now I'm having some internal folks remote into the server and use the site through webrick via the dev command: ruby script/server. Not exactly ideal.
I'm just starting Rails dev and I want to know a better way to handle hosting on a Windows Pro box. Again, just temporary so please be gentle :)
As far as I know, mod_rails isn't an alternative.
Mongrel plays very nice on windows, though, so you can set up a few mongrels and have IIS or Apache proxy to them. Or just use Mongrel directly. Before mod_rails, mongrel was the de facto way to deploy on any platform, so it's a very viable choice.
The one time I was forced to deploy on Windows, however, I installed Ubuntu via virtualbox (could also use VMWare or whatever, of course) and deployed on that. Works like a dream, and I got to work with a sensible OS. Phew. SSH and stuff. Can't live without it. Remote desktop isn't exactly my kind of thing.
Your best bet is to setup a Mongrel cluster. Mongrel is an application server which can serve a Rails application on HTTP. But a single Mongrel instance can only handle 1 request at the same time, so typically people run a cluster of Mongrels, i.e. multiple Mongrel instances. These Mongrel instances do not talk to the Internet directly. Instead, they are put behind a load balancer or a web server, which proxies requests to this cluster of Mongrels. If you use Apache on Windows then you can:
1. Setup and start a cluster of Mongrels, each listening on its own port.
2. Setup a virtual host with some mod_proxy_balancer directives, with which you tell mod_proxy_balancer to proxy all requests to the Mongrel cluster. mod_proxy_balancer will automatically distribute the load between the Mongrels.
If usage is really low i.e. likely to be mostly 1 person at a time or your response time is really low then you can get away with a single mongrel and having your users point there browser to the relevent IP address and port.
For some time before I finally got my apps migrated to our corporate Linux/apache "cloud" (which was anything but straightforward, for mostly internal IT-related reasons) I ran two apps on a workstation, using a separate mongrel (different ports) for each. It worked well enough to be useful for almost a year.
These days (well, about three weeks now) I've substituted the immediacy, control - and vulnerability - of local (under my desk) access for the stability of five servers, each with multiple mongrels, staging areas, and deployment annoyances. Swings and roundabouts.

Resources