View in flat files vs viewstate in SQLserver

I wrote a class of its own PageStatePersister

on the basis of SessionPageStatePersister

which records the last 10 Viewstate

for the session to a shared drive. I suppose this would be better than saving Viewstate

to the session, since all web servers have access to it, they don't have to deal with expiration and use less memory.

When the user closes the browser, he notifies the server, and the server deletes those files that have not been accessed for two hours. So far so good, but I'm wondering if it would be faster and more efficient to store Viewstate

in a SQL Server database.

  • Each file is Viewstate

    on average 30k.
  • Currently, it just reads the hidden field to get the Viewstate key and access the file directly and deserialize. There is no need to sort or search.
  • There will be about 2,000 concurrent users every hour, and the last 20 last ViewState sessions will be saved at about 20,000 tempo files per hour.
  • It should periodically iterate over files and delete the oldest file.

So which is better in this case: flatfile system or database ?

+2


source to share


1 answer


This would greatly improve the storage of ViewState in SQL Server. If you end up wanting to increase from the last 10 to the most recent 50, for example, that would be a relatively trivial increase in DB load. Disk I / O should generally be avoided, if possible, more than DB I / O. Cleanup operations will also perform much better, as searching through the wasteland for files left behind on disk is probably much harder than WHERE DateInserted > 20 minutes ago

.



+3


source







All Articles