title: StateServer - System.Web.HttpApplication.BeginRequest SLOW
body: <p>I have got 8 application (VB.NET)  my server running with SQL Server 2008 R2. Each application with a database. Applications are on a server and the database on another server.</p>
  
  <p>Just to let you know: </p>
  
  <p>The server database is on average 30% of CPU  use and the application server has on average 60% of CPU  use.</p>
  
  <p>2 servers with the same configurations. Basic configurations:</p>
  
  <ul>
  <li>8CPUs</li>
  <li>30GB Memory Ram</li>
  <li>Windows Server 2008 R2</li>
  </ul>
  
  <p>We monitor the system 24 hours with the NewRelic. And the big problem: the NewRelic always points to a slowdown caused by "<strong>System.Web.HttpApplication.BeginRequest()</strong>".</p>
  
  <p><img src="https://i.stack.imgur.com/5OLNl.png" alt="enter image description here"></p>
  
  <p>In the second image, we can see that the problem is: "<strong>Application code ( System.Web.HttpApplication.BeginRequest())</strong>"</p>
  
  <p><img src="https://i.stack.imgur.com/DvG5J.png" alt="enter image description here"></p>
  
  <p>I searched a lot on internet and found that maybe it has to do with "sessionState". I use "StateServer"  all the eight applications. (The reason to use "StateServer" was that the applications would be faster.)</p>
  
  <p>Follow the "sessionState" configuration:</p>
  
  <pre><code>&lt;sessionState
        cookieless="UseCookies"
        cookieName=".authz"
        mode="StateServer"
        regenerateExpiredSessionId="true"
        stateConnectionString="tcpip=127.0.0.1:42424"
        timeout="20"
        useHostingIdentity="true" /&gt;
  </code></pre>
  
  <p>And everywhere, where I put the object  the session, I use "<strong>Serializable()</strong>". Example:</p>
  
  <pre><code>&lt;Serializable()&gt; Public Class Example
  </code></pre>
  
  <p>Anyway, I wanted to explain the situation to you guys. What can I do to make it faster and solve this problem? Thank you</p>