Impact of Caching

9/25/2010 11:34:52 AM
If you included the Trace statements in the GetInventory method, you can surf to the trace page to see the effect of caching. The UseDataCaching application included here has the Trace attribute turned off in the page but has application tracing turned on. That is, the web.config includes the following section:
<trace enabled="true" />

You can see the trace information by surfing to the virtual directory with a file name of Trace.axd. Instead of surfing to the UseDataList.aspx file, surf to the Trace.axd file in the same directory.

Figure 1 shows the trace statements produced by accessing the page for the first time. The column farthest to the right indicates the time elapsed since the previous trace statement. The trace statement shows that more than 0.016 seconds has elapsed during the page loading time.

Figure 1. Hitting the database takes more than half a second in this scenario.

Make a few more posts to the page (for example, add some items from the inventory to the selected items grid). Then, go back and look at the tracing information for the subsequent postbacks. Figure 2 shows some examples of trace statements. Fetching from the Cache is dramatically faster than hitting the database—by several orders of magnitude! Again, you might not notice the difference with just one client surfing the page every once in a while. However, when multiple clients are surfing to the same page simultaneously, they'll get their responses much more quickly than if the page had to make a round-trip to the database.

Figure 2. Fetching data from the cache takes 0.000040 seconds.

Most View
Windows 7 : Zero Touch Installations - Deploying Windows 7 (part 2) - Edit the Deployment Task Sequence
Samsung Galaxy Note 10.1 - The Company’s New Flagship Slate
Naim Nait 5si - The Latest Naim Integrated Amplifier (Part 2)
Windows 7 : Maintaining Your Hard Drive
Sony Vaio Duo 11 - Latest Touchscreen-Enabled Ultrabook
Lenovo IdeaTab Lynx - A Pretty Nice Windows 8 Tablet (Part 2)
SQL Server 2005 : Working with SQL Server Management Objects in Visual Studio (part 1) - Iterating Through Available Servers
Windows 7 : Designing a Client Hardware Platform (part 1)
Adobe Flash Professional CS5 : Creating Frame-by-Frame Animation - Clearing Keyframes Versus Removing Frames
Windows Tip Of The Month – October 2012 (Part 2)
Top 10
Sharepoint 2013 : Farm Management - Disable a Timer Job,Start a Timer Job, Set the Schedule for a Timer Job
Sharepoint 2013 : Farm Management - Display Available Timer Jobs on the Farm, Get a Specific Timer Job, Enable a Timer Job
Sharepoint 2013 : Farm Management - Review Workflow Configuration Settings,Modify Workflow Configuration Settings
Sharepoint 2013 : Farm Management - Review SharePoint Designer Settings, Configure SharePoint Designer Settings
Sharepoint 2013 : Farm Management - Remove a Managed Path, Merge Log Files, End the Current Log File
SQL Server 2012 : Policy Based Management - Evaluating Policies
SQL Server 2012 : Defining Policies (part 3) - Creating Policies
SQL Server 2012 : Defining Policies (part 2) - Conditions
SQL Server 2012 : Defining Policies (part 1) - Management Facets
Microsoft Exchange Server 2010 : Configuring Anti-Spam and Message Filtering Options (part 4) - Preventing Internal Servers from Being Filtered