Delegate threading overhead in Web Page Lookup

I've done some searching but haven't quite seen the info I'm looking.

I have a web app where a user will visit a page with a QueryString parameter passing the ID of the object I should retrieve.

What I then need to do is run a number of checks to ensure the user can access that data, and also find out if another user has a lock (recorded in the DB) on that object.

Currently these searches are all performed sequentially, however I'm thinking the best option might be to use delegates to be able to fire off the three or four searches required at once then use the results as they are returned.

My implementation for this would be using a delegate(s) and calling BeginInvoke, however I'm worried the overhead of threading this may lead to no speed increases.

My research has indicated it will use the ThreadPool, so there shouldn't be too much overhead, but I'd like to know if anyone has implemented this kind of solution to a similar scenario on a high traffic site and seen good resutls from it?


The reason I'm looking to do this is we are reengineering our application from the ground up, and need to make sure we are building something that will scale considerably.

Answers


Since this is ASP.NET, unless you have low site activity (which would be contrary to "that will scale considerably") I would suggest against that idea. Your other local CPUs are already doing plenty, as is the database. I would keep it sequential, but I would look for ways to fetch all the data I need in one hit to the database.


The reason I'm looking to do this is we are reengineering our application from the ground up, and need to make sure we are building something that will scale considerably.

Scaling up does not necessarly mean that use multithreaded application , i think you should think of incresing web servers/ RAM/ CPU power etc to support incresed load.

You should think of making extensible enough to support your business changes.

Yes , you can use the technique described by yourself would work most of time as far as i know


Need Your Help

Replace specific characters in std::string with spaces

c++ string parsing stdstring

Following code removed punctuation marks correctly from char array:

Drupal aggregate css not working. All styles gone (no, it´s not a duplicate)

css drupal character-encoding compression

I´ve read this post, that has an accepted solution, wich didn´t solved my problem, so, that´s why I´m opening a new issue, because I think they are related, but certainly not the same.