我刚在我的Ubuntu 9.10服务器上安装了TeamBox。我使用提供的服务器脚本在端口3000上运行并运行它。
从另一台计算机连接时,每个HTTP请求的运行速度非常慢,最长可达30秒。
我使用链接从shell加载TeamBox,它根本不花时间。
然后我设置了一个SSH隧道,并且它的工作速度非常快。
我在这台服务器上通过apache运行了大约30个虚拟主机,以及SAMBA等,没有任何问题。
如何解决此问题?
答案 0 :(得分:10)
我的redmine(ruby,webrick)太慢了。
现在我解决了这个问题:
apt-get install mongrel
完成了,redmine工作速度非常快!
由
ruby /home/redmine/redmine/script/server mongrel -e production
答案 1 :(得分:2)
您使用的是Passenger吗?几个星期前我遇到了同样的问题,并将此问题添加到我的vhost文件中解决了这个问题。
# 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
答案 2 :(得分:1)
发布RoR应用程序的一个好方法是使用 Nginx 作为HTTP(S)反向代理,与瘦 ruby服务器(作为gem提供)相关联。
Here is a good tutorial about Nginx with RubyOnRails和here another about thin。
我也使用redmine,在OpenVZ容器下使用Nginx和thin,并且它运行良好!