title: OrientDB - Maximum pool size reached for given partition
body: <p>Team,</p>
  
  <p>We have a Single Page Web App which uses set of REST APIs. The REST API layer is based on <a href="https://jersey.java.net/" rel="nofollow">Jersey</a> which merely calls the OrientDB REST APIs. We call OrientDB functions via the OrientDB REST APIs.</p>
  
  <p>We use OrientDB 2.0.15</p>
  
  <p>OrientDB continuously throws the following error, even with very little number of connections</p>
  
  <pre><code>[OClientConnectionManager]Caught exception
  java.lang.IllegalStateException: You have reached maximum pool size for given partition
          at com.orientechnologies.common.concur.resource.OPartitionedObjectPool.acquire(OPartitionedObjectPool.java:100)
          at com.orientechnologies.orient.core.command.script.ODatabaseScriptManager.acquireEngine(ODatabaseScriptManager.java:91)
          at com.orientechnologies.orient.core.command.script.OScriptManager.acquireDatabaseEngine(OScriptManager.java:196)
          at com.orientechnologies.orient.core.command.script.OCommandExecutorFunction.executeInContext(OCommandExecutorFunction.java:72)
          at com.orientechnologies.orient.core.metadata.function.OFunction.executeInContext(OFunction.java:148)
          at com.orientechnologies.orient.server.network.protocol.http.command.all.OServerCommandAbstractLogic.execute(OServerCommandAbstractLogic.java:66)
          at com.orientechnologies.orient.server.network.protocol.http.ONetworkProtocolHttpAbstract.service(ONetworkProtocolHttpAbstract.java:176)
          at com.orientechnologies.orient.server.network.protocol.http.ONetworkProtocolHttpAbstract.execute(ONetworkProtocolHttpAbstract.java:581)
          at com.orientechnologies.common.thread.OSoftThread.run(OSoftThread.java:69)
  </code></pre>
  
  <p>We've the following properties setup</p>
  
  <pre><code>&lt;properties&gt;
      &lt;entry value="50" name="db.pool.min"/&gt;
      &lt;entry value="500" name="db.pool.max"/&gt;
      &lt;entry value="false" name="profiler.enabled"/&gt;
      &lt;entry value="info" name="log.console.level"/&gt;
      &lt;entry value="fine" name="log.file.level"/&gt;
      &lt;entry value="10000" name="storage.record.lockTimeout"/&gt;
  &lt;/properties&gt;
  </code></pre>
  
  <p>We assume <code>db.pool.min</code> and <code>db.pool.max</code> set the minimum and maximum db instances the server handles.</p>
  
  <p>We also tried with the following properties;</p>
  
  <blockquote>
    <ol>
    <li><strong>db.pool.idleTimeout</strong> - Assuming this is "The timeout for checking of free database in the pool". Set this to 5000</li>
    <li><strong>db.pool.idleCheckDelay</strong> - Assuming this is the "Delay time on checking for idle databases". Set this to 5000</li>
    </ol>
  </blockquote>
  
  <p>(Note: The above assumptions were taken based on <a href="https://github.com/orientechnologies/orientdb/blob/master/core/src/main/java/com/orientechnologies/orient/core/config/OGlobalConfiguration.java#L196" rel="nofollow">OGlobalConfiguration.java</a>)</p>
  
  <p>We would like to understand the following;</p>
  
  <ol>
  <li>How to overcome the above issue</li>
  <li>How to tune OrientDB REST APIs for a heavy load</li>
  </ol>
  
  <p>Thanks.</p>