I've inherited a solution to support based on .NET and SQL Server 2008 R2.
The architecture is such that all clients must be kept in step with each other, and this is handled by a winsock hub to which each client sends and receives notifications of changes made. These notifications are in the form of a type of update and a key field.
On receipt of a notification, client windows inspect the type of update and if they think they are interested then issue a database command (Stored procedure) to retrieve the latest data for that key value. The stored procedure typically invoked links a number of tables to return a rather large object.
My problem is that when many clients are active, they are calling the same stored procedure at the 'same' time and dragging perforamnce down eg a < 1 second query, when called in isolation can take c20 seconds as it presumably waits for other clients to complete.
Is there anything out of the box in SQL server that can help me with this? I'm thinking of caching of results or ways in which I can stop one query blocking another?
I appreciate that I should probably make some changes on the client code and notification process to pass around fully populated objects so removing the need to interrogate the database multiple times. However this is a legacy application with a limited lifespan, which would be a headache to upgrade in such a significant way. If there were a nice simple switch in SQL server I could use, that would buy me the time I need!
Thanks, Andrew
Tips to keep in mind:
Locked types can be:
If nothing works you can try analyzing query plans but you indicated performance is good when you are in an isolated environment and query this procedure.
Another performance issue, your tempdb database can be overloaded by temporary tables if it's not optimized. Run a profiler to analyze what's happening. Filter only the stored procedure you need to evaluate results.
I will add more information in case something else comes up to my mind.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.