Configuration

Configuration files are provided with queue microservices. If consists of two files:

configuration.yml

This is a standard configuration file for native microservices, where some of the parameters have been adjusted to characteristic of their functions in the environment (queuing) and should be always considered in the process of system design:

  • amount of memory (HEAP)
  • number of threads
SERVERS:
  JLRMC: #JLupin Remote Method Calls Fast Protocol:
    readTimeout: 480000
    isWaitForFinishExecuteAllRequests: true
    waitToShutdownThreadsOnStop: 60000
    backlog: 0
    receiveBufferSize: 0
    isReuseAddress: false
    threadPoolSize: 1
    isLogPeriodicOnDebug: true
    isDestroyThreadOnTimeout: false
    threadExecutingTimeOut: 240000
    isStartOnMainServerInitialize: true
  TRANSMISSION:
    readTimeout: 480000
    isWaitForFinishExecuteAllRequests: false
    waitToShutdownThreadsOnStop: 60000
    backlog: 0
    receiveBufferSize: 0
    isReuseAddress: false
    threadPoolSize: 2
    isLogPeriodicOnDebug: true
    isDestroyThreadOnTimeout: false
    threadExecutingTimeOut: 3600000
    isStartOnMainServerInitialize: true
  QUEUE:
     readTimeout: 480000
     isWaitForFinishExecuteAllRequests: true
     waitToShutdownThreadsOnStop: 60000
     backlog: 256
     receiveBufferSize: 256
     isReuseAddress: false
     threadPoolSize: 8
     isLogPeriodicOnDebug: true
     isDestroyThreadOnTimeout: false
     threadExecutingTimeOut: 240000
     isStartOnMainServerInitialize: true
ENTRY_POINTS:
  QUEUE:
     threadAmount: 8
     howOftenCheckingServerInMillis: 5000
     repeatsAmount: 4
     timeToWaitBetweenRepeatProbeInMillis: 1000
  TRANSMISSION:
     MICROSERVICES_GRANT_ACCESS:
      MICROSERVICES_LIST:
      #- microserviceName: 'sampleMicroservice'
        #serviceName: 'sampleServiceName'
        #methodName: 'sampleMethodName'
      #- microserviceName: 'sampleMicroservice2'
        #serviceName: 'sampleServiceName2'
        #methodName: 'sampleMethodName2'
PROPERTIES:
  platformVersion: '1.6.0.0'
  #jvmOptions1: '-Xms128M -Xmx256M -agentlib:jdwp=transport=dt_socket,address=12998,server=y,suspend=n'
  jvmOptions1: '-Xms128M -Xmx256M -Dlog4j.configurationFile=../application/queueMicroservice/log4j2.xml' #jvmOptions_2 - default the same as jvmOptions_1
  #jvmOptions2: '-Xms128M -Xmx256M'
  externalPort: '8000'
  version: '1.6.0.0'
  switchDelayTime: 0
  connectionSocketTimeoutInMillis: 1000
  readTimeoutInMillis: 30000
  isKeepAlive: false
  isOOBInline: false
  isTcpNoDelay: false
  isReuseAddress: false
  sendBufferSize: 0
  receiveBufferSize: 0
  soLinger: 0
  trafficClass: 0
  #javaExecutablePath: 'c:\\jvm\\bin\\java.exe'
  #additionalClassPath: 'c:\\temp\\*'
  isStartOnMainServerInitialize: true
  priorityStartOnMainServerInitialize: 2
  waitForProcessInitResponseTimeInMillis: 900000
  waitForProcessStartResponseTimeInMillis: 900000
  waitForProcessDestroyResponseTimeInMillis: 90000
  isArchiveOnStart: false
  startLogMode: INFO
  isInitErrorCauseWithNetworkInformation: true
  isJmxEnabled: true
  jmxOptions: '-Dcom.sun.management.jmxremote.local.only=false -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.ssl=false'
  jmxPrimaryPort: -1
  jmxSecondaryPort: -1
  checkAvailableScript: 'function isAvailable(checkResponseTimeInMillis, jrmcActiveThreads, jrmcMaxThreads,
                                              queueActiveThreads, queueMaxThreads, servletActiveThreads, servletMaxThreads,
                                              jvmMaxMemoryInBytes, jvmTotalMemoryInBytes, jvmFreeMemoryInBytes,
                                              jvmProcessCpuLoadInPercentage, userAvailableFlag) {

                          var isAvailableByUser = Boolean(userAvailableFlag);
                            if(checkResponseTimeInMillis > 20000 || !isAvailableByUser) {
                               return false;
                            }
                            return true;
                         }'
APPLICATION:
  applicationContainerProducerClassName: 'com.jlupin.impl.microservice.partofjlupin.asynchronous.jlupin.configuration.JLupinApplicationContainerProducerImpl'
INITIALIZING_LOGGER:
  #directoryPath: '/logs/server'
  #fileName: 'file_name'
  fileExtension: 'log'
  fileSizeInMB: 20
  maxFiles: 10
MEMORY_ERRORS:
  isRestartOnError: true
  howManyTimes: 4
  percentageGrowth: 25
  isHeapDump: true

queues.yml

This file contains queues definitions and their parameters.

Section 'DELEGATOR'

The appropriate part of the configuration file:

DELEGATOR:
    howOftenCheckingServerInMillisByDelegator: 5000
    repeatsAmountByDelegator: 4
    timeToWaitBetweenRepeatProbeInMillisByDelegator: 1000

Description:

Parameter Description
howOftenCheckingServerInMillisByDelegator The loop period (expressed in milliseconds) in which the queue delegator checks if there are available microserives ready to process asynchronous requests stored on a queue.
repeatsAmountByDelegator The number of attempts made by the delegator to deliver the request to a microservice (during each attempt, the delegator checks the entire environment available to him in order to find an available microservices)
timeToWaitBetweenRepeatProbeInMillisByDelegator The time period (expressed in milliseconds) at which the queue delegator waits between successive attempts to execute results.

Section 'QUEUES'

Each entry in this section is a definition of a queues. The name of the entry is the name of a queue that should be used during asynchronous invocations. Each queues has the following set of parameters:

The appropriate part of the configuration file:

QUEUES:
  SAMPLE:
    innerQueuesAmount: 4
    waitTimeBetweenCheckingTaskReadyToStartInMillis: 500
    storageClassName: 'com.jlupin.impl.microservice.partofjlupin.asynchronous.storage.queue.impl.memory.JLupinMemoryQueueStorageImpl'
    threadAmount: 128
    maxSendProbeAmount: 2
    maxAcceptExceptionAmount: 1
    exceptionStringToRepeat: 'java.lang.Exception'
    garbageThreadAmount: 4
    howLongTaskStatusWillBeInATransientStateInMillis: 1000
    howLongTaskResultShouldBeOnQueueWithoutDownloadingItInMillis: 30000
    howLongTaskInputShouldBeOnQueueWithoutResultItInMillis: 60000
    waitTimeBetweenCheckingTaskByGarbageManagerInMillis: 5000
    delaySendProcessTaskToExecuteInMillis: 0

Description:

Parameter Description
innerQueuesAmount The number of inner queues that a queue consists of.
waitTimeBetweenCheckingTaskReadyToStartInMillis The time in milliseconds, after which the inner queue is switched from writing mode to reading mode.
storageClassName The implementation class of storage, where requestes and results are located (default is in-memory)
threadAmount The number of threads assigned to each inner queues for handling asynchronous requests.
maxSendProbeAmount The number of attempts that a thread processes the request. When maxSendProbeAmount is exceeded, the request is removed from the queue.
maxAcceptExceptionAmount The additional attempts in case of catching exceptionStringToRepeat exception (the whole stack trace is checked with regular expression)
exceptionStringToRepeat The string that identifies exceptions while processing responses on a queue (important if maxAcceptExceptionAmount > 0).
garbageThreadAmount The number of threads assigned to queue garbage collection process (cleaning queues).
howLongTaskStatusWillBeInATransientStateInMillis The maximum amount of time that a request or response in inconsistent state is kept by a queue. After this time a request or resposnse that is still in inconsistent state is discarded by the queue and removed by the garbage collector.
howLongTaskResultShouldBeOnQueueWithoutDownloadingItInMillis The maximum time in milliseconds that results are kept in a queue without downloading them by the clients.
howLongTaskInputShouldBeOnQueueWithoutResultItInMillis The maximum time in milliseconds that requests are kept in a queue without getting results from microservices.
waitTimeBetweenCheckingTaskByGarbageManagerInMillis The time period (expressed in milliseconds) at which the queue garbage collector waits between checking tasks iterations.
delaySendProcessTaskToExecuteInMillis The minimum delay time in milliseconds between a request comes in and the start of its processing.