title: SQL Server "Audit Logout" operation takes long.
body: <p>We have a stored procedure that is called about 300,000 times per day by 15 users throughout the day. I have poured through every line and it is about as efficient as I can get it.</p>
  
  <p>The stored procedure is accessed through an ASP.NET page on 4.0 from a legacy VB6 application on basic Winterms.</p>
  
  <p>When I look at the SQL trace file, I see the following:</p>
  
  <ol>
  <li>exec sp_reset_connection (Using the connection pool)</li>
  <li>Audit Login</li>
  <li>Execution of the stored procedure</li>
  <li>Audit Logout</li>
  </ol>
  
  <p>I see on step 4, the read and writes are way high, which makes sense since it's an accumulation of the connection being reused in the pool.</p>
  
  <p>What concerns me is how long it takes, sometimes at takes 50ms, and other times 400ms, it's totally random. From the docs I read "Audit Logout" is the entire duration for all three steps. But steps 1-3 were very quick, like 0-5ms. Why would the "Audit Logout" duration take so long?</p>