Static Class, Updating DataTable and Locking?

  • Thread starter Thread starter Mark S.
  • Start date Start date
M

Mark S.

Hello,

My c# aspx 2.0 web application has a static class. I would like to add a
dataTable to it and have the heavy load (+100 requests a second) update it's
values. This is the first time I used dataTable in a heavy load app and I'd
really appreciate any advice. With my pre-existing static collections I use
sync lock, will I need to do the same for the datatable, and if so please
point me to some documentation, I can't seem to find it in VS2005 docs or
Google.

Thank you.
 
My advice: avoid stateful web programming, especially with statics.
That is what a database is for.
Reasons:
* Contention: You are goinng to have some interesting lock contention
here; even with a reader-writer lock it will be interesting; RDBMS, on
the other hand are designed to support correct, granular locking at
different levels
* Scalability: This only scales to a single app-domain if you don't
want multiple (different) versions of the data - it can't be clustered
* Persistance: when are you going to commit it to disk? Bearing in
mind that the web-server could tear down the app-domain for no reason
at any time (IIS does this every <x> requests etc). You could lose
data.

My advice: use a database and appropriate SQL that acts on the minimal
row-set for the current request, but respects locking (e.g. use a
TransactionScope with serialable isolation).

Marc
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top