I can't find out the reason of the repetition of this query ? This make my site slow.

Ash
Ash
Vote:
 

I can't also trace this query in my code.

QUERY1 :- (@1 nvarchar(88),@0 datetime2(7))UPDATE [dbo].[Sessions] SET [Expires] = @0 WHERE ([SessionId] = @1)


QUERY2 :- (@p0 nvarchar(4000))SELECT TOP (2) 
    [Extent1].[SessionId] AS [SessionId], 
    [Extent1].[Created] AS [Created], 
    [Extent1].[Expires] AS [Expires], 
    [Extent1].[LockDate] AS [LockDate], 
    [Extent1].[LockCookie] AS [LockCookie], 
    [Extent1].[Locked] AS [Locked], 
    [Extent1].[SessionItem] AS [SessionItem], 
    [Extent1].[Flags] AS [Flags], 
    [Extent1].[Timeout] AS [Timeout]
    FROM [dbo].[Sessions] AS [Extent1]
    WHERE [Extent1].[SessionId] = @p0

#211419
Jan 08, 2020 7:18
Vote:
 

Hi Ash,

By the looks of the queries I'd guess you're using SQL server as a session state provider and, unfortunately, that comes with a performance cost. In the first instance I'd look at whether you really need to store sessions in SQL server. Presumably you've gone down that route because you're running your site on load balanced servers? If so, maybe you could look at using session affinity rather than round-robin load balancing which would allow you to switch to the in-memory session state provider which is much faster (though be aware that your traffic will be less evenly distributed between servers).

You could also consider your use of session state in your application. If you don't need it or can remove your reliance on it, you can switch it off entirely.

If neither of those options are viable, maybe consider using a faster out-of-process session storage mechanism like Redis or the session state service.

#211422
Jan 08, 2020 10:49
Ash
Vote:
 

Thanks, Paul.

Can you please tell me in little more detail why my system using this query again and again?

#216551
Edited, Feb 10, 2020 6:00
Vote:
 

You probably have your site configured to use database provider for session. it works with multiple-servers scenario, but as Paul mentioned, it comes at a cost, in this case, performance. You can think about cookie session, or even Redis one (more work is needed)

https://docs.microsoft.com/en-us/previous-versions/appfabric/ee790859(v%3dazure.10) 

#216554
Feb 10, 2020 8:08
Ash
Vote:
 

Thanks Quan,

But can i use sticky session(Inproc) instead of cookie session.

#216564
Edited, Feb 10, 2020 9:12
Quan Mai - Feb 10, 2020 9:14
It's one of the options, but note that sticky session is not fool-proof. Azure will try to direct requests to the previous instance that served them, but it does not guarantee so.
This topic was created over six months ago and has been resolved. If you have a similar question, please create a new topic and refer to this one.
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.