ASP.NET - Caching frequently changing search results

Asked By Frinavale Soldevi
08-Feb-10 12:40 PM
I am maintaining a intranet web application that allows users to Search/Add/Edit items and run reports.

When the user searches for items or runs a report, the items/report-records were stored into Session so that I didn't have to recreate the data source for functions like paging, sorting, editing etc.

Whenever a user would open a new tab, I'd check to see if there were search results or a report in Session and if so I would warn the user about the possibility of messing things up in the other tab.

A new requirement has been added to the application that states that users should be allowed to work in multiple tabs.

I've modified the application so that it no longer stores the the search results and reports in Session. Instead it caches the search criteria used to generate the search results/report in ViewState and uses that to recreate the datasource each postback.

I found that when the user's search resulted in 4000+ items it took 13 seconds to run the search. That means that after the user has done the search...and if they caused a postback they'd have to wait another 13 seconds (this was particularity bad when the user does something small like sorting/paging etc).

I wasn't happy with this in the slightest but eventually I was told to leave it as it is because the user is expected to refine their search results to just a few items...in which case it took less than second to return.

I'm working on the reports right now.
Reports can be Very large (well over 4000 records) and I can see this lag-time being a problem.

I could continue to use Session to "cache" the search results and the reports...and create unique IDs for each tab.

The thing is that I'm worried about Session growing too large as multiple users may be connecting with multiple tabs, running search and reports in each tab. Session could potentially grow too large and cause the application to be recycled.

I'm considering using ASP.NET's "Cache" but from what I've been reading it's not really meant to be used with data that is frequently changing like this...it's really meant to be used in situations where the data remains constant for long periods of time and doesn't really change much.

I am looking for any input on this how I should cache these results (I'm even thinking of using an XML file server side...since I don't have access to a database)

Thanks a lot

-Frinny

On a typical day, what is the max number of simultaneous report users?  On a typical day, what is the max number of simultaneous report users?

08-Feb-10 12:47 PM
how much RAM is on the server?  Is the server used for other resource intensive sites or processes?
  Frinavale Soldevi replied to Robbe Morris
08-Feb-10 01:03 PM
This application is distributed to customers who purchase it.

I can't remember the exact system requirements that we've stated are required for the web server to have in order to run the web application but I know it's a minimum of 2GB of RAM (because that's what my DEV  machine has...)

Every server that the software is installed on is going to have a different amount of RAM though.
  Frinavale Soldevi replied to Robbe Morris
08-Feb-10 01:08 PM
Sorry I didn't answer your question completely.

Other than the 2 GB RAM, the number of concurrent users is probably going not going to be very many (this is an intranet application).

This is probably going to be limited more than usually because we have a licensing package that, to begin with, allows 5 users to be "connected" to the web application at the same time. They can purchase licenses to allow more users to connect (packages include 1 license, 10 licenses). However, the likelihood that  the number of concurrent users connected at the same time is higher than 5 is very low and it would be up to the customer's IT staff to configure IIS to allow for more connections.

The servers may be used for other websites...depending on what other websites/applications are currently being served on the customer's web server
Hmmm, let's see  Hmmm, let's see
08-Feb-10 01:58 PM

Using the ASP.NET cache is fine.  Session is faster serializing and deserializing the data though.

I think using the cache with a 2-3 minute sliding expiration, is probably the best option off the top of my head.  This would make sure that you are not leaving lots of data in memory for extended periods of time while still addressing your needs for postbacks sorting data etc...

Even at 4000+ records for larger reports, with 5-10 users you still won't come close having issues with memory.  I'd double check my queries and make 100% sure you need each and every column though.

  Frinavale Soldevi replied to Robbe Morris
08-Feb-10 02:06 PM
Thank you very much for your time!

I just have one more quick question...does Cache, like Session, also cause the application to recycle if it grows to big. I haven't really been able to find a lot of information on this type of thing...I've mainly been finding articles on how to use Cache.

Thanks again!

-Frinny
It is all held in memory, so yes that could happen  It is all held in memory, so yes that could happen
08-Feb-10 02:09 PM
For your application pool, you'd want to set your memory limit up above normal.
  Frinavale Soldevi replied to Robbe Morris
09-Feb-10 09:34 AM
Thanks again for your help Robbe
Create New Account
help
Net hi friends Any one send frequently asked Important questions in C# .Net, ADO .Net, Asp .Net and Sql Server. . . . . . . . tx in Advance. . . . . . Hi, Find this. . (B)What is an IL? (B A) What is scavenging? (B) What are different types of caching using cache object of ASP.NET? (B) How can you cache different version of same page using ASP.NET cache object? (A) How will implement Page Fragment Caching? (B) Can you compare ASP.NET sessions with classic ASP? (B) Which are the various modes of storing ASP.NET session
For Testing web application performance. . . You can use HttpWatch Handler and you can also use ASP.Net Performance Analysis tool( this you will get in Debug menu) Performance tuning can be tricky lots of components running around, like HTML client, HTTP network, Web server, middle-tier components, database components, resource-management components, TCP / IP networks, and database servers. Performance tuning depends on a lot of parameters and sometimes, by changing a single parameter, performance can increase drastically. This document lists out some tips for optimizing ASP.Net Web applications and many traps and pitfalls are discussed as follows : Tips For Web Application localOnly = ”true”> 2) Turn off Session State, if not required One extremely powerful feature of ASP.NET is its ability to store session state for users, such as a shopping cart on
Build an ASP.NET Exception Logging Framework Build a Really Useful ASP.NET Exception Engine By Peter A. Bromberg, Ph.D. Peter Bromberg If you have read some things" happen. More often that not, users see that nasty looking red and yellow default ASP.NET error page because we extra - cool developers have never even taken the time to create with it, right? Of course you can easily set up your web.config (and even IIS) to redirect to a more friendly and Really Useful (a la "Thomas the Tank Engine folder. The Really Useful Exception Engine works fine with codebehind as well as script-only ASP.NET apps. First, understand that in ASP.NET, the Global Application_Error event handler receives all
have personal computers, and those who have several thousand extra dollars apiece. " - - Dave Barry SQLITE Database Engine and ADO.NET Provider SQLite is a small C library that implements a self-contained, embeddable, zero-configuration SQL database engine. Features include: • ACID (Atomic, Consistent, Isolated, Durable) transactions. • Zero-configuration - no setup or administration needed. • Implements most of SQL92. • A complete database is stored in a single disk file. • Database files can be freely shared between machines with different byte orders. • Supports databases up to lines of C code, about 320KB code space (VS.NET C++) • Faster than other popular database engines for most common operations. • Simple, easy to use API . • An ADO.NET provider is SQLite, which is curently in Beta, makes additional improvements both in the datatypes and the Database engine / database file format. There is currently support working for the Compact Framework, I am not sure is also very fast. The only thing missing is of course, stored procedures. In a database engine that is only about 300K, that's not a major concern to me since
that is running Windows XP Pro with Service Pack 2, and I'm happy to report that, except for a couple of annoying items, it was a total "no - brainer". N has some registry settings that weren't changed to match this release, and so your IIS Properties content menu items on all your web sites and Virtual Directories won't work sites, the Default Web Site, Virtual Directories or sub-directories may cause Internet Information Server (IIS) to crash. This problem is caused by a corrupted registry key. [Oh, don't you selecting Run from the Start menu, typing regedit, clicking OK. Navigate to HKEY_LOCAL_MACHINE \ SOFTWARE \ Microsoft \ ASP.NET and locate the registry key with the name 2.0.40301.9 (pd4.040301-0900 build. There! now that we've fixed that insulting little tidbit of advice, go into IIS Manager and right click on any Web Sites, Web Site or Application node and your When it does, you'll notice something brand new has been installed: Yup! its the "ASP.NET" tab! And what it does, very conveniently, is allow you to set which version of