rails 应用程序在服务器上速度很快,但从另一台机器访问时速度很慢 [英] rails app fast on server, but slow when accessed from another machine

查看:31
本文介绍了rails 应用程序在服务器上速度很快,但从另一台机器访问时速度很慢的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在服务器机器上托管了一个 Rails 应用程序(运行 Webrick).当我登录这台机器并访问该应用程序(通过 localhost:3000)时,该应用程序运行顺利.但是当我尝试从另一台机器(通过主机名:3000)访问该应用程序时,该应用程序运行速度非常慢.

I have a Rails app hosted on a server machine (running Webrick). When I log onto this machine and access the app (via localhost:3000), the app runs smoothly. But when I try to access the app from another machine (via hostname:3000), the app runs super slowly.

我不知道如何调试问题;有什么理由会造成这种情况吗?我也有一些东西,比如在同一台服务器上托管的 SQL 服务器数据库,从其他机器访问数据库工作正常.

I'm not sure how to go about debugging the problem; is there any reason why this would be the case? I also have things like a SQL server database hosted on the same server machine, and accessing the database from other machines works fine.

更新以添加:服务器计算机以及我尝试从中访问它的其他计算机都在公司内部网上.

Updating to add: the server machine, and the other machines I try to access it from, are all on a corporate intranet.

推荐答案

最明显的答案是问题不在于 rails,而在于您的 Domain Hosting(即您的 DNS 非常慢).

The most obvious answer would be that the problem is not with rails, but with your Domain Hosting(i.e. your DNS is super slow).

尝试加载不同的应用程序(可能是 Sinatrahello world"),看看它是否表现出相同的症状.
如果是 - 你的域名供应商是罪魁祸首.

Try and load a different app(maybe a Sinatra "hello world") and see if it exhibits the same symptoms.
If yes - your domain provider is to blame.

如果问题仍然存在,请增加日志的详细程度并检查是否有任何 SQL 查询是明显的瓶颈.

If the problem persists, increase the verbosity of the logs and check if any SQL queries are an obvious bottleneck.

此外,问题可能出在 Webrick 上.它只是不适合生产,如果几个人同时使用该应用程序可能会很慢.用不同的服务器试试.Apache 是一个合理的选择:http://www.modrails.com/

Also, the problem may be with Webrick. It just wasn't meant for production and may be slow if several people use the app at once. Try it with a different server. Apache is a reasonable choice: http://www.modrails.com/

这篇关于rails 应用程序在服务器上速度很快,但从另一台机器访问时速度很慢的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆