I wrote my own PageStatePersister
class based on SessionPageStatePersister
which writes the most recent 10 Viewstate
s for a session to a shared disk. I figure this will scale better than keeping Viewstate
in session since all web servers have access to it, they won't have to deal with expiration, and use less memory.
When a user closes the browser it notifies the server and the server deletes those files which have not been accessed for two hours. So far so good but I'm wondering if it will be faster and more efficient to store Viewstate
in an SQL server database instead.
- Each
ViewState
file is 30k on average. - Currently it just reads a hidden field to get a Viewstate key and access the file directly and deserialize. There's no need to sort or search.
- There will be about 2000 concurrent users each hour and saving last recent 20 Viewstate sessions will be about 20k temp view files per hour.
- It must periodically iterate through files and delete the oldest file.
So which is better in this case: a flatfile system or a database?