Rails work quickly on the server, but are slow when accessed from another machine

I have a Rails application hosted on a server machine (running Webrick). When I enter this computer and access the application (through localhost: 3000), the application runs smoothly. But when I try to access the application from another computer (through the host name: 3000), the application runs very slowly.

I am not sure how to debug the problem; is there a reason why this is so? I also have things like a SQL Server database hosted on the same server machine, and accessing the database from other machines works fine.

Update to add: the server machine and other computers from which I am trying to get it are on the corporate intranet.

+5
source share
5 answers

The most obvious answer is that the problem is not with rails, but with domain hosting (i.e. your DNS is very slow).

Try downloading another application (perhaps the Sinatra welcome world) and see if it shows the same symptoms.
If so, then your domain provider is to blame.

If the problem persists, increase the log detail and see if any SQL queries are an obvious bottleneck.

, Webrick. , . . Apache - : http://www.modrails.com/

+4

. : rvm, .

Webrick . ?

/usr/lib/ruby/1.9.1/webrick/config.rb .

:DoNotReverseLookup => nil,

:DoNotReverseLookup => true,

rvm ~/.rvm/rubies/ruby-your-version/lib/ruby/your-version/webrick/config.rb

+14

, Thin Webrick.

Gemfile

gem 'thin'
+3

Webrick , , , . , ?

+1

Take a look at the response time indicated in the rails log file. If they are the same for local and remote access, then you know that your problem is somewhere else on the stack (DNS, routing, software firewall, etc.).

It is very likely that the problem is not with the rails themselves.

+1
source

All Articles