7 Designing .NET Applications for Performance Optimization Developing performance-oriented .NET applications is not easy. The .NET standard includes only basic guidelines and interface definitions to help programmers develop .NET applications. The ADO.NET data providers do not automatically throw exceptions to say that your code is running too slowly. Designing a .NET application is a complex process, in part because the code can be very data provider-specific. If you are working with several databases, you will find that the programming concepts vary between the different data providers. You will need much more database knowledge to design your application effectively. This chapter presents guidelines compiled by examining the .NET implementations of shipping .NET applications. The guidelines discuss selecting .NET objects and methods, designing .NET applications, retrieving data, and updating data. These guidelines include: ■ Retrieving only required data ■ Selecting objects and methods that optimize performance ■ Managing connections and updates Following these general rules will help you solve some common .NET system performance problems, such as those listed in the following table: Problem Solution Network communication is slow. Reduce network traffic. See guidelines in “Retrieving Data”. Evaluation of complex SQL queries on the database is slow and can reduce concurrency. Simplify queries. See guidelines in “Simplifying Automatically-generated SQL Queries”. Excessive calls from the application to the data provider slow performance. Optimize application-to-data provider interaction. See guidelines in “Retrieving Data”. Disk input/output is slow. Limit disk input/output. See guidelines in “Using Connection Pooling”.