473,396 Members | 1,713 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Static Class, Updating DataTable and Locking?

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
1 2751
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

9
by: Simon Harvey | last post by:
Hi all, In my project I have made a number of helper methods static. As I understand it, this will create the problem that multiple threads could access the static method at the same time and...
5
by: Mountain Bikn' Guy | last post by:
How would I do this? public sealed class UtilityClass { public static MyObject Object1;//see note below about importance of static object names in this class public static MyObject Object2;...
3
by: Tc | last post by:
Hi, I was curious, I am thinking of writing an application that loads a dataset from a database that resides on a server. The question I have is this, if multiple copies of the app will be...
10
by: McFly Racing | last post by:
Thread Locking In Static Methods I have the need for a Log Manger class that has static methods. Normally I would use the lock statement or a Monitor statement both of which take a...
9
by: Laban | last post by:
Hi, I find myself using static methods more than I probably should, so I am looking for some advice on a better approach. For example, I am writing an app that involves quite a bit of database...
2
by: Vivek Ragunathan | last post by:
Hi Are the members in a static class in C# class synchronized for multiple thread access. If yes, are all static members in a C# class auto synchronized ? Regards Vivek Ragunathan
14
by: Mark S. | last post by:
Hello, I've written a high performance web app with C# and it completely relies on static hash tables (using sync) and classes. Under real world stress this app is handling 5 get requests per...
1
by: richard.hallgren | last post by:
Hi, I have a static method that I use for data access. This particular method reads x number of rows and then updates these rows with a read = 1 flag. I access this method with several threads...
5
by: Dave | last post by:
Hello, Suppose you have a class with a static property with only a get (read only). You also have code in a static constructor that sets these properties but takes 1 hour to run. Now suppose...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.