找出为什么webapp在托管时缓慢 [英] finding out why a webapp is slow when hosted

查看:145
本文介绍了找出为什么webapp在托管时缓慢的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个 django网络应用程序使用 postgres db.It允许用户登录并发布一些帖子得到保存到数据库,然后用户可以列出他在特定的一天做了多少帖子,并列出属于某个类别的帖子等。尽管这在我的机器中没有任何延迟,但是花费大量的时间在免费主机上托管时,加载每个页面。

I have a django web app that uses postgres db.It allows users to login and make some posts which get saved to db and later on the user can list how many posts he made on a particular day etc and list the posts belonging to a particular category etc.While this worked without any delay in my machine,it is taking a lot of time to load each page when hosted on a free host.

您如何知道为什么会发生这种情况?我应该先看看应用程序吗?使用分析器是否有任何意义,因为这个应用程序用于在本地机器上运行时没有任何延迟?

How do you find out why this is happening?which part of the app should I look first?Is there any meaning in using a profiler since this app used to run with no delays in my local machine?

我想找到如何处理这个问题一般。我能够访问托管在同一个免费主机上的其他应用程序没有太多的延迟..这可能是一个特定于我的应用程序的问题

I would like to find out how to approach this problem in general.I was able to access other apps hosted on the same free host without much delays ..so this may be a problem specific to my app

我想要一些有关这方面的建议..如果有人可以帮助..

I would like some advice regarding this..If anyone can help..

谢谢
ps:(我故意遗漏主机名,因为这是一个免费的服务,没有任何意义的抱怨,同一主机上的其他应用程序也可以正常工作)

thank you p.s:(I intentionally left out the host's name because ,since that was a free service ,there was no point in complaining and also other apps on the same host works well)

推荐答案

这里是免费的主机,当在一个免费的主机上,您可以与数百个其他站点共享一个盒子(可以相当于少量的RAM或CPU)。支付一点钱($ 30美元/一年22英镑),让自己成为更好的主机。

The here is the free host bit, when on a free host you could be sharing a box with hundreds of other sites (that can equate to a very small amount of ram or CPU). Pay a little money, ($30 dollars / £22 a year) and get your self a better host.

你会发现性能和可靠性好多了。

You will find the performance and reliability so much better.

如果我先找出什么您和服务器之间的延迟是,在本地机器上没有/很少的网络流量,所以您的网页将显示加载速度更快。

Failing that I would firstly find out what the latency between you and the server is, on a local machine there is no / little network traffic so your pages will appear to load a lot faster.

接下来我将看看您实际下载的速度。可能是您的网站限制在20-30k,这意味着即使是一个小型网站也可能需要一秒钟以上的时间。

Next i would look at the actual download speeds you are getting. It could be that your site is limited to 20-30k, which means even a small site will take over a second to load.

您是否托管了许多图片?如果是这样,您通过django提供服务,或者是这样做的网络服务器。如果是django,那么让web服务器承担这个负载。

Are you hosting many images? If this is the case are you serving them through django or is the webserver doing this. If it is django then make the webserver take this load.

最后检查页面的处理速度。分析正在运行的查询,了解什么是时间。确保postgres配置正确并且资源足够。您可以使用django调试工具栏分析查询速度。

Finally check the processing speed of the pages. Analise the queries which are being run and find out what is taking the time. Make sure that postgres is correctly configured and has enough resources. You can analyses the query speed using the django debug toolbar.

这篇关于找出为什么webapp在托管时缓慢的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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