orientdb icon indicating copy to clipboard operation
orientdb copied to clipboard

Fixed size of ArrayBlockingQueue<OAsynchDistributedOperation> for asynchronous replication does not allow full replication of data.

Open rinkymangal2010 opened this issue 11 years ago • 3 comments

Hi,

We are not able to replicate all documents to all the nodes of cluster in asynchronous mode of replication.

This is observed if the rate of insertion/update is very high (2000 documents/second).

We have a cluster of 3 nodes (node1, node2 and node3).

When we inserts 200K documents with a rate ~2000 documents/second on node1, then only ~33000 documents are replicated on other nodes (node2 and nod3).

I analysed the code and observed there is a fixed size queue which is asynchronousOperationsQueue inside ODistributedStorage.java.

asynchronousOperationsQueue = new ArrayBlockingQueue(10000);

After increasing the size if this queue, loss of data in replication reduced.

So can we make this parameter configurable via orient-server-config.xml?

Please let us know if we have misunderstood the issue.

Regards Rinky Mangal

rinkymangal2010 avatar Mar 18 '15 13:03 rinkymangal2010

Thanks for the report. I've just created OGlobalConfiguration.DISTRIBUTED_ASYNCH_QUEUE_SIZE setting. I'd like to know more info about your use case and how this value affects performance in terms of req/sec and number of nodes.

lvca avatar Mar 18 '15 18:03 lvca

Thanks for fixing the issue!

Here is the description of our use case.

We have an event generator which is generating events at a rate of 40000 events/minute. The size of each event is ~1KB.

Each event is associated with one of our business object.

We are considering orient DB cluster to store these events and associated business objects.

We need to maintain history of last 5 events associated with our business objects and make decision based on those events to change state of business object.

In addition, we need to have some smart lookup of events based on object id, time etc.

With this use case, we have one more observation that has been described in issue https://github.com/orientechnologies/orientdb/issues/3777

Now coming to your second question " how this value affects performance in terms of req/sec and number of nodes"

The answer is that OGlobalConfiguration.DISTRIBUTED_ASYNCH_QUEUE_SIZE does not affect performance. But it improves the reliability of replication if we use higher value of this parameter.

Here is our observation:

  1. Higher is the number of nodes in cluster higher is the value of this parameter.
  2. Higher is the rate of insert/delete/update higher is the value of this parameter.

One more improvement we can make is to use LinkedBlockingQueue instead of ArrayBlockingQueue. Any opinion on this?

rinkymangal2010 avatar Mar 19 '15 07:03 rinkymangal2010

Absolutely :+1:. Now setting DISTRIBUTED_ASYNCH_QUEUE_SIZE = 0 means no boundaries.

lvca avatar Mar 19 '15 09:03 lvca