Closed charanpasham closed 1 year ago
I'm not exactly sure where to start on this one. The In-Memory SQL storage option does not use any stored procedures (yet... it will in the next update) so I wouldn't expect most of that linked sql script to apply other than the creation of the "ASPStateTempSessions" table. The line numbers in the json-ified stack trace don't make much sense either. But let's just ramble a bit and see if something makes sense.
By default, requests for session state should be serialized, so there is unlikely to be any conflict like this. I would assume this means the appSetting aspnet:AllowConcurrentRequestsPerSession
is set to true in this case. In which case, multiple threads racing against the session state store is expected. This is why the repositories included in this project have the retry parameters.
For in-memory tables, the retry interval should be kept low. Without knowing much about the specific usage pattern in your app, I don't really have much reason to recommend changing away from the defaults. Maybe increase the retry count a little and see if that reduces the frequency of these errors?
A couple of other things I can think of off the top of my head. The current release of this module gets added with preCondition="integratedMode"
. You might try changing that to preCondition="integratedMode,managedHandler"
to see if that reduces contention.
Also, for the memory-optimized table option, you should make sure to use "snapshot" isolation. This is not something that is enforced by the current provider.
Finally, I hope to have a refresh of this package available this month. The new memory-optimized repository will use snapshot isolation and the more limited preCondition above. It will also transition to using stored procedures instead of raw SQL statements. You might consider trying the preview release when it is available to see if it helps.
The 2.0 release is available on nuget now. It includes many updates to the in-memory SQL provider that among other things, uses stored procedures in this release. #75
We recently modified session db to use "In Memory" to improve the performance. Added the following config to the web.config file.
I am using the retry sql script from Here.
It sporadically throw this error as below.
Here is the stack trace.
I previously used the the retry=10 and RetryInterval = 100 but still throws this error. Even increasing the retry interval to 1000 didn't help. Can anyone help me to solve this issue? What am I missing?