mirror of https://github.com/OpenIdentityPlatform/OpenDJ.git

gbellato
05.45.2007 52cf2d05f87a2a9fd142a7e5354a0c0b3f254be5
A variation of issue 1876 :

introduce a high water/low water mechanism for the Replication Server dbHandler queue size.
This should improve performance in the uncommon case where the flush to the replication server DB
is the performance bottleneck for update operations.
1 files modified
12 ■■■■ changed files
opendj-sdk/opends/src/server/org/opends/server/replication/server/DbHandler.java 12 ●●●● patch | view | raw | blame | history
opendj-sdk/opends/src/server/org/opends/server/replication/server/DbHandler.java
@@ -83,6 +83,14 @@
  private boolean done = false;
  private DirectoryThread thread = null;
  private Object flushLock = new Object();
  // The High and low water mark for the max size of the msgQueue.
  // the threads calling add() method will be blocked if the size of
  // msgQueue becomes larger than the  MSG_QUEUE_HIMARK and will resume
  // only when the size of the msgQueue goes below MSG_QUEUE_LOWMARK.
  final static int MSG_QUEUE_HIMARK = 5000;
  final static int MSG_QUEUE_LOWMARK = 4000;
  /**
   * the trim age in milliseconds.
   */
@@ -130,7 +138,7 @@
    synchronized (msgQueue)
    {
      int size = msgQueue.size();
      while (size > 5000)     /* TODO : max size should be configurable */
      while (size > MSG_QUEUE_HIMARK)
      {
        try
        {
@@ -265,7 +273,7 @@
        msgQueue.remove();
        current++;
      }
      if (msgQueue.size() < 5000)
      if (msgQueue.size() < MSG_QUEUE_LOWMARK)
        msgQueue.notify();
    }
  }