5

我刚刚在我的 Ubuntu 9.10 服务器上安装了 TeamBox。我使用提供的服务器脚本在端口 3000 上启动并运行它。

从另一台计算机连接时,它的运行速度非常慢,每个 HTTP 请求最多需要 30 秒。

我使用链接从 shell 加载 TeamBox,并且完全没有花费时间。

然后我设置了一个 SSH 隧道,它再次运行得非常快。

我在这台服务器上通过 apache 以及 SAMBA 等运行了大约 30 个虚拟主机,没有任何问题。

如何解决此问题?

4

3 回答 3

10

我的 redmine(ruby,webrick)太慢了。现在我解决了这个问题: 完成了,redmine 的工作速度非常好!经过 apt-get install mongrel
ruby /home/redmine/redmine/script/server mongrel -e production

于 2010-04-08T11:52:16.717 回答
2

你在用乘客吗?几周前我遇到了同样的问题,并通过将其添加到我的虚拟主机文件中解决了这个问题。

 # 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
于 2010-03-13T08:42:11.747 回答
1

发布 RoR 应用程序的一个好方法是使用Nginx作为 HTTP(S) 反向代理,与ruby​​ 服务器相关联(作为 gem 提供)。

这是一个关于 Nginx 和 RubyOnRails 的好教程这里是另一个关于瘦的教程。

我也使用 redmine,在 OpenVZ 容器下使用 Nginx 和 Thin,它运行得非常好!

于 2010-04-26T13:05:11.257 回答