NAV 2016 - Limit User Sessions

nickrobbo89
Member Posts: 10
Hi,
I have recently implemented this code in an Event Subscriber, subscribing to the OnBeforeCompanyOpen event.
The aim is to limit RTC users to one session, as we believe users opening multiple sessions may be having some impact on performance.
Today whilst testing we ran into a problem. If a users session crashes, and they end the task session with Task Manger, it seems the session is not cleaned up. So therefore the user is left with no session open, but they are unable to access the RTC until someone cleans that session up.
I am wondering if anyone has any suggestions on how to handle this? Or is there an even better way to handle this?
Thanks in advance.
Nick
I have recently implemented this code in an Event Subscriber, subscribing to the OnBeforeCompanyOpen event.
The aim is to limit RTC users to one session, as we believe users opening multiple sessions may be having some impact on performance.
IF (SESSION.CURRENTEXECUTIONMODE = EXECUTIONMODE::Standard) AND (SESSION.CURRENTCLIENTTYPE = CLIENTTYPE::Windows) THEN BEGIN ActiveSession.SETRANGE("User ID",USERID); ActiveSession.SETRANGE("Client Type",ActiveSession."Client Type"::"Windows Client"); IF ActiveSession.COUNT > 1 THEN ERROR(ErrTooManyOpenSessions); END;
Today whilst testing we ran into a problem. If a users session crashes, and they end the task session with Task Manger, it seems the session is not cleaned up. So therefore the user is left with no session open, but they are unable to access the RTC until someone cleans that session up.
I am wondering if anyone has any suggestions on how to handle this? Or is there an even better way to handle this?
Thanks in advance.
Nick
0
Answers
-
Maybe the better way is to put this code in custom Codeunit where this function will be declared as Subscriber event on Codeunit 1, OnBeforeCompanyOpen event, and also I think there was the kill session code, so maybe when user open new session, always be disconnected from previous.
Best Regards0 -
There is no license issue here, and a user can only click on window at a time.
I would take my battle elsewhere, hardware first, then analysis using sql profiler, to find the real problem.
Hardware? Does the hardware really have that much of an impact? I was always under the impression that the network speed is more likely to be the issue than hardware if you have the minimum requirements for NAV?0 -
Maybe the better way is to put this code in custom Codeunit where this function will be declared as Subscriber event on Codeunit 1, OnBeforeCompanyOpen event, and also I think there was the kill session code, so maybe when user open new session, always be disconnected from previous.
Best Regards
This is already in a Custom Codeunit, and I am already subscribing to the event you mentioned. I have modified this, so it prompts the user to confirm if they want to open a new session. (If another session is found). It then loops and kills all the other sessions.0 -
Networkspeed is not imported in Rtc to the client. Only between sql and server.
Everything happens on the server, not the client.
So yes hardware is important!
Requirements depends on a lot of things. But disk performance is important for sql and memory for NAV server for caching.Follow me on my blog juhl.blog0 -
Hi,
In terms of performance problem solution, I join the previous speakers in this post.
There are couple of tools for SQL to retrieve the top10 most performance-hungry statements.
In regards to the code above,
it is not possible to identify "lost" sessions from NAV.
In the ServierTier administration you are able to configure a "Close Inactive SQL Connections". The standard value is 10 minutes. Play a little bit around with it.
Alternatively search for "session kill" here in the forum.
Of course, alternatively you could also find out, why your users are forced to end NAV using Task Manager. It's not the normal approach :-)
Good luckMy blog - https://www.HannesHolst.com/0 -
I would add a check for a flagvalue in a setup record too. This way a SUPER can override your IF and allow the user (after explaining what the heck they did...)
Maybe not a flag but let the SUPER relogin. Then check the login time+1 in your IF0
Categories
- All Categories
- 73 General
- 73 Announcements
- 66.6K Microsoft Dynamics NAV
- 18.7K NAV Three Tier
- 38.4K NAV/Navision Classic Client
- 3.6K Navision Attain
- 2.4K Navision Financials
- 116 Navision DOS
- 851 Navision e-Commerce
- 1K NAV Tips & Tricks
- 772 NAV Dutch speaking only
- 617 NAV Courses, Exams & Certification
- 2K Microsoft Dynamics-Other
- 1.5K Dynamics AX
- 320 Dynamics CRM
- 111 Dynamics GP
- 10 Dynamics SL
- 1.5K Other
- 990 SQL General
- 383 SQL Performance
- 34 SQL Tips & Tricks
- 35 Design Patterns (General & Best Practices)
- 1 Architectural Patterns
- 10 Design Patterns
- 5 Implementation Patterns
- 53 3rd Party Products, Services & Events
- 1.6K General
- 1.1K General Chat
- 1.6K Website
- 83 Testing
- 1.2K Download section
- 23 How Tos section
- 252 Feedback
- 12 NAV TechDays 2013 Sessions
- 13 NAV TechDays 2012 Sessions