G
Guest
Hi,
We currently have a very high volume ASP.NET application. The web server is
processing anywhere between 500-750 web hits per second. These hits include
webservices and .aspx pages. For performance reasons, we cache most
everything in a bunch of in-memory object caches. We are now looking to
scale out to multiple servers, so need to start pushing some of the data to a
database (for reasons I can't get into, use of a persisted session object is
not an option.. it is not session information that will need to be shared
across servers). Anyway, the model we are moving to is as follows:
1. We are going to start storing a number of core data in the database,
primarily in 3 tables.
2. These tables are going to be updated directly via our datalayer/ADO.NET
calls.
3. We are going to keep an in-memory snapshot of each of these tables on
each server.
4. We are going to have a background thread update this snapshot every 10
seconds. (the server app can actually survive without real-time data,
near-time 10 second works fine).
5. Because these tables can hold upwards of 10,000 rows, the update thread
is going to be doing optimized updates that query only for new data since the
last update, then merge that information with the in-memory table. Then,
every 60 seconds, we are going to do a refresh of the full table and reload
the entire thing. Again, this process works fine for us.
So, here's the question and the rub: Updates to the data aren't going to be
a problem. The application will never update the in memory table directly.
However, my concern is in the reads. While we don't do a lot of updates, the
servers are going to be accessing these in memory tables pretty much on every
one of the 750/calls per second. What I need some advice on, is what are
the best practices for retrieving information from the table to manage
concurrency, and assure that rows dont get deleted or updated while the
application tries to read information from these in-memory tables.
Should we create an interim layer that lets the app query the in-mem table
and return a DataRow? should it be a copy of the DataRow or the original?
should it return variable data (not in a DataRow format) so we don't have to
worry about access? What portions of the table access, searching, DataRow
information gathering should we place lock() around? do we have to lock the
entire table? etc. etc.
Any suggestions would be incredibly helpful.
thanks,
Jasen
We currently have a very high volume ASP.NET application. The web server is
processing anywhere between 500-750 web hits per second. These hits include
webservices and .aspx pages. For performance reasons, we cache most
everything in a bunch of in-memory object caches. We are now looking to
scale out to multiple servers, so need to start pushing some of the data to a
database (for reasons I can't get into, use of a persisted session object is
not an option.. it is not session information that will need to be shared
across servers). Anyway, the model we are moving to is as follows:
1. We are going to start storing a number of core data in the database,
primarily in 3 tables.
2. These tables are going to be updated directly via our datalayer/ADO.NET
calls.
3. We are going to keep an in-memory snapshot of each of these tables on
each server.
4. We are going to have a background thread update this snapshot every 10
seconds. (the server app can actually survive without real-time data,
near-time 10 second works fine).
5. Because these tables can hold upwards of 10,000 rows, the update thread
is going to be doing optimized updates that query only for new data since the
last update, then merge that information with the in-memory table. Then,
every 60 seconds, we are going to do a refresh of the full table and reload
the entire thing. Again, this process works fine for us.
So, here's the question and the rub: Updates to the data aren't going to be
a problem. The application will never update the in memory table directly.
However, my concern is in the reads. While we don't do a lot of updates, the
servers are going to be accessing these in memory tables pretty much on every
one of the 750/calls per second. What I need some advice on, is what are
the best practices for retrieving information from the table to manage
concurrency, and assure that rows dont get deleted or updated while the
application tries to read information from these in-memory tables.
Should we create an interim layer that lets the app query the in-mem table
and return a DataRow? should it be a copy of the DataRow or the original?
should it return variable data (not in a DataRow format) so we don't have to
worry about access? What portions of the table access, searching, DataRow
information gathering should we place lock() around? do we have to lock the
entire table? etc. etc.
Any suggestions would be incredibly helpful.
thanks,
Jasen