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

matthew_swift
09.04.2009 84a6349d4c1e49de04d6ba61e587130af3efbc00
Fix issue 3832 - Provide ergonomics style settings for common server properties
8 files modified
113 ■■■■ changed files
opends/resource/config/config.ldif 3 ●●●●● patch | view | raw | blame | history
opends/resource/schema/02-config.ldif 4 ●●●● patch | view | raw | blame | history
opends/src/admin/defn/org/opends/server/admin/std/LocalDBBackendConfiguration.xml 18 ●●●●● patch | view | raw | blame | history
opends/src/admin/defn/org/opends/server/admin/std/TraditionalWorkQueueConfiguration.xml 11 ●●●● patch | view | raw | blame | history
opends/src/messages/messages/backend.properties 6 ●●●●● patch | view | raw | blame | history
opends/src/messages/messages/core.properties 3 ●●●● patch | view | raw | blame | history
opends/src/server/org/opends/server/backends/jeb/ConfigurableEnvironment.java 35 ●●●●● patch | view | raw | blame | history
opends/src/server/org/opends/server/extensions/TraditionalWorkQueue.java 33 ●●●● patch | view | raw | blame | history
opends/resource/config/config.ldif
@@ -189,7 +189,6 @@
ds-cfg-db-txn-no-sync: false
ds-cfg-db-txn-write-no-sync: true
ds-cfg-db-run-cleaner: true
ds-cfg-db-num-cleaner-threads: 1
ds-cfg-db-cleaner-min-utilization: 75
ds-cfg-db-evictor-lru-only: true
ds-cfg-db-evictor-nodes-per-scan: 10
@@ -198,7 +197,6 @@
ds-cfg-db-logging-level: CONFIG
ds-cfg-db-checkpointer-bytes-interval: 20 megabytes
ds-cfg-db-checkpointer-wakeup-interval: 30 seconds
ds-cfg-db-num-lock-tables: 19
dn: cn=Index,ds-cfg-backend-id=userRoot,cn=Backends,cn=config
objectClass: top
@@ -2423,7 +2421,6 @@
objectClass: ds-cfg-traditional-work-queue
cn: Work Queue
ds-cfg-java-class: org.opends.server.extensions.TraditionalWorkQueue
ds-cfg-num-worker-threads: 24
ds-cfg-max-work-queue-capacity: 0
dn: cn=Administration Connector,cn=config
opends/resource/schema/02-config.ldif
@@ -3140,8 +3140,8 @@
  NAME 'ds-cfg-traditional-work-queue'
  SUP ds-cfg-work-queue
  STRUCTURAL
  MUST ds-cfg-num-worker-threads
  MAY ds-cfg-max-work-queue-capacity
  MAY ( ds-cfg-num-worker-threads $
        ds-cfg-max-work-queue-capacity )
  X-ORIGIN 'OpenDS Directory Server' )
objectClasses: ( 1.3.6.1.4.1.26027.1.2.73
  NAME 'ds-cfg-password-modify-extended-operation-handler'
opends/src/admin/defn/org/opends/server/admin/std/LocalDBBackendConfiguration.xml
@@ -23,7 +23,7 @@
  ! CDDL HEADER END
  !
  !
  !      Copyright 2007-2008 Sun Microsystems, Inc.
  !      Copyright 2007-2009 Sun Microsystems, Inc.
  ! -->
<adm:managed-object name="local-db-backend"
  plural-name="local-db-backends" package="org.opends.server.admin.std"
@@ -696,9 +696,11 @@
      <adm:component-restart />
    </adm:requires-admin-action>
    <adm:default-behavior>
      <adm:defined>
        <adm:value>19</adm:value>
      </adm:defined>
      <adm:alias>
        <adm:synopsis>
          Let the server decide.
        </adm:synopsis>
      </adm:alias>
    </adm:default-behavior>
    <adm:syntax>
      <adm:integer lower-limit="1" upper-limit="32767" />
@@ -719,9 +721,11 @@
      threads may be required to maintain the desired utilization.
    </adm:description>
    <adm:default-behavior>
      <adm:defined>
        <adm:value>1</adm:value>
      </adm:defined>
      <adm:alias>
        <adm:synopsis>
          Let the server decide.
        </adm:synopsis>
      </adm:alias>
    </adm:default-behavior>
    <adm:syntax>
      <adm:integer lower-limit="1" />
opends/src/admin/defn/org/opends/server/admin/std/TraditionalWorkQueueConfiguration.xml
@@ -23,7 +23,7 @@
  ! CDDL HEADER END
  !
  !
  !      Copyright 2007-2008 Sun Microsystems, Inc.
  !      Copyright 2007-2009 Sun Microsystems, Inc.
  ! -->
<adm:managed-object name="traditional-work-queue"
  plural-name="traditional-work-queues" extends="work-queue"
@@ -61,7 +61,7 @@
      </adm:defined>
    </adm:default-behavior>
  </adm:property-override>
  <adm:property name="num-worker-threads" mandatory="true">
  <adm:property name="num-worker-threads">
    <adm:synopsis>
      Specifies the number of worker threads to be used for processing
      operations placed in the queue. 
@@ -72,6 +72,13 @@
      value is reduced, the appropriate number of threads are destroyed 
      as operations complete processing.
    </adm:description>
    <adm:default-behavior>
      <adm:alias>
        <adm:synopsis>
          Let the server decide.
        </adm:synopsis>
      </adm:alias>
    </adm:default-behavior>
    <adm:syntax>
      <adm:integer lower-limit="1" upper-limit="2147483647" />
    </adm:syntax>
opends/src/messages/messages/backend.properties
@@ -1136,3 +1136,9 @@
MILD_ERR_SCHEMA_MODIFY_RULEID_CONFLICTS_FOR_ADD_DSR_409=Unable to add DIT \
 structure rule %s because its rule identifier conflicts with existing DIT structure \
 rule (%s)
INFO_ERGONOMIC_SIZING_OF_JE_CLEANER_THREADS_410=Local DB backend %s does not \
specify the number of cleaner threads: defaulting to %d threads
INFO_ERGONOMIC_SIZING_OF_JE_LOCK_TABLES_411=Local DB backend %s does not \
specify the number of lock tables: defaulting to %d
opends/src/messages/messages/core.properties
@@ -1816,4 +1816,5 @@
SEVERE_ERR_WORKFLOW_BASE_DN_DUPLICATED_IN_NG_719=\
Unable to register the workflow because the base DN '%s' is already \
registered with the network group '%s'
INFO_ERGONOMIC_SIZING_OF_WORKER_THREAD_POOL_720=No worker queue thread \
pool size specified: sizing automatically to use %d threads
opends/src/server/org/opends/server/backends/jeb/ConfigurableEnvironment.java
@@ -22,7 +22,7 @@
 * CDDL HEADER END
 *
 *
 *      Copyright 2006-2008 Sun Microsystems, Inc.
 *      Copyright 2006-2009 Sun Microsystems, Inc.
 */
package org.opends.server.backends.jeb;
@@ -35,6 +35,7 @@
import java.util.HashMap;
import java.util.Map;
import java.lang.reflect.Method;
import java.math.BigInteger;
import java.util.HashSet;
import java.util.SortedSet;
import java.util.StringTokenizer;
@@ -50,8 +51,10 @@
import org.opends.server.admin.BooleanPropertyDefinition;
import org.opends.server.admin.PropertyDefinition;
import static org.opends.server.loggers.ErrorLogger.*;
import static org.opends.server.loggers.debug.DebugLogger.*;
import static org.opends.messages.ConfigMessages.*;
import static org.opends.messages.BackendMessages.*;
/**
 * This class maps JE properties to configuration attributes.
@@ -306,6 +309,36 @@
      else
      {
        Object value = method.invoke(cfg);
        if (attrName.equals(ATTR_NUM_CLEANER_THREADS) && value == null)
        {
          // Automatically choose based on the number of processors.
          int cpus = Runtime.getRuntime().availableProcessors();
          value = Integer.valueOf(Math.max(2, cpus / 2));
          Message message =
              INFO_ERGONOMIC_SIZING_OF_JE_CLEANER_THREADS.get(String
                  .valueOf(cfg.dn()), (Number) value);
          logError(message);
        }
        else if (attrName.equals(ATTR_NUM_LOCK_TABLES)
            && value == null)
        {
          // Automatically choose based on the number of processors.
          // We'll assume that the user has also allowed automatic
          // configuration of cleaners and workers.
          int cpus = Runtime.getRuntime().availableProcessors();
          int cleaners = Math.max(2, cpus / 2);
          int workers = Math.max(24, cpus * 2);
          BigInteger tmp = BigInteger.valueOf((cleaners + workers) * 2);
          value = tmp.nextProbablePrime();
          Message message =
              INFO_ERGONOMIC_SIZING_OF_JE_LOCK_TABLES.get(String
                  .valueOf(cfg.dn()), (Number) value);
          logError(message);
        }
        return String.valueOf(value);
      }
    }
opends/src/server/org/opends/server/extensions/TraditionalWorkQueue.java
@@ -22,7 +22,7 @@
 * CDDL HEADER END
 *
 *
 *      Copyright 2006-2008 Sun Microsystems, Inc.
 *      Copyright 2006-2009 Sun Microsystems, Inc.
 */
package org.opends.server.extensions;
@@ -49,7 +49,6 @@
import org.opends.server.types.ConfigChangeResult;
import org.opends.server.types.DebugLogLevel;
import org.opends.server.types.DirectoryException;
import org.opends.server.types.DN;
import org.opends.server.types.InitializationException;
import org.opends.server.types.Operation;
import org.opends.server.types.ResultCode;
@@ -103,10 +102,6 @@
  // Indicates whether the Directory Server is shutting down.
  private boolean shutdownRequested;
  // The DN of the configuration entry with information to use to configure the
  // work queue.
  private DN configEntryDN;
  // The thread number used for the last worker thread that was created.
  private int lastThreadNumber;
@@ -156,8 +151,7 @@
    // Get the necessary configuration from the provided entry.
    configEntryDN    = configuration.dn();
    numWorkerThreads = configuration.getNumWorkerThreads();
    numWorkerThreads = getNumWorkerThreads(configuration);
    maxCapacity      = configuration.getMaxWorkQueueCapacity();
@@ -292,6 +286,7 @@
   *                              down or the pending operation queue is already
   *                              at its maximum capacity).
   */
  @Override
  public void submitOperation(AbstractOperation operation)
         throws DirectoryException
  {
@@ -712,5 +707,27 @@
      return true;
    }
  }
  // Determine the number of worker threads.
  private int getNumWorkerThreads(TraditionalWorkQueueCfg configuration)
  {
    if (configuration.getNumWorkerThreads() == null)
    {
      // Automatically choose based on the number of processors.
      int cpus = Runtime.getRuntime().availableProcessors();
      int value = Math.max(24, cpus * 2);
      Message message = INFO_ERGONOMIC_SIZING_OF_WORKER_THREAD_POOL.get(value);
      logError(message);
      return value;
    }
    else
    {
      return configuration.getNumWorkerThreads();
    }
  }
}