问题
As per the issue here: SQL Query continues running for a very long time if search term not found
I faced an issue that my Azure website hits 100% DTU very fast as soon as I publish the search feature to the public.
After further investigation, I ran the following query to show all processes on my database:
SELECT
DB_NAME(dbid) as DBName,
COUNT(dbid) as NumberOfConnections,
loginame as LoginName
FROM
sys.sysprocesses
WHERE
dbid > 0
GROUP BY
dbid, loginame
The weird thing is that in addition to the row which has my login name used in the connection string in my webapp, I see another line which shows empty login name and it has many connections which increase greatly if I enable the search feature.
Can someone please explain the empty login name?
Thank you
Update: I was also able to run the following query:
SELECT
c.session_id, c.net_transport, c.encrypt_option,
s.status,
c.auth_scheme, s.host_name, s.program_name,
s.client_interface_name, s.login_name, s.nt_domain,
s.nt_user_name, s.original_login_name, c.connect_time,
s.login_time
FROM sys.dm_exec_connections AS c
JOIN sys.dm_exec_sessions AS s
ON c.session_id = s.session_id
--WHERE c.session_id = @@SPID;
--WHERE status = 'sleeping'
ORDER BY c.connect_time ASC
Which gives the following: Please note the empty login name, I get a lot of similar connections...
来源:https://stackoverflow.com/questions/44393287/empty-login-name-when-showing-sys-processes