Is It a Problem?
Not at normal volumes. A logon call is cheap when Active Directory is healthy, and on many servers this wait is zero. It is worth a look when the count climbs, meaning something logs on as a stored Windows identity very often, or when the average time per call rises, which points at slow domain controllers in the same way as PREEMPTIVE_OS_AUTHENTICATIONOPS. Get Wait Statistics does not filter it out, so if it ranks, you will see it.
What It Means
Microsoft lists PREEMPTIVE_OS_LOGONUSER as internal use only in sys.dm_os_wait_stats. The name is the Windows LogonUser function, which checks a user name and password and returns a logon token, and the thread runs in preemptive mode, outside SQL Server’s scheduler, until Windows answers.
SQL Server needs that call when it has to act as a Windows identity whose password it holds. The clearest documented example is xp_cmdshell run by a non-sysadmin, which runs under the proxy account set with sp_xp_cmdshell_proxy_account; when that logon fails, the error names LogonUserW. There is no published full list of callers.
When It Does Matter
When it ranks over an interval rather than the cumulative totals, compare the count and the average per call. The baseline to monitor is the average; a rising count with a steady average means a caller has become busier, and a rising average means the domain controllers are slow. While it is happening, sys.dm_exec_requests shows the session in the call:
SELECT
r.session_id,
r.wait_type,
r.wait_time AS wait_ms,
s.login_name,
s.program_name,
t.text AS running_sql
FROM sys.dm_exec_requests AS r
JOIN sys.dm_exec_sessions AS s ON s.session_id = r.session_id
OUTER APPLY sys.dm_exec_sql_text(r.sql_handle) AS t
WHERE r.wait_type LIKE N'PREEMPTIVE_OS_%'
ORDER BY r.wait_time DESC;
For a busy caller, look at what runs xp_cmdshell under the proxy and how often. For a slow average, hand the numbers to whoever runs Active Directory. Frequent use of a stored credential is also worth knowing about from a security point of view, and Get Audit Specifications, DDL Triggers, and Proxy Credentials lists the credentials on the instance.
The PREEMPTIVE_OS Security and Directory Waits
Each of these is SQL Server calling out to Windows for authentication or directory work, and many of those calls go to a domain controller. They tend to rise together when AD is slow. If one is near the top of your waits, read it next to the waits that usually matter.
- PREEMPTIVE_OS_AUTHENTICATIONOPSAuthentication. Windows security calls made while authenticating logins and building tokens.Worth a look when it climbs
- Group Lookup waitsGroup membership. NETGROUPGETUSERS, NETUSERGETGROUPS and the other calls that ask Windows who belongs to which group.Worth a look when it climbs
- PREEMPTIVE_OS_LOOKUPACCOUNTSIDSID to name. Translating a security identifier into an account name, often via a domain controller.Worth a look when it climbs
- PREEMPTIVE_OS_DSGETDCNAMEFinding a DC. Locating a domain controller before the directory question can be asked.Worth a look when it climbs
- PREEMPTIVE_OS_LOGONUSERLogon as a stored identity. The Windows LogonUser call, used when SQL Server must log on with a stored Windows credential.Worth a look when it climbs. This page.
- Security waitsOther security APIs. The AUTHZ and security context calls that do not have a page of their own.Worth a look when it climbs
- Crypto waitsCryptography. Windows crypto API calls, for certificates, keys and TLS.Usually noise
Where To Go Next
PREEMPTIVE_OS_LOGONUSER is usually small or zero. If you are chasing a real problem, start with the waits that cost you time.
- The waits that usually matter, ranked, with what each one is telling you.
- PREEMPTIVE_OS_AUTHENTICATIONOPS, the authentication wait to read alongside this one.
- Performance & Troubleshooting, the scripts and guides for this part of the stack.
Leave a Reply