随笔分类 -  教你50招提升ASP.NET性能

50 Ways to Avoid, Find and Fix ASP.NET Performance Issues 翻译
摘要:Database Performance Tips for Developers对于开发人员的数据库性能技巧As a developer you may or may not need to go into the database and write queries or design tables and indexes, or help determine configuration of your SQL Server systems. But if you do, these tips should help to make that a more pain free process 阅读全文
posted @ 2013-09-04 10:39 安布雷拉 阅读(681) 评论(0) 推荐(0)
摘要:ORM TipsORM小窍门More and more people are using Object to Relational Mapping (ORM) tools to jump the divide between application code that is object oriented and a database that is storing information in a relational manner. These tools are excellent and radically improve development speed. But, there a 阅读全文
posted @ 2013-08-30 14:08 安布雷拉 阅读(438) 评论(0) 推荐(0)
摘要:(41)StringBuilder is NOT the answer for all string concatenation scenarios; String.Join could be招数41:StringBuilder不适用于所有字符串连接的场景;String.Join可能是Yes, if you are in a loop and adding to a string, then a StringBuilder *could* be most appropriate. However, the overhead of spinning up a StringBuilder inst 阅读全文
posted @ 2013-08-27 12:55 安布雷拉 阅读(398) 评论(0) 推荐(0)
摘要:(40)Take advantage of .NET 4.5 async constructs招数40:利用.NET 4.5异步结构With the arrival of .NET 4.5, writing async code correctly is easier than ever. Like any tool, it should be only applied where it makes most sense – in web use-cases this usually revolves around I/O operations (i.e. reading from disk, 阅读全文
posted @ 2013-08-22 15:12 安布雷拉 阅读(307) 评论(0) 推荐(0)
摘要:(39)Avoid using session state招数39:避免使用会话状态Where possible, you should try and avoid using session state. Whilst using one web server, performance is usually not a problem. This changes as soon as you need to scale to multiple servers, as different, and usually slower, techniques need to be used.如果可能, 阅读全文
posted @ 2013-08-20 17:27 安布雷拉 阅读(282) 评论(0) 推荐(0)
摘要:(32)Seven handy ViewState tips招数32:7条便利的ViewState技巧Every time I have to deal with a classic ASP.NET Web Forms application, one of the first things I look at is the resulting source, to check whether the DOM is a complete mess and whether the ViewState is an enormous, unnecessary blob of ugliness. Us 阅读全文
posted @ 2013-08-02 15:44 安布雷拉 阅读(382) 评论(0) 推荐(0)
摘要:(31)Know your loops招数31:认识你的循环for is the fastest way of iterating over a collection, foreach is a little slower, and LINQ queries are slowest.for是遍历集合最快的方法,foreach略慢一些,LINQ查询最慢。测试代码:using System;using System.Collections.Generic;using System.Linq;using System.Text;using System.Data;using System.Diagn 阅读全文
posted @ 2013-08-01 14:13 安布雷拉 阅读(664) 评论(1) 推荐(0)
摘要:(30)Static collections招数30:静态集合If a collection is static, make sure it only contains the objects you need. If the collection is iterated over often, then the performance can be slow if you don’t remove unnecessary objects. Objects in a collection will be held in memory, even if they have been dispos 阅读全文
posted @ 2013-07-31 13:52 安布雷拉 阅读(307) 评论(0) 推荐(0)
摘要:(29)Before tackling any website performance issue, first verify the problem isn’t on the client招数29:在处理网站性能问题前,首先验证问题是否出在客户端Traditionally, many performance problems have been rooted in either the database or application server. 习惯上,许多性能问题要么根植于数据库或者应用服务器。However, with the proliferation of advanced Ja 阅读全文
posted @ 2013-07-29 14:16 安布雷拉 阅读(255) 评论(0) 推荐(0)
摘要:(28)Don’t assume that problems can only arise from business logic招数28:不要认为问题只会从业务层产生When beginning to diagnose performance problems, we often assume the problem is in our business logic. Don’t forget that the areas of our code that provide infrastructure can cause problems as well.当开始诊断性能问题时,我们一般认为问 阅读全文
posted @ 2013-07-26 14:29 安布雷拉 阅读(286) 评论(0) 推荐(0)
摘要:(27)Throw hardware at the problem, not developers招数27:把问题仍给硬件而不是开发人员As developers, we often want to fix problems with code, but don’t be afraid to ‘put the compiler down’ and throw some hardware at the problem.作为开发人员,我们通常想通过代码解决问题,但不要害怕‘批评编译器’和把问题仍给硬件。Performance problems caused by disk I/O bottlene 阅读全文
posted @ 2013-07-25 14:30 安布雷拉 阅读(306) 评论(0) 推荐(0)
摘要:(26)Don’t underestimate the value of the UI when tackling performance problems招数26:解决性能问题时不要低估UI的价值Simple UI tricks, such as progress bars, redirecting users’ attention using animation, or placing slower loading sections at the bottom of a page or offscreen, can often ‘fix’ a performance problem wit 阅读全文
posted @ 2013-07-24 14:17 安布雷拉 阅读(330) 评论(0) 推荐(0)
摘要:(25)Use the startMode attribute to reduce the load time for your ASP.NET site招数25:使用startMode属性来减少ASP.NET站点加载时间Every time you update your site, IIS must recompile it during the first request, so the initial request takes significantly longer than subsequent ones. An easy solution is to tell IIS to a 阅读全文
posted @ 2013-07-22 14:07 安布雷拉 阅读(451) 评论(0) 推荐(0)
摘要:(19)A selection of tips招数19:精选技巧集合Including height and width in tags will allow your page to render more quickly, because space can be allocated for the image before it is downloaded.在标签中包括height和width属性会加速你的页面呈现,因为下载完成之前空间可以分配给图像。(20)Add script references at the bottom of the page, because asynchr. 阅读全文
posted @ 2013-07-19 16:24 安布雷拉 阅读(245) 评论(0) 推荐(0)
摘要:(18)When in production, carefully consider what you need to log招数18:在生产环境,仔细考虑你需要记录哪些日志Many people deploy to production without checking how logging is currently configured. It is always advisable to check whether your policy is to have logging on or off by default and, if on, what level you should 阅读全文
posted @ 2013-07-18 14:14 安布雷拉 阅读(341) 评论(0) 推荐(0)
摘要:(17)Avoid running sites in debug mode招数17:避免在调试模式下运行网站When it comes to ASP.NET, one of the most common performance blunders I see on a regular basis is accidentally or intentionally running sites in debug mode. Language-level optimizations, such as using StringBuilders, Arrays instead of Lists, Swit 阅读全文
posted @ 2013-07-17 14:07 安布雷拉 阅读(291) 评论(0) 推荐(0)
摘要:(16)Reduce the data sent across the network招数16:减少通过网络发送的数据Reducing the amount of data sent across the network can improve application performance significantly. Compressing CSS and JavaScript is possible using bundling and minification. This will reduce the number of server requests and the amount 阅读全文
posted @ 2013-07-16 14:20 安布雷拉 阅读(201) 评论(0) 推荐(0)
摘要:(15)Reduce memory leaks dramatically with the “using” statement招数15:显式的使用using语句减少内存泄露If a type implements IDisposable, wrap the use of it in a “using” statement, so that it automatically disposes of objects properly when the block exits.如果一个类实现了IDisposable接口,使用using语句包裹这个类型,以便离开语句块就能自动的释放恰当的对象。 阅读全文
posted @ 2013-07-15 13:31 安布雷拉 阅读(319) 评论(0) 推荐(0)
摘要:(14)Review what client scripts you are using招数14:检查你使用了什么客户端脚本Out of the box, many ASP.NET projects include client script libraries which you may or may not beusing. It’s always a good idea to check what you are using, and when.拿来即用,很多ASP.NET项目包括你可能会或可能不会用的客户端脚本库。检查你正在使用什么,并在需要时候使用它总是一个好的方法。 阅读全文
posted @ 2013-07-11 14:13 安布雷拉 阅读(185) 评论(0) 推荐(0)
摘要:(13)Always perform validation on the server as well招数13:总是在服务器端执行验证This isn’t exactly a performance tip but rather a security tip for when people think that they could improve performance by cutting out server-side validation. These days, client-side validation can be bypassed with ease, so you can’ 阅读全文
posted @ 2013-07-10 13:25 安布雷拉 阅读(270) 评论(0) 推荐(0)