Search code examples
asp.netdatasetdata-accesssystem.data.datatable

Data Access ASP.NET


I built an online news portal before which is working fine for me but some say the home page is slow a little bit. When I think of it I see a reason why that is.

The home page of the site displays

  1. Headlines
  2. Spot news (sub-headlines
  3. Spots with pictures
  4. Most read news (as titles)
  5. Most commented news (as titles)
  6. 5 news titles from each news category (11 in total e.g. sports, economy, local, health etc..)

now, each of these are seperate queries to the db. I have tableadapters datasets and datatables (standard data acces scenarios) so for headlines, I call the business logic in my news class that returns the datatables by the tableadapter. from there on, I either use the datatable by just binding it to the controls or (most of the time) the object converts it to a list(of news) for example and I consume it from there.

Doing this for each of the above seems to work fine though. At least it does not put a huge load. But makes me wonder if there is a better way.

For example, the project I describe above is a highly dynamic web site, news are inserted as they arrive from agencies 24 hours non-stop. so caching in this case might not sound good. but on the other hand, I know have another similar project for a local newspaper. The site will only be updated once a day. In this case: Can I only run one query, that would return a datatable containing all the news items inserted for today, then query that datatable and place headlines, spots and other items to their respective places on the site? Or is there a better alternative around? I just wander how other people carry out similar tasks in the most efficient way.


Solution

  • I think you should use FireBug to find out what elements are taking time to load. Sometimes large images can ruin the show (and the size of the image on screen isn't always relative its download size).

    Secondly you could download the Yahoo Firefox plugin YSlow and investigate if you have any slowing scripts.

    But Firebug should give you the best review. After loading Firebug click on the 'Net' tab to view the load time of each element in the page.