We all know that the use of cache can greatly improve the Asp.net ApplicationProgramSo how much performance can be improved? I did a small test.
1. Create a new Web Application in vs2003 and add a DataGrid Control on the page to display the content of the Employees table in the northwind database in the DataGrid. My practice is to create a connection to the northwind database in the server resource manager of vs2003, and then
Drag a table to the page,
[Of course, there are other methods to connect to the database ].
In this way, sqldataconnection1 and sqldataadapter1 are automatically generated. Right-click sqldataadapter1 and click Generate dataset. The dataset dataset11 is generated according to the wizard.
2. Double-click the page to enter the. CS file (I use the C # Language). First import the namespace, and then write the following in page_load:Code:
Press F5 to view the data in the Employees table in the DataGrid Control.
3. After the test is completed, open the test tool-Microsoft Application Center Test
Open the test tool, click new project under the file to create a new test project, right-click the new test project, and complete the test according to the wizard. The cache is not used on the page. You can see the obvious difference. To use the page cache method, switch the page to the HTML code mode and add the outpurcache command on it.
For example: % @ outputcache duration = "60" varybyparam = "NONE" %
The following two figures show the comparison of results before and after the cache is used.
Before use:
After use:
Obviously, the page cache and performance are improved by more than 4 times.