Revision: 8c5dfeddb6ca
Author:   Jean Deruelle <[email protected]>
Date:     Fri Aug 10 07:22:56 2012
Log:      Update Issue 141

Adding Congestion Control Memory Thresholds

http://code.google.com/p/sipservlets/source/detail?r=8c5dfeddb6ca

Modified:
/containers/sip-servlets-as7-drop-in/jboss-as-mobicents/src/main/java/org/mobicents/as7/Attribute.java /containers/sip-servlets-as7-drop-in/jboss-as-mobicents/src/main/java/org/mobicents/as7/Constants.java /containers/sip-servlets-as7-drop-in/jboss-as-mobicents/src/main/java/org/mobicents/as7/SipDefinition.java /containers/sip-servlets-as7-drop-in/jboss-as-mobicents/src/main/java/org/mobicents/as7/SipServerService.java /containers/sip-servlets-as7-drop-in/jboss-as-mobicents/src/main/java/org/mobicents/as7/SipSubsystemAdd.java /containers/sip-servlets-as7-drop-in/jboss-as-mobicents/src/main/java/org/mobicents/as7/SipSubsystemParser.java /containers/sip-servlets-as7-drop-in/jboss-as-mobicents/src/main/resources/org/mobicents/as7/LocalDescriptions.properties

=======================================
--- /containers/sip-servlets-as7-drop-in/jboss-as-mobicents/src/main/java/org/mobicents/as7/Attribute.java Fri Aug 10 06:02:07 2012 +++ /containers/sip-servlets-as7-drop-in/jboss-as-mobicents/src/main/java/org/mobicents/as7/Attribute.java Fri Aug 10 07:22:56 2012
@@ -33,6 +33,7 @@

     APPLICATION_ROUTER(Constants.APPLICATION_ROUTER),
ADDITIONAL_PARAMETERABLE_HEADERS(Constants.ADDITIONAL_PARAMETERABLE_HEADERS), + BACK_TO_NORMAL_MEMORY_THRESHOLD(Constants.BACK_TO_NORMAL_MEMORY_THRESHOLD),
     BASE_TIMER_INTERVAL(Constants.BASE_TIMER_INTERVAL),
CANCELED_TIMER_TASKS_PURGE_PERIOD(Constants.CANCELED_TIMER_TASKS_PURGE_PERIOD),
     CA_CERTIFICATE_FILE(Constants.CA_CERTIFICATE_FILE),
@@ -73,6 +74,7 @@
     MAX_CONNECTIONS(Constants.MAX_CONNECTIONS),
     MAX_DEPTH(Constants.MAX_DEPTH),
     MAX_POST_SIZE(Constants.MAX_POST_SIZE),
+    MEMORY_THRESHOLD(Constants.MEMORY_THRESHOLD),
     MODIFICATION_TEST_INTERVAL(Constants.MODIFICATION_TEST_INTERVAL),
     MAX_SAVE_POST_SIZE(Constants.MAX_SAVE_POST_SIZE),
     NAME(Constants.NAME),
=======================================
--- /containers/sip-servlets-as7-drop-in/jboss-as-mobicents/src/main/java/org/mobicents/as7/Constants.java Fri Aug 10 06:32:53 2012 +++ /containers/sip-servlets-as7-drop-in/jboss-as-mobicents/src/main/java/org/mobicents/as7/Constants.java Fri Aug 10 07:22:56 2012
@@ -29,6 +29,8 @@
     String ACCESS_LOG = "access-log";
String ADDITIONAL_PARAMETERABLE_HEADERS = "additional-parameterable-headers";
     String ALIAS = "alias";
+    String APPLICATION_ROUTER = "application-router";
+ String BACK_TO_NORMAL_MEMORY_THRESHOLD = "back-to-normal-memory-threshold";
     String BASE_TIMER_INTERVAL = "base-timer-interval";
     String CA_CERTIFICATE_FILE = "ca-certificate-file";
     String CA_CERTIFICATE_PASSWORD = "ca-certificate-password";
@@ -41,8 +43,7 @@
     String CIPHER_SUITE = "cipher-suite";
     String CONDITION = "condition";
     String CONFIGURATION = "configuration";
-    String CONNECTOR = "connector";
-    String APPLICATION_ROUTER = "application-router";
+    String CONNECTOR = "connector";
String CANCELED_TIMER_TASKS_PURGE_PERIOD = "canceled-timer-tasks-purge-period";
     String CONCURRENCY_CONTROL_MODE = "concurrency-control-mode";
     String CONGESTION_CONTROL_INTERVAL = "congestion-control-interval";
@@ -78,6 +79,7 @@
     String MAX_DEPTH = "max-depth";
     String MAX_POST_SIZE = "max-post-size";
     String MAX_SAVE_POST_SIZE = "max-save-post-size";
+    String MEMORY_THRESHOLD = "memory-threshold";
     String MIME_MAPPING = "mime-mapping";
     String MODIFICATION_TEST_INTERVAL = "modification-test-interval";
     String NAME = "name";
=======================================
--- /containers/sip-servlets-as7-drop-in/jboss-as-mobicents/src/main/java/org/mobicents/as7/SipDefinition.java Fri Aug 10 06:02:07 2012 +++ /containers/sip-servlets-as7-drop-in/jboss-as-mobicents/src/main/java/org/mobicents/as7/SipDefinition.java Fri Aug 10 07:22:56 2012
@@ -156,6 +156,21 @@
                     .setFlags(AttributeAccess.Flag.RESTART_ALL_SERVICES)
                     .setDefaultValue(new ModelNode(-1))
                     .build();
+    protected static final SimpleAttributeDefinition MEMORY_THRESHOLD =
+ new SimpleAttributeDefinitionBuilder(Constants.MEMORY_THRESHOLD, ModelType.INT, true)
+                    .setAllowExpression(true)
+                    .setXmlName(Constants.MEMORY_THRESHOLD)
+                    .setFlags(AttributeAccess.Flag.RESTART_ALL_SERVICES)
+                    .setDefaultValue(new ModelNode(85))
+                    .build();
+ protected static final SimpleAttributeDefinition BACK_TO_NORMAL_MEMORY_THRESHOLD = + new SimpleAttributeDefinitionBuilder(Constants.BACK_TO_NORMAL_MEMORY_THRESHOLD, ModelType.INT, true)
+                    .setAllowExpression(true)
+                    .setXmlName(Constants.BACK_TO_NORMAL_MEMORY_THRESHOLD)
+                    .setFlags(AttributeAccess.Flag.RESTART_ALL_SERVICES)
+                    .setDefaultValue(new ModelNode(75))
+                    .build();
+


     private SipDefinition() {
@@ -190,5 +205,7 @@
registration.registerReadWriteAttribute(TIMER_D_INTERVAL, null, new ReloadRequiredWriteAttributeHandler(TIMER_D_INTERVAL)); registration.registerReadWriteAttribute(DIALOG_PENDING_REQUEST_CHECKING, null, new ReloadRequiredWriteAttributeHandler(DIALOG_PENDING_REQUEST_CHECKING)); registration.registerReadWriteAttribute(CANCELED_TIMER_TASKS_PURGE_PERIOD, null, new ReloadRequiredWriteAttributeHandler(CANCELED_TIMER_TASKS_PURGE_PERIOD)); + registration.registerReadWriteAttribute(MEMORY_THRESHOLD, null, new ReloadRequiredWriteAttributeHandler(MEMORY_THRESHOLD)); + registration.registerReadWriteAttribute(BACK_TO_NORMAL_MEMORY_THRESHOLD, null, new ReloadRequiredWriteAttributeHandler(BACK_TO_NORMAL_MEMORY_THRESHOLD));
     }
 }
=======================================
--- /containers/sip-servlets-as7-drop-in/jboss-as-mobicents/src/main/java/org/mobicents/as7/SipServerService.java Fri Aug 10 06:32:53 2012 +++ /containers/sip-servlets-as7-drop-in/jboss-as-mobicents/src/main/java/org/mobicents/as7/SipServerService.java Fri Aug 10 07:22:56 2012
@@ -70,6 +70,8 @@
        final int timerDInterval;
        final boolean dialogPendingRequestChecking;
        final int canceledTimerTasksPurgePeriod;
+       final int memoryThreshold;
+       final int backToNormalMemoryThreshold;

     private final String instanceId;

@@ -98,6 +100,8 @@
                int timerDInterval,
                boolean dialogPendingRequestChecking,
                int canceledTimerTasksPurgePeriod,
+               int memoryThreshold,
+               int backToNormalMemoryThreshold,
                String instanceId) {
 //        this.defaultHost = defaultHost;
 //        this.useNative = useNative;
@@ -116,6 +120,8 @@
         this.timerDInterval = timerDInterval;
         this.dialogPendingRequestChecking = dialogPendingRequestChecking;
         this.canceledTimerTasksPurgePeriod = canceledTimerTasksPurgePeriod;
+        this.memoryThreshold = memoryThreshold;
+        this.backToNormalMemoryThreshold = backToNormalMemoryThreshold;
     }

     /** {@inheritDoc} */
@@ -198,6 +204,8 @@
         }
sipService.setDialogPendingRequestChecking(dialogPendingRequestChecking); sipService.setCanceledTimerTasksPurgePeriod(canceledTimerTasksPurgePeriod);
+        sipService.setMemoryThreshold(memoryThreshold);
+ sipService.setBackToNormalMemoryThreshold(backToNormalMemoryThreshold);

         sipService.setName(JBOSS_SIP);
         sipService.setServer(server);
=======================================
--- /containers/sip-servlets-as7-drop-in/jboss-as-mobicents/src/main/java/org/mobicents/as7/SipSubsystemAdd.java Fri Aug 10 06:02:07 2012 +++ /containers/sip-servlets-as7-drop-in/jboss-as-mobicents/src/main/java/org/mobicents/as7/SipSubsystemAdd.java Fri Aug 10 07:22:56 2012
@@ -94,6 +94,8 @@
         SipDefinition.TIMER_D_INTERVAL.validateAndSet(operation, model);
SipDefinition.DIALOG_PENDING_REQUEST_CHECKING.validateAndSet(operation, model); SipDefinition.CANCELED_TIMER_TASKS_PURGE_PERIOD.validateAndSet(operation, model);
+        SipDefinition.MEMORY_THRESHOLD.validateAndSet(operation, model);
+ SipDefinition.BACK_TO_NORMAL_MEMORY_THRESHOLD.validateAndSet(operation, model);
     }

     @Override
@@ -146,7 +148,13 @@

final ModelNode canceledTimerTasksPurgePeriodModel = SipDefinition.CANCELED_TIMER_TASKS_PURGE_PERIOD.resolveModelAttribute(context, fullModel); final int canceledTimerTasksPurgePeriod = canceledTimerTasksPurgePeriodModel.isDefined() ? canceledTimerTasksPurgePeriodModel.asInt() : -1;
-
+
+ final ModelNode memoryThresholdModel = SipDefinition.MEMORY_THRESHOLD.resolveModelAttribute(context, fullModel); + final int memoryThreshold = memoryThresholdModel.isDefined() ? memoryThresholdModel.asInt() : -1;
+
+ final ModelNode backToNormalMemoryThresholdModel = SipDefinition.BACK_TO_NORMAL_MEMORY_THRESHOLD.resolveModelAttribute(context, fullModel); + final int backToNormalMemoryThreshold = backToNormalMemoryThresholdModel.isDefined() ? backToNormalMemoryThresholdModel.asInt() : -1;
+
// final String instanceId = operation.hasDefined(Constants.INSTANCE_ID) ? operation.get(Constants.INSTANCE_ID).asString() : null; // final String sipAppRouterFile = operation.hasDefined(Constants.APPLICATION_ROUTER) ? operation.get(Constants.APPLICATION_ROUTER).asString() : null; // final String sipStackPropertiesFile = operation.hasDefined(Constants.SIP_STACK_PROPS) ? operation.get(Constants.SIP_STACK_PROPS).asString() : null;
@@ -171,6 +179,8 @@
                        timerDInterval,
                        dialogPendingRequestChecking,
                        canceledTimerTasksPurgePeriod,
+                       memoryThreshold,
+                       backToNormalMemoryThreshold,
                        instanceId);
newControllers.add(context.getServiceTarget().addService(SipSubsystemServices.JBOSS_SIP, service) .addDependency(PathManagerService.SERVICE_NAME, PathManager.class, service.getPathManagerInjector())
=======================================
--- /containers/sip-servlets-as7-drop-in/jboss-as-mobicents/src/main/java/org/mobicents/as7/SipSubsystemParser.java Fri Aug 10 06:02:07 2012 +++ /containers/sip-servlets-as7-drop-in/jboss-as-mobicents/src/main/java/org/mobicents/as7/SipSubsystemParser.java Fri Aug 10 07:22:56 2012
@@ -89,6 +89,8 @@
SipDefinition.TIMER_D_INTERVAL.marshallAsAttribute(node, false, writer); SipDefinition.DIALOG_PENDING_REQUEST_CHECKING.marshallAsAttribute(node, false, writer); SipDefinition.CANCELED_TIMER_TASKS_PURGE_PERIOD.marshallAsAttribute(node, false, writer); + SipDefinition.MEMORY_THRESHOLD.marshallAsAttribute(node, false, writer); + SipDefinition.BACK_TO_NORMAL_MEMORY_THRESHOLD.marshallAsAttribute(node, false, writer);
         if(node.hasDefined(CONNECTOR)) {
for(final Property connector : node.get(CONNECTOR).asPropertyList()) {
                        final ModelNode config = connector.getValue();
@@ -131,6 +133,8 @@
                    case DIALOG_PENDING_REQUEST_CHECKING:
                    case CANCELED_TIMER_TASKS_PURGE_PERIOD:
                    case CONGESTION_CONTROL_INTERVAL:
+                   case MEMORY_THRESHOLD:
+                   case BACK_TO_NORMAL_MEMORY_THRESHOLD:
                    case CONCURRENCY_CONTROL_MODE:
                    case USE_PRETTY_ENCODING:
                        subsystem.get(attribute.getLocalName()).set(value);
=======================================
--- /containers/sip-servlets-as7-drop-in/jboss-as-mobicents/src/main/resources/org/mobicents/as7/LocalDescriptions.properties Fri Aug 10 06:02:07 2012 +++ /containers/sip-servlets-as7-drop-in/jboss-as-mobicents/src/main/resources/org/mobicents/as7/LocalDescriptions.properties Fri Aug 10 07:22:56 2012
@@ -17,6 +17,8 @@
sip.timer-d-interval=Specifies the Timer D Interval, which allows the SIP Servlets container to adjust its timers depending on network conditions sip.dialog-pending-request-checking=This property enables and disables error checking when SIP transactions overlap sip.canceled-timer-tasks-purge-period=Defines a period to due a purge in the container timer schedulers. The purge may prevent excessive memory usage for apps that cancel most of the timers it sets. +sip.memory-threshold=Memory Threshold that when reached by the container, the container will start rejecting new incoming requests +sip.back-to-normal-memory-threshold=Back To Normal Memory Threshold that when reached by the container, the container will start accepting new incoming requests again

 sip.configuration=The common sip container configuration.

Reply via email to