Slow at start (v8.5.8)
captnjosh opened this issue · 0 comments
Hello,
Thx very much for ur third party. Really simple to implement and make it work.
I've implemented SqlTabledependency in our Asp.Net Core 3.1 API / SQLServer 2012 coupled with SignalR.
I am experiencing slow response from the API on start of the 2 webapps (UI and API). Either I get a timeout or either late response that I didn't have before implementation, and that is not systematic.
Once my UI and API started, I see the created "trigger" under each table.
I have 2 "RecordChanged" events defined like this:
Expression<Func<DispatchJobDependency, bool>> expression = p => (p.RouteId != null) && ((p.DispatchJobType == "DN") || (p.DispatchJobType == "CI") || (p.DispatchJobType == "LOD"));
ITableDependencyFilter whereCondition = new SqlTableDependencyFilter<DispatchJobDependency>(expression);
_dispatchJobDependency = new SqlTableDependency<DispatchJobDependency>(appSettings.DataDbConnection, "DispatchJobs", filter: whereCondition, includeOldValues: true);
NB 1. The fields RouteId+DispatchJobType with criteria are indexed.
NB 2. Currently has 20 000 rows.
NB 3: This table will grow @ 1 000 rows/day.
Expression<Func<RouteDependency, bool>> expression = r => (r.Name.Substring(1,3) != "BTY") ;
ITableDependencyFilter whereCondition = new SqlTableDependencyFilter<DispatchJobDependency>(expression);
_routeDependency = new SqlTableDependency<RouteDependency>(appSettings.DataDbConnection, "Routes", filter: whereCondition, includeOldValues: true);
NB 1: Field Name is not indexed.
NB 2: Currently has 440 rows.
NB 3: This table will grow @ 800 rows/day.
Both work very fine when I insert, update or delete data in each respective tables.
SignalR connects instantly in UI web page.
However, on load of default UI page, an Ajax/API request to get "todays" data (about 5-10 rows) takes over 30 seconds when it used to be instantaneous before implementing SqlTableDependency.
Any idea or suggestions?
Thx