简体   繁体   English

如何提高启用Ajax的网站的性能?

[英]How to increase the performance of ajax enabled web site?

I had 1/2 web application prepared. 我准备了1/2个Web应用程序。 I had seen that the performance getting very slow when using the ajax control compare with using javascript but only when that is deployed on the server. 我已经看到,与使用javascript相比,使用ajax控件时性能会变得非常慢,但是只有在服务器上部署时才可以。

Why is this problem problem arriving when ajax controls used in application, performance sleeps & not opens the pages quickly. 为什么在应用程序中使用ajax控件时,此问题问题会出现,性能休眠且无法快速打开页面。

What is the solution for this to improve performance when ajax control use & it deploy on the server. 当使用ajax控件并将其部署在服务器上时,用于提高性能的解决方案是什么?

Regards, Girish 问候,吉里什

Yes. 是。

Well, the reason it's slower when you deploy to the server is because the ajax requests now have to go over the entire internet. 嗯,部署到服务器时速度较慢的原因是,现在Ajax请求必须遍及整个Internet。 This is different compared to running locally, when the requests do not go over the internet. 当请求不通过Internet传输时,这与本地运行相比有所不同。

How to speed it up? 如何加快速度?

  • Make less calls. 打更少的电话。
  • Return more things per call so you can make less in general 每次通话返回更多的东西,因此您的总收益会减少
  • Return as little as possible, in a condensed format if possible 尽可能少地返回,如果可能的话,以简明格式返回
  • Consider enabling gzip on your server 考虑在服务器上启用gzip
  • other such things 其他这样的事情

查看一下stackoverflow所做的改进: http : //blog.stackoverflow.com/2009/08/a-few-speed-improvements/

The other answers are good for general optimization, but I'm thinking there's an inherent problem with your understanding of the request flow in your application. 其他答案对于常规优化是有好处的,但是我认为您对应用程序中的请求流的理解存在一个固有的问题。 For all intents and purposes, "ajax" is javascript. 出于所有目的和目的,“ ajax”是javascript。

The first and most important thing you can do is get Firefox and use firebug . 您可以做的第一件事也是最重要的事情是安装Firefox并使用firebug

This will allow you to see what requests are made to the server, how long they take, and much, much more. 这将使您了解对服务器发出了哪些请求,它们花费了多长时间以及更多。 This will give you a better understanding about the performance of the two different versions of your app. 这将使您对应用程序的两个不同版本的性能有更好的了解。

You need to better understand your problem before we can really help you. 您需要更好地了解您的问题,然后我们才能真正为您提供帮助。

Consider using the ToolkitScriptManager instead of ScriptManager, it will merge all the requests for AJAX controls in a single request. 考虑使用ToolkitScriptManager而不是ScriptManager,它将在一个请求中合并所有对AJAX控件的请求。 This will increase the performance since there are less requests. 由于请求较少,因此可以提高性能。 Also, make sure that you have set the in the WebConfig when moving to the production server. 另外,在移至生产服务器时,请确保已在WebConfig中设置了。 When debug is set to true, the performance slows down dramatically. 当debug设置为true时,性能会大大降低。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM