title: GC Issue when running tomcat with TLSv1.2
body: <p>We have been facing a performance issue with tomcat7/java8 when we run it with ssl enabled.</p>
  
  <p>We see frequent long Full GC's occurring and the other strange behavior that we observe is - the first Full GC is not able to collect much from old gen but in the second subsequent run it collects a lot of garbage and because the first Full GC is ineffective the second one is triggered with in a few minutes interval.</p>
  
  <blockquote>
    <p>2018-02-09T13:16:24.333-0800: 4230.908: [Full GC (Ergonomics) [PSYoungGen: 95848K->0K(1993216K)] [ParOldGen: 6291073K->5837813K(6291456K)] 6386922K->5837813K(8284672K), [Metaspace: 33316K->33313K(1079296K)], 6.9081824 secs] [Times: user=30.68 sys=0.33, real=6.91 secs]</p>
    
    <p>2018-02-09T13:21:02.067-0800: 4508.643: [Full GC (Ergonomics) [PSYoungGen: 91268K->0K(2000384K)] [ParOldGen: 6288350K->1355941K(6291456K)] 6379619K->1355941K(8291840K), [Metaspace: 33313K->33225K(1079296K)], 2.1279458 secs] [Times: user=13.88 sys=0.08, real=2.12 secs] </p>
    
    <p>2018-02-09T14:13:36.719-0800: 7663.294: [Full GC (Ergonomics) [PSYoungGen: 85011K->0K(2004480K)] [ParOldGen: 6288173K->5361047K(6291456K)] 6373184K->5361047K(8295936K), [Metaspace: 33251K->33251K(1079296K)], 4.8433826 secs] [Times: user=21.24 sys=0.07, real=4.84 secs] </p>
    
    <p>2018-02-09T14:23:47.153-0800: 8273.729: [Full GC (Ergonomics) [PSYoungGen: 89494K->0K(1998336K)] [ParOldGen: 6288199K->1789523K(6291456K)] 6377694K->1789523K(8289792K), [Metaspace: 33271K->33271K(1079296K)], 2.2011957 secs] [Times: user=13.46 sys=0.06, real=2.20 secs] </p>
    
    <p>2018-02-09T15:09:56.091-0800: 11042.666: [Full GC (Ergonomics) [PSYoungGen: 87639K->0K(1998848K)] [ParOldGen: 6287278K->4822169K(6291456K)] 6374918K->4822169K(8290304K), [Metaspace: 33285K->33285K(1079296K)], 4.4801296 secs] [Times: user=20.02 sys=0.08, real=4.48 secs] </p>
    
    <p>2018-02-09T15:25:38.142-0800: 11984.718: [Full GC (Ergonomics) [PSYoungGen: 84340K->0K(1997824K)] [ParOldGen: 6288212K->2259748K(6291456K)] 6372552K->2259748K(8289280K), [Metaspace: 33304K->33304K(1079296K)], 2.5007909 secs] [Times: user=14.17 sys=0.06, real=2.50 secs] </p>
  </blockquote>
  
  <p>On looking into the heap dumps we see most of the <code>byte[]</code> which are biggest consumers of heap have a immediate dominator in <code>sun.security</code> package. </p>
  
  <p>Also we have <code>sessionCacheSize="1000"</code> and <code>sessionTimeout="1"</code> but the instances of <code>sun.security.ssl.SSLSessionImpl</code> are much more than 1K and if I look at their <code>lastUsedTime</code> there are many instances which should have been garbage collected in the last Full GC. The reason we are running with small cache size and time out is because our client uses a new https request for every request. Below are our connector settings:</p>
  
  <blockquote>
    <p>
    
    <blockquote>
      <p>connectionTimeout="3600"
      executor="tomcatThreadPool"
      maxKeepAliveRequests="15" maxHttpHeaderSize="8192"
      sslEnabledProtocols="TLSv1.2"
      port="${nio.https.port}" sessionCacheSize="1000" sessionTimeout="1"
      protocol="org.apache.coyote.http11.Http11Protocol"
      scheme="https" secure="true" SSLEnabled="true" 
      keystoreFile="${user.home}/.keystore" keystorePass=""
      clientAuth="false" sslProtocol="TLS" redirectPort="${nio.https.port}"/></p>
    </blockquote>
  </blockquote>
  
  <p>Should I be updating some other connector setting for short lived session objects?</p>
  
  <p>Thank you for your help!</p>