title: How can I increase server SSL performance
body: <p>I've enabled SSL on my proxy server and found that the performance has dropped from around 17k requests per second to 5k request per second.  I followed the code in Netty's secure chat example and I don't think I've done anything differently.</p>
  
  <p>I've written a dummy server to see if I've made some mistakes on my proxy.  Running the dummy SSL server in normal http mode is capable of around 50k request per second.  When I enable SSL on the dummy server that drops to 28k requests per second.</p>
  
  <p>Is there anything I'm doing wrong?  Is there something I'm missing?</p>
  
  <p>I'm using JDK 6 to compile the code, running on JDK 7u4.  I'm using Netty-3.5.0 as well.
  I'm using zeusbench to run the test.  The test parameters are: zeusbench -n 10000 -c 100 -k -C RC4_SHA "https:///"</p>
  
  <p>Source: <a href="http://pastebin.com/iahqr3zT" rel="nofollow">http://pastebin.com/iahqr3zT</a></p>
  
  <p><strong>Edit 1:</strong> I've run the dummy server through JProfiler.
  The SSLContext.createSSLEngine call in the pipeline factory takes (on average) 55,005 microseconds (that average has been calculated from 540 invocations of the method).</p>
  
  <p>The SslHandler.handshake call in channelConnected takes (on average) 46,284 microseconds (that average has been calculated from 540 invocations of the method).</p>
  
  <p>I understand there isn't much Netty can do about the call to createSSLEngine, but could the SslHandler.handshake be tuned any better?  Its taking almost as long as the generation of the engine itself.</p>