Hi, we're facing the issue in subject with a two instances cluster (servers 
started with dserver.sh), database plocal graph, using Java OrientDB 
Blueprints implementation apis (orientdb-graphdb 1.7.9), s.o. Centos 6.   
 We want them work in a master-master replica with a balancer (HAProxy) 
that sends requests to one of the two and in case of connection lost 
switches to the other.   We prefer to stay on 1.7.9 stable release instead 
of upgrating to 2.0 because we're going live in production.

Issue: the number of concurrent connections (OrientDB studio -> Server 
management -> Storage) increases every db operation till it reaches the max 
blocking every new operation; the number of connection increases on both 
the instances and after having shutdown the application that contacts the 
db the number of connections doesn't decrease.
No problems with single instance mode (server started with server.sh) and 
same code (see below).

-- error:
2014-11-03 09:44:51:159 WARN Reached maximum number of concurrent 
connections (1000), reject incoming connection from /xxx.xxx.xxx.xxx:yyyyy 
[OServerNetworkListener]
...

Configuration:   

- orientdb-dserver-config.xml:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<orient-server>
    <handlers>
        <!-- GRAPH PLUGIN -->
        <handler 
class="com.orientechnologies.orient.graph.handler.OGraphServerHandler">
            <parameters>
                <parameter name="enabled" value="true"/>
                <parameter name="graph.pool.max" value="256"/>
            </parameters>
        </handler>
        <!-- CLUSTER PLUGIN, TO TURN ON SET THE 'ENABLED' PARAMETER TO 
'true' -->
        <handler 
class="com.orientechnologies.orient.server.hazelcast.OHazelcastPlugin">
            <parameters>
                <parameter name="nodeName" value="IntrepidDB1" />
                <parameter name="enabled" value="true"/>
                <parameter name="configuration.db.default"
                          
 value="${ORIENTDB_HOME}/config/intrepid-distributed-db-config.json"/>
                <parameter name="configuration.hazelcast" 
value="${ORIENTDB_HOME}/config/hazelcast.xml"/>
                <parameter name="conflict.resolver.impl"
                          
 
value="com.orientechnologies.orient.server.distributed.conflict.ODefaultReplicationConflictResolver"/>

                <!-- PARTITIONING STRATEGIES -->
                <parameter name="sharding.strategy.round-robin"
                          
 
value="com.orientechnologies.orient.server.hazelcast.sharding.strategy.ORoundRobinPartitioninStrategy"/>
            </parameters>
        </handler>
        <!-- AUTOMATIC BACKUP, TO TURN ON SET THE 'ENABLED' PARAMETER TO 
'true' -->
        <handler 
class="com.orientechnologies.orient.server.handler.OAutomaticBackup">
            <parameters>
                <parameter name="enabled" value="false"/>
                <parameter name="delay" value="4h"/>
                <parameter name="target.directory" value="backup"/>
                <parameter name="target.fileName" 
value="${DBNAME}-${DATE:yyyyMMddHHmmss}.json"/>
                <!-- ${DBNAME} AND ${DATE:} VARIABLES ARE SUPPORTED -->
                <parameter name="db.include" value=""/>
                <!-- DEFAULT: NO ONE, THAT MEANS ALL DATABASES. USE COMMA 
TO SEPARATE MULTIPLE DATABASE NAMES -->
                <parameter name="db.exclude" value=""/>
                <!-- USE COMMA TO SEPARATE MULTIPLE DATABASE NAMES -->
            </parameters>
        </handler>
        <!-- MAIL, TO TURN ON SET THE 'ENABLED' PARAMETER TO 'true' -->
        <handler 
class="com.orientechnologies.orient.server.plugin.mail.OMailPlugin">
            <parameters>
                <parameter name="enabled" value="true"/>
                <!-- CREATE MULTIPLE PROFILES WITH profile.<name>... -->
                <parameter name="profile.default.mail.smtp.host" 
value="localhost"/>
                <parameter name="profile.default.mail.smtp.port" 
value="25"/>
                <parameter name="profile.default.mail.smtp.auth" 
value="true"/>
                <parameter name="profile.default.mail.smtp.starttls.enable" 
value="true"/>
                <parameter name="profile.default.mail.smtp.user" value=""/>
                <parameter name="profile.default.mail.smtp.password" 
value=""/>
                <parameter name="profile.default.mail.date.format" 
value="yyyy-MM-dd HH:mm:ss"/>
            </parameters>
        </handler>
        <!-- SERVER SIDE SCRIPT INTERPRETER. WARNING! THIS CAN BE A 
SECURITY HOLE: ENABLE IT ONLY IF CLIENTS ARE TRUCT, TO TURN ON SET THE 
'ENABLED' PARAMETER
            TO 'true' -->
        <handler 
class="com.orientechnologies.orient.server.handler.OServerSideScriptInterpreter">
            <parameters>
                <parameter name="enabled" value="false"/>
            </parameters>
        </handler>
    </handlers>
    <network>
        <protocols>
            <!-- Default registered protocol. It reads commands using the 
HTTP protocol and write data locally -->
            <protocol name="binary"
                      
implementation="com.orientechnologies.orient.server.network.protocol.binary.ONetworkProtocolBinary"/>
            <protocol name="http"
                      
implementation="com.orientechnologies.orient.server.network.protocol.http.ONetworkProtocolHttpDb"/>
        </protocols>
        <listeners>
            <listener protocol="binary" ip-address="0.0.0.0" 
port-range="2424-2430"/>
            <listener protocol="http" ip-address="0.0.0.0" 
port-range="2480-2490">
                <parameters>
                    <!-- Connection's custom parameters. If not specified 
the global configuration will be taken -->
                    <parameter name="network.http.charset" value="utf-8"/>
                    <!-- Define additional HTTP headers to always send as 
response -->
                    <!-- Allow cross-site scripting -->
                    <!-- parameter 
name="network.http.additionalResponseHeaders" 
value="Access-Control-Allow-Origin: *;Access-Control-Allow-Credentials: 
true" /-->
                </parameters>
                <commands>
                    <command
                            pattern="GET|www GET|studio/ GET| GET|*.htm 
GET|*.html GET|*.xml GET|*.jpeg GET|*.jpg GET|*.png GET|*.gif GET|*.js 
GET|*.css GET|*.swf GET|*.ico GET|*.txt GET|*.otf GET|*.pjs GET|*.svg"
                            
implementation="com.orientechnologies.orient.server.network.protocol.http.command.get.OServerCommandGetStaticContent">
                        <parameters>
                            <!-- Don't cache html resources in development 
mode -->
                            <entry name="http.cache:*.htm *.html"
                                   value="Cache-Control: no-cache, 
no-store, max-age=0, must-revalidate\r\nPragma: no-cache"/>
                            <!-- Default caching -->
                            <entry name="http.cache:default" 
value="Cache-Control: max-age=120"/>
                        </parameters>
                    </command>
                </commands>
            </listener>
        </listeners>
        <cluster>
        </cluster>
    </network>
    <storages>
    </storages>
    <users>
                <user resources="database.passthrough" 
password="D77344545040BB07815317E34BD2F8AF3F6B1BE2CAFEEE829927C2B186E686CA" 
name="replicator"/>

                <user resources="*" password="xxxxxxxxxxxxx" name="pippo"/>

        </users>
    <properties>
        <!-- Uses the Hazelcast's distributed cache as 2nd level cache -->
        <!-- <entry name="cache.level2.impl" 
value="com.orientechnologies.orient.server.hazelcast.OHazelcastCache" /> -->

        <!-- DATABASE POOL: size min/max -->
        <entry name="db.pool.min" value="1"/>
        <entry name="db.pool.max" value="256"/>

        <!-- LEVEL1 AND 2 CACHE: enable/disable and set the size as number 
of entries -->
        <entry name="cache.level1.enabled" value="false"/>
        <entry name="cache.level1.size" value="1000"/>
        <entry name="cache.level2.enabled" value="false"/>
        <entry name="cache.level2.size" value="1000"/>

        <!-- PROFILER: configures the profiler as 
<seconds-for-snapshot>,<archive-snapshot-size>,<summary-size>  -->
        <entry name="profiler.enabled" value="true"/>
        <!-- <entry name="profiler.config" value="30,10,10" />  -->

        <!-- LOG: enable/Disable logging. Levels are: finer, fine, finest, 
info, warning -->
        <entry name="log.console.level" value="info"/>
        <entry name="log.file.level" value="fine"/>
    </properties>
</orient-server>


- intrepid-distributed-db-config.json

{
    "autoDeploy": true,
    "hotAlignment": true,
    "readQuorum": 1,
    "writeQuorum": 1,
    "failureAvailableNodesLessQuorum": false,
    "readYourWrites": true,
    "clusters": {
        "internal": {
        },
        "index": {
        },
        "*": {
            "servers" : [ "<NEW_NODE>" ]
        }
    }
}

 
- Hazelcast:

<hazelcast
        xsi:schemaLocation="http://www.hazelcast.com/schema/config 
hazelcast-config-3.0.xsd"
        xmlns="http://www.hazelcast.com/schema/config"; 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";>
        <group>
                <name>intrepid</name>
                <password>intrepid</password>
        </group>
        <network>
                <port auto-increment="true">2434</port>
                <join>
                        <multicast enabled="false">
                                <multicast-group>235.1.1.1</multicast-group>
                                <multicast-port>2434</multicast-port>
                        </multicast>
                      <tcp-ip enabled="true">
                          <member>172.16.0.68:2434</member>
                          <member>172.16.0.110:2434</member>
                      </tcp-ip>
                </join>
        </network>
        <executor-service>
                <pool-size>16</pool-size>
        </executor-service>
</hazelcast>

Code snippets:
 
-- graphFactory and pool creation:
 
   OrientGraphFactory graphFactory = new OrientGraphFactory(dbUrl, 
dbUsername, dbPassword)
     .setupPool(8,32));
   ...
 
 
-- example of method for getting a vertex:
 
  ...
  OrientGraph  graph = graphFactory.getTx();
  Vertex   vRes = null;
 
  try
  {
   /* Retrieves the vertex */
   for(Vertex vr : graph.getVertices("myClass:uid", myUid))
   {
    vRes = vr;
   }
   if(vRes != null)
   {
    // get vertex properties
   }
   else
   {
    throw new ResourceNotFoundException(...);
   }
  }
  finally
  {
   /* Closes the graph connection */
   graph.shutdown();
  }
 
  
-- example of transactional method for writing vertex + edge
 
  ...
  OrientGraph  graph = graphFactory.getTx();
  Vertex   vParent = null;
  Vertex   vChild;
  boolean   isOk = Boolean.FALSE;
 
  try
  {
   /* Retrieves the parent vertex */
   for(Vertex vp : graph.getVertices("myParentClass:uid", myParentUid))
   {
    vParent = vp;
   }
   if(vParent == null)
   {
    throw new ResourceNotFoundException(...);
   }
 
   /* Creates the child vertex */
   vChild = graph.addVertex("myChildClass:uid", myChildUid, attributesMap);
   /* Adds the edge between the two vertices */
   vParent.addEdge(edgeType, vChild);
   isOk = Boolean.TRUE;
  }
  finally
  {
   /* Commits or rollbacks the transaction */
   if(isOk)
   {
    graph.commit();
   }
   else
   {
    graph.rollback();
   }
   /* Closes the graph connection */
   graph.shutdown();
  } 

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"OrientDB" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to