By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,162 Members | 1,416 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,162 IT Pros & Developers. It's quick & easy.

Static Class, Updating DataTable and Locking?

P: n/a
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.

Jan 24 '07 #1
Share this Question
Share on Google+
1 Reply


P: n/a
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 <xrequests 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
Jan 24 '07 #2

This discussion thread is closed

Replies have been disabled for this discussion.