Can you please help me with deciding which one of the following scenarios will work the best.
I have 3 user controls. Each control needs to generate content based on the results of SQL Server query, for example user control #1 populates a gridview with the output of a query.
I want to make use of Caching in order to reduce round-trips to my SQL Server Database. I came up with the following two solutions, and would like to know which one will work the best.
Scenario #1:
Put all 3 user control's queries in a single SQL Server Stored procedure (Batching), execute the stored procedure outside of the User Controls inside the containing page, and then provide each user control with its query output.
Round-trips to the database will be reduced by placing all 3 queries in a single stored procedure.
Caching in this scenario will happen by caching the output of the stored procedure.
Therefore, the output of the stored procedure will be taken from memory each time to provide each user control with its output, after which each user control will generate its output.
About 188 different versions of the query will be cached by ASP.NET object caching.
Scenario #2:
Query the SQL Server database individually inside of each User Control, and then generate each user control's output with the query results that each one obtained. This means that each user control will individually call the SQL Server Database. Caching in this scenario will happen by caching the output of each user control, thus the user controls won't have to generate its output every time, and can get its output directly from memory. The catch in this scenario is that I will have to cache about 188 different versions of one or more of the user controls.
Thanks in advance