views:

196

answers:

5

Hi,

I'm creating an ASP.Net website that displays large amounts of data. The data is served to me through a data access layer. From the data I'm getting I'm building up large data tables and then displaying these using either gridview's or dynamically created web controls.

The problem I'm finding is that the website is slow when a lot of data is passed to it. I've read that data readers are the way to go but I can't use a datareader directly from the SQL table due to needing to use the data access layer.

I also don't have the option of partially filling the datatable as I need to apply a lot of sorting methods to the data to display what I need.

Any suggestions of ways to speed up data tables? or perhaps use something else that's more efficient?

A: 

Pulling 'large' amounts of data into a web application and doing sorting / filtering there is always going to be slow, depending on your definition of 'large'. If you can apply any sorting / filtering on the database server before you pull the data to your web application that should speed things up. You say you don't have the option to do this but sorting is something that database servers are made for, are you sure you can't make this work?

Steve Willcock
A: 

You can use distributed cache, to cache your data. Memcache (http://www.danga.com/memcached/) or Velocity Microsoft Distributed Cache (http://www.microsoft.com/downloads/details.aspx?FamilyId=B24C3708-EEFF-4055-A867-19B5851E7CD2&displaylang=en).

Maksim Kondratyuk
A: 

The first thing you will want to do is to pinpoint exactly what part of the process that is being slow. It might not be where you think it is. Do code profiling or timing of different parts to determine exactly how much time each piece of code consume during a request. In our case we found that the data layer (executing readers, populating object models) were really fast (with a couple of exceptions that were taken care of by indexes in the database), while we had some javascript on the client that was really slow.

So, start with measuring, then decide where to optimize.

Fredrik Mörk
Any idea where I can get a good code profiling tool? Preferably free :)
Jack Mills
Fredrik Mörk
A: 

Are you absolutely certain that the bottleneck is in the Web Application?

The first thing I would do would be to guess what the longest SQL query you execute on a slow page would be, then see how it runs in the query browser.

If it's slow, work on optimizing that.

scottschulthess
A: 

Since you are “.. building up large data tables and then displaying these using either gridview's or dynamically created web controls”, the network can be a bottleneck. See the answers to the similar SO question that may be helpful.

Vadim Kleyzit