title: Facing issue with large number of connections open in cassandra
body: <p>Datastax driver: We are running into a serious issue of holding up lot of connections. We have no clue where these connections are created.</p>
  
  <p>I will first tell you about my context:</p>
  
  <ol>
  <li>We use datastax driver to connect to Cassandra. </li>
  <li>We just create one session for an app and use it for the app liefetime.</li>
  <li>We create keyspace to isolate each dev environment. So people can create keyspace when they require.</li>
  </ol>
  
  <p>Frequently the Cassandra server goes down. When we looked at the issue when it is slow or down, the cluster seems to have lot of incoming connections from several dev environment.</p>
  
  <p>Ideally our expectation is there should be 6-10 connections from a single dev environment. But we see a few thousands.</p>
  
  <p>We see these kind of logs.</p>
  
  <pre><code>-- [com.datastax.driver.core.ControlConnection] (Cassandra Java Driver worker-6315) [Control connection] Connection error while refreshing schema Write attempt on defunct connection)
  
  -- [com.datastax.driver.core.ControlConnection] (Cassandra Java Driver worker-6314) [Control connection] Refreshing schema for XXXX 
  </code></pre>
  
  <p>We see lots of Cassandra Java Driver worker threads.</p>
  
  <p><code>XXXX</code> is some random keyspace in the cluster.</p>
  
  <p>Any idea to where the problem could be?</p>