Today I was talking with some friends in MSN Group about performance optimization of ASP.net programs.
Now let’s summarize the optimization methods:
1. Database optimization, including table structure optimization, index optimization, SQL statement optimization, and stored procedure optimization
2. Optimize ViewState
3. Use caching
4. Generate static pages (mainly for the front-end of information publishing systems that are not very interactive)
5. Use front-end IIS/Apache to handle requests for static pages, pictures, and js files
6. Optimization algorithm
7. Everyone is welcome to add
. Regarding performance tuning, the advice of almost all experts is: If there is no exact performance measurement, don’t perform performance tuning. Tuning without benchmark performance testing will basically have no other benefits except making the system code messy. The effect you get by working hard to improve an algorithm from 0.1 seconds to 0.01 seconds will often be lost to a bad select statement. Completely submerged.
Therefore, the previous methods are not a panacea. To tune, you must first understand where the system is slow. Never seek medical attention in a hurry. The following content comes from my personal work experience, not all systems can be applied, please remember! ! ! !
Let’s analyze these four tuning methods:
For OA/business management system type applications, database optimization is often a key point for several reasons:
1.CRUD on the database is the most common operation in these systems.
2. Operations on the database system often cause disk I/O (because database files and logs are saved on disk)
3. Application operations on the database system are often cross-process or even cross-machine. (Disk I/O + network I/O, no matter how fast the CPU is or how much memory is, it is beyond our reach)
Therefore, these operations on the database are often the performance bottleneck of the entire system.
So, knowing this general direction, how to know which SQL or stored procedures are slow? This requires combining the profiler of the database.
For SQL Server, you can read this article.
http://www.microsoft.com/china/msdn/library/data/sqlserver/Profiler.mspx?mfr=true
For Oracle, you can read this article
http://www.javaeye.com/post/117389
2. ViewState, this Dongdong is relatively large in size and will have a certain impact on Internet applications. Regarding its optimization, the garden has already talked about it, so you can search it yourself.
3. My opinion on using cache is not very consistent with that of several friends in MSN Group. A friend in the MSN Group believes that the cache can be a set of static variables, or some variables controlled by a cache controller. I personally think that such a cache may have good performance in a single-server environment. In a multi-server environment, such a cache will become a performance bottleneck, because the application or cache controller needs to carefully ensure the cache content of multiple processes. consistent. This process greatly reduces the scalability of the program. Consider a Web Farm with 100 servers. A cache modification in one process requires notification and confirmation that the remaining 99 servers have been changed correctly. This is a terrible thing.
For this, memcache is a relatively good solution. The famous wiki product mediawiki uses it as a cache server. Memcache also has a .net client api.
4. I don’t understand it very well, please give some advice from experts
. 5. There are many introductions on the Internet, especially on Java. There are many introductions on apache with tomcat. Google it yourself.
6. This optimization is the most complicated, and the effect may be the least obvious. If you must do it, then let the eight immortals cross the sea and show their magical powers.
http://www.cnblogs.com/ncindy/archive/2006/11/07/553533.html