Today, I am talking to some friends in the MSN group about Asp.net.ProgramPerformance optimization.
Here we will summarize the optimization methods:
1. Database optimization, including table structure optimization, index optimization, SQL statement optimization, and stored procedure optimization
2. Optimized viewstate
3. Use Cache
4. generate static pages (mainly for front-end information publishing systems with poor interactivity)
5. Use the front-end IIS/Apache to process requests for static pages, images, and JS files
6. OptimizationAlgorithm
7. You are welcome to add
For performance tuning, almost all experts' suggestions are as follows: if there is no exact performance measurement, do not perform performance tuning. Optimization without benchmark performance testingCodeThere won't be any other benefit if it gets messy. The effect of increasing an algorithm from 0.1 seconds to 0.01 seconds is often overwhelmed by a bad SELECT statement.
Therefore, the previous methods are not the panacea. to optimize the system, you must first know where the system is slow. Never rush to medical treatment. The following content comes from my personal work experience. Not all systems can be applied. Please remember !!!!
The following describes the four optimization methods:
For OA/business management system applications, database optimization is often the key point for the following reasons:
1. Database crud is the most common operation for these systems.
2. operations on the database system often cause disk I/O (because the database files and logs are stored on the disk)
3. Application operations on database systems are often performed across processes or even machines. (Disk I/O + network I/O, CPU, memory, and more are beyond reach)
Therefore, these database operations are often the performance bottleneck of the entire system.
Now that we know the general direction, how can we know the slow SQL statements or stored procedures? This requires combining the database's profiler
For SQL Server, check this article.Article
Http://www.microsoft.com/china/msdn/library/data/sqlserver/Profiler.mspx? MFR = true
For Oracle, read this article.
Http://www.javaeye.com/post/117389
2. viewstate, which has a relatively large volume, has a certain impact on Internet applications. I have already talked about optimization in the garden. Search for it by yourself.
3. Use Cache
My opinion is not very consistent with some friends in the MSN group. A friend in the MSN group thinks 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 may become a performance bottleneck, because the application or cache controller must be careful to ensure that the cached content of multiple processes is consistent. This process greatly reduces the scalability of the program. Consider the Web farm of 100 servers. The cache modification in one process needs to be notified and confirmed that all the other 99 servers have been correctly changed. This is a terrible thing.
For this piece, memcache is a good solution. The famous wiki product mediawiki uses it as a cache server. Memcache also has. Net client APIs.
4. I don't know much about it.
5. There are many introductions on the Internet, especially on the Java side. Apache and tomcat have many introductions. Google it yourself.
6. This optimization is the most complex, and the effect may be the least obvious. If you have to do it, you can see it through the sea.