Caching Question

  • Thread starter Thread starter Mark Whitton
  • Start date Start date
M

Mark Whitton

Hi, I am developing using ASP.Net using SQL Server and also have several
layers in between, eventually producing a custom business object that is
used to populate the web form. I don't use datasets because of performance
issues and also they just aren't proper business entities.

When it comes to updating my database I generally use an identity value and
a datetime value to avoid multiple updates. e.g. Update Customers set .....
where Id = :Id and DateModified=:DateModified.

My problem is deciding where I should store this data within the webforms
layer. I don't want to store the whole business object as the majority of
the data is displayed on the webform, and only want to store the data
necessary to allow me to update on postback. I believe Session state is
not the answer, and application state is definitely not the answer, which
leaves me with View state or cookies. The problem with both of these is
security and also performance.

I'd appreciate your thoughts.
 
This is where performance testing comes into play. I use Microsoft's Web
Stress application. You should perform multiple tests in each scenario to
see which one is best for your production environment. If storing your
object in viewstate doubles the size of the page, then it probably isn't the
answer, and I'd use session. A cookie is limited to 4KB, so that's not the
answer either. As a rule, cookies should be used only for very small pieces
of data such as identifiers. I would probably use Session OR if it was THAT
big of a deal, get the data from the database on every request.

Best regards,
Jeffrey Palermo
 
Back
Top