hassaanm
hassaanm

Reputation: 15599

Ruby on Rails Server hangs/lags randomly for long periods

I have a program that makes a simple Ruby on Rails server go live. The server is used to communicate and collate data between computers on the same network. I have not done anything fancy to the Ruby stuff. I have simply used scaffold to generate 3 models and that is it. The problem is that after a while (many HTTP requests between the computers and the server ~= 10 minutes) the server starts to lag and just hangs forever, forcing me to kill the server script and restarting it. Any help/suggestions?

Upvotes: 3

Views: 1890

Answers (1)

Toby Hede
Toby Hede

Reputation: 37133

Are you running in development mode or have the class caching turned off?

It is not uncommon to find systems running in development mode to start hitting some issues. Not such a big deal when you are working and can simply restart the dev server, but can be very annoying once you have a working system.

The key issue is in config/environments/development.rb:

# In the development environment your application's code is reloaded on
# every request.  This slows down response time but is perfect for development
# since you don't have to restart the webserver when you make code changes.    

config.cache_classes = false

Not only does this slow down response time, but it can lead to slow memory leaks and unpredictable behaviour over time.

Upvotes: 3

Related Questions