如何找出我的应用程序运行缓慢的原因

如何找出我的应用程序运行缓慢的原因

本文介绍了如何找出我的应用程序运行缓慢的原因?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在500 MB Slicehost VPN上部署了一个简单的Rails应用程序.我是唯一使用该应用程序的人.当我在笔记本电脑上运行它时,速度足够快.但是部署的版本异常缓慢.加载登录屏幕需要6到10秒钟.

我想弄清楚为什么这么慢.是我的代码吗? (不要这么想,因为它在本地要快得多,但是也许.)Slicehost的服务器过载了吗?是互联网吗?

有人可以建议我可以用来缩小问题根源的技术或步骤吗?


更新:

对不起,忘了提.我正在使用Phusion Passenger(又名mod_railsmod_rack)在CentOS 5下运行它.

解决方案

如果第一次加载时速度很慢,则可能是由于乘客由于不活动而终止了该过程.我不记得所有的细节,但我确实记得读过一些人,他们使用cron作业来维持至少一个进程的生命,从而避免了需要重新加载环境的乘客可能发生的这种滞后.

更多详细信息此处

具体来说-游泳池空闲时间默认为2分钟,这意味着在闲置两分钟后,乘客将不得不重新加载环境以服务于下一个请求.

I have a simple Rails app deployed on a 500 MB Slicehost VPN. I'm the only one who uses the app. When I run it on my laptop, it's fast enough. But the deployed version is insanely slow. It take 6 to 10 seconds to load the login screen.

I would like to find out why it's so slow. Is it my code? (Don't think so because it's much faster locally, but maybe.) Is it Slicehost's server being overloaded? Is it the Internet?

Can someone suggest a technique or set of steps I can take to help narrow down the cause of this problem?


Update:

Sorry forgot to mention. I'm running it under CentOS 5 using Phusion Passenger (AKA mod_rails or mod_rack).

解决方案

If it is just slow on the first time you load it is probably because of passenger killing the process due to inactivity. I don't remember all the details but I do recall reading people who used cron jobs to keep at least one process alive to avoid this lag that can occur with passenger needed to reload the environment.

Edit: more details here

Specifically - pool idle time defaults to 2 minutes which means after two minutes of idling passenger would have to reload the environment to serve the next request.

这篇关于如何找出我的应用程序运行缓慢的原因?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-11 10:26