5

I just installed TeamBox on my Ubuntu 9.10 server. I have it up and running on port 3000 using the provided server script.

It's running extremely slow, up to 30 seconds per HTTP request when connecting from another computer.

I used links to load up TeamBox from the shell and it took no time at all.

I then setup an SSH tunnel and again it was working very fast.

I run about 30 vhosts through apache on this server, as well as SAMBA etc and do not have any problems.

How can I troubleshoot this problem?

ncatnow
  • 833
  • 1
  • 12
  • 19
  • Did you ever get this resolved? I just ran across a very similar issue: Ubuntu 10.04, rails 3.0.1, when working from localhost everything quick. When using any other sever on the network, pages take 30+ seconds to load. This even happens with a totally new/clean rails app, so I strongly suspect it is some library/network/configuration problem. – Yevgeniy Brikman Dec 03 '10 at 04:14
  • Upon further investigation, I can ping the server just fine from other computers and other web servers (e.g. Grails) work just fine. So it's not likely a system or network wide issue, but just a rails problem. – Yevgeniy Brikman Dec 03 '10 at 04:25

3 Answers3

10

My redmine (ruby, webrick) is too very slow. Now I solved this problem: apt-get install mongrel
ruby /home/redmine/redmine/script/server mongrel -e production
done, and redmine work very good speed! by

  • Just wanted to note that this solution works perfectly. Install mongrel, and run "rails server mongrel" and now requests to localhost and from other machines work equally fast. Not sure what the issue is, but I guess WEBrick has some sort of issues on Ubuntu. – Yevgeniy Brikman Jan 18 '11 at 19:38
2

Are you using Passenger? I had the same problem a few weeks ago and resolved the issue by adding this to my vhost file.

 # Speeds up spawn time tremendously -- if your app is compatible.
    # RMagick seems to be incompatible with smart spawning
    RailsSpawnMethod smart

    # Just in case you're leaking memory, restart a listener
    # after processing 5000 requests
    PassengerMaxRequests 5000

    # only check for restart.txt et al up to once every 5 seconds,
    # instead of once per processed request
    PassengerStatThrottleRate 5

    # Keep the spawners alive, which speeds up spawning a new Application
    # listener after a period of inactivity at the expense of memory.
    RailsAppSpawnerIdleTime 0

    # Additionally keep a copy of the Rails framework in memory. If you're
    # using multiple apps on the same version of Rails, this will speed up
    # the creation of new RailsAppSpawners. This isn't necessary if you're
    # only running one or 2 applications, or if your applications use
    # different versions of Rails.
    RailsFrameworkSpawnerIdleTime 0

    # Keep the application instances alive longer. Default is 300 (seconds)
    PassengerPoolIdleTime 1000
Travis
  • 5,021
  • 2
  • 28
  • 37
  • Not using Passenger. I'm not running Teambox through apache, but using the python server that comes with it. I'm confused why there would be such a huge speed difference between accessing it through localhost and accessing it across the LAN. The delay happens with each HTTP request to the server. It seems more like a network issue. Once the python server receives the request it processes it very quickly. What could cause this? – ncatnow Mar 13 '10 at 09:56
  • @natcow: DNS lookup if not using an IP is the most common – Abe Petrillo Aug 03 '11 at 08:31
1

a good way to publish RoR apps is to use Nginx as a HTTP(S) reverse-proxy, associated to thin ruby server (available as a gem).

Here is a good tutorial about Nginx with RubyOnRails, and here another about thin.

I use redmine too, with Nginx and thin under a OpenVZ container, and it's working very well !

Cicatrice
  • 211
  • 1
  • 8