You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by tr...@apache.org on 2016/04/02 20:45:29 UTC

[2/3] qpid-dispatch git commit: DISPATCH-253 - Configurable link capacity via listener and connector.

DISPATCH-253 - Configurable link capacity via listener and connector.


Project: http://git-wip-us.apache.org/repos/asf/qpid-dispatch/repo
Commit: http://git-wip-us.apache.org/repos/asf/qpid-dispatch/commit/ceb3b389
Tree: http://git-wip-us.apache.org/repos/asf/qpid-dispatch/tree/ceb3b389
Diff: http://git-wip-us.apache.org/repos/asf/qpid-dispatch/diff/ceb3b389

Branch: refs/heads/master
Commit: ceb3b389aecdc326b67a72506cccf4a5e9d6b048
Parents: 3f2905f
Author: Ted Ross <tr...@redhat.com>
Authored: Sat Apr 2 12:59:33 2016 -0400
Committer: Ted Ross <tr...@redhat.com>
Committed: Sat Apr 2 12:59:33 2016 -0400

----------------------------------------------------------------------
 include/qpid/dispatch/router_core.h           |  4 +++-
 include/qpid/dispatch/server.h                |  7 ++++++-
 python/qpid_dispatch/management/qdrouter.json | 14 +++++++++++++-
 src/connection_manager.c                      | 11 +++++++++++
 src/router_core/connections.c                 | 12 +++++++-----
 src/router_core/router_core_private.h         |  1 +
 src/router_node.c                             | 10 +++++++---
 7 files changed, 48 insertions(+), 11 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/qpid-dispatch/blob/ceb3b389/include/qpid/dispatch/router_core.h
----------------------------------------------------------------------
diff --git a/include/qpid/dispatch/router_core.h b/include/qpid/dispatch/router_core.h
index 9c77a08..b7fa2cf 100644
--- a/include/qpid/dispatch/router_core.h
+++ b/include/qpid/dispatch/router_core.h
@@ -153,6 +153,7 @@ typedef enum {
  *        correlate the connection with waypoints and link-route destinations that use the connection.
  * @param strip_annotations_in True if configured to remove annotations on inbound messages.
  * @param strip_annotations_out True if configured to remove annotations on outbound messages.
+ * @param link_capacity The capacity, in deliveries, for links in this connection.
  * @return Pointer to a connection object that can be used to refer to this connection over its lifetime.
  */
 qdr_connection_t *qdr_connection_opened(qdr_core_t            *core,
@@ -161,7 +162,8 @@ qdr_connection_t *qdr_connection_opened(qdr_core_t            *core,
                                         const char            *label,
                                         const char            *remote_container_id,
                                         bool                   strip_annotations_in,
-                                        bool                   strip_annotations_out);
+                                        bool                   strip_annotations_out,
+                                        int                    link_capacity);
 
 /**
  * qdr_connection_closed

http://git-wip-us.apache.org/repos/asf/qpid-dispatch/blob/ceb3b389/include/qpid/dispatch/server.h
----------------------------------------------------------------------
diff --git a/include/qpid/dispatch/server.h b/include/qpid/dispatch/server.h
index 71ac479..5a85e63 100644
--- a/include/qpid/dispatch/server.h
+++ b/include/qpid/dispatch/server.h
@@ -319,10 +319,15 @@ typedef struct qd_server_config_t {
     /**
      * If true, strip the outbound qpid dispatch specific message annotations. This only applies to ingress and egress routers.
      * Annotations generated by inter-router messages will be untouched.
-    */
+     */
     bool strip_outbound_annotations;
 
     /**
+     * The number of deliveries that can be in-flight concurrently for each link within the connection.
+     */
+    int link_capacity;
+
+    /**
      * Path to the file containing the PEM-formatted public certificate for the local end
      * of the connection.
      */

http://git-wip-us.apache.org/repos/asf/qpid-dispatch/blob/ceb3b389/python/qpid_dispatch/management/qdrouter.json
----------------------------------------------------------------------
diff --git a/python/qpid_dispatch/management/qdrouter.json b/python/qpid_dispatch/management/qdrouter.json
index 64cf6a4..48a735e 100644
--- a/python/qpid_dispatch/management/qdrouter.json
+++ b/python/qpid_dispatch/management/qdrouter.json
@@ -656,7 +656,13 @@
                     "default": "both",
                     "description": "['in', 'out', 'both', 'no'] in: Strip the dispatch router specific annotations only on ingress; out: Strip the dispatch router specific annotations only on egress; both: Strip the dispatch router specific annotations on both ingress and egress; no - do not strip dispatch router specific annotations",
                     "create": true
-                } 
+                },
+                "linkCapacity": {
+                    "type": "integer",
+                    "create": true,
+                    "required": false,
+                    "description": "The capacity of links within this connection, in terms of message deliveries.  The capacity is the number of messages that can be in-flight concurrently for each link."
+                }
             }
         },
 
@@ -700,6 +706,12 @@
                     "description": "['in', 'out', 'both', 'no'] in: Strip the dispatch router specific annotations only on ingress; out: Strip the dispatch router specific annotations only on egress; both: Strip the dispatch router specific annotations on both ingress and egress; no - do not strip dispatch router specific annotations",
                     "create": true
                 },
+                "linkCapacity": {
+                    "type": "integer",
+                    "create": true,
+                    "required": false,
+                    "description": "The capacity of links within this connection, in terms of message deliveries.  The capacity is the number of messages that can be in-flight concurrently for each link."
+                },
                 "saslUsername": {
                     "type": "string",
                     "required": false,

http://git-wip-us.apache.org/repos/asf/qpid-dispatch/blob/ceb3b389/src/connection_manager.c
----------------------------------------------------------------------
diff --git a/src/connection_manager.c b/src/connection_manager.c
index 67495ac..19d4b2e 100644
--- a/src/connection_manager.c
+++ b/src/connection_manager.c
@@ -150,6 +150,17 @@ static qd_error_t load_server_config(qd_dispatch_t *qd, qd_server_config_t *conf
     config->sasl_password        = qd_entity_opt_string(entity, "saslPassword", 0); CHECK();
     config->sasl_mechanisms      = qd_entity_opt_string(entity, "saslMechanisms", 0); CHECK();
     config->ssl_enabled          = has_attrs(entity, ssl_attributes, ssl_attributes_count);
+    config->link_capacity        = qd_entity_opt_long(entity, "linkCapacity", 0); CHECK();
+
+    //
+    // Handle the defaults for link capacity.
+    //
+    if (config->link_capacity == 0) {
+        if (strcmp("inter-router", config->role) == 0)
+            config->link_capacity = 100000; // This is effectively infinite since session flow control will be more stringent.
+        else
+            config->link_capacity = 10;
+    }
 
     //
     // For now we are hardwiring this attribute to true.  If there's an outcry from the

http://git-wip-us.apache.org/repos/asf/qpid-dispatch/blob/ceb3b389/src/router_core/connections.c
----------------------------------------------------------------------
diff --git a/src/router_core/connections.c b/src/router_core/connections.c
index 5758ba9..2521750 100644
--- a/src/router_core/connections.c
+++ b/src/router_core/connections.c
@@ -61,7 +61,8 @@ qdr_connection_t *qdr_connection_opened(qdr_core_t            *core,
                                         const char            *label,
                                         const char            *remote_container_id,
                                         bool                   strip_annotations_in,
-                                        bool                   strip_annotations_out)
+                                        bool                   strip_annotations_out,
+                                        int                    link_capacity)
 {
     qdr_action_t     *action = qdr_action(qdr_connection_opened_CT, "connection_opened");
     qdr_connection_t *conn   = new_qdr_connection_t();
@@ -73,6 +74,7 @@ qdr_connection_t *qdr_connection_opened(qdr_core_t            *core,
     conn->role                  = role;
     conn->strip_annotations_in  = strip_annotations_in;
     conn->strip_annotations_out = strip_annotations_out;
+    conn->link_capacity         = link_capacity;
     conn->mask_bit              = -1;
     DEQ_INIT(conn->links);
     DEQ_INIT(conn->work_list);
@@ -270,9 +272,9 @@ qdr_link_t *qdr_link_first_attach(qdr_connection_t *conn,
     link->name = (char*) malloc(strlen(name) + 1);
     strcpy(link->name, name);
     link->link_direction = dir;
-    link->capacity = 32;  // TODO - make this configurable
-    link->admin_enabled = true;
-    link->oper_status   = QDR_LINK_OPER_DOWN;
+    link->capacity       = conn->link_capacity;
+    link->admin_enabled  = true;
+    link->oper_status    = QDR_LINK_OPER_DOWN;
 
     link->strip_annotations_in  = conn->strip_annotations_in;
     link->strip_annotations_out = conn->strip_annotations_out;
@@ -513,7 +515,7 @@ qdr_link_t *qdr_create_link_CT(qdr_core_t       *core,
     link->conn           = conn;
     link->link_type      = link_type;
     link->link_direction = dir;
-    link->capacity       = 32; // TODO - make this configurable
+    link->capacity       = conn->link_capacity;
     link->name           = (char*) malloc(QDR_DISCRIMINATOR_SIZE + 8);
     qdr_generate_link_name("qdlink", link->name, QDR_DISCRIMINATOR_SIZE + 8);
     link->admin_enabled  = true;

http://git-wip-us.apache.org/repos/asf/qpid-dispatch/blob/ceb3b389/src/router_core/router_core_private.h
----------------------------------------------------------------------
diff --git a/src/router_core/router_core_private.h b/src/router_core/router_core_private.h
index fed9f88..801eb9a 100644
--- a/src/router_core/router_core_private.h
+++ b/src/router_core/router_core_private.h
@@ -413,6 +413,7 @@ struct qdr_connection_t {
     qdr_conn_identifier_t      *conn_id;
     bool                        strip_annotations_in;
     bool                        strip_annotations_out;
+    int                         link_capacity;
     int                         mask_bit;
     qdr_connection_work_list_t  work_list;
     sys_mutex_t                *work_lock;

http://git-wip-us.apache.org/repos/asf/qpid-dispatch/blob/ceb3b389/src/router_node.c
----------------------------------------------------------------------
diff --git a/src/router_node.c b/src/router_node.c
index 23b2602..530ca9f 100644
--- a/src/router_node.c
+++ b/src/router_node.c
@@ -45,7 +45,8 @@ static void qd_router_connection_get_config(const qd_connection_t  *conn,
                                             qdr_connection_role_t  *role,
                                             const char            **name,
                                             bool                   *strip_annotations_in,
-                                            bool                   *strip_annotations_out)
+                                            bool                   *strip_annotations_out,
+                                            int                    *link_capacity)
 {
     if (conn) {
         const qd_server_config_t *cf = qd_connection_config(conn);
@@ -53,6 +54,8 @@ static void qd_router_connection_get_config(const qd_connection_t  *conn,
         *strip_annotations_in  = cf ? cf->strip_inbound_annotations  : false;
         *strip_annotations_out = cf ? cf->strip_outbound_annotations : false;
 
+        *link_capacity = cf->link_capacity;
+
         if        (cf && strcmp(cf->role, router_role) == 0) {
             *strip_annotations_in  = false;
             *strip_annotations_out = false;
@@ -496,15 +499,16 @@ static void AMQP_opened_handler(qd_router_t *router, qd_connection_t *conn, bool
     qdr_connection_role_t  role = 0;
     bool                   strip_annotations_in = false;
     bool                   strip_annotations_out = false;
+    int                    link_capacity = 1;
     const char            *name = 0;
     pn_connection_t       *pn_conn = qd_connection_pn(conn);
 
     qd_router_connection_get_config(conn, &role, &name,
-                                    &strip_annotations_in, &strip_annotations_out);
+                                    &strip_annotations_in, &strip_annotations_out, &link_capacity);
 
     qdr_connection_t *qdrc = qdr_connection_opened(router->router_core, inbound, role, name,
                                                    pn_connection_remote_container(pn_conn),
-                                                   strip_annotations_in, strip_annotations_out);
+                                                   strip_annotations_in, strip_annotations_out, link_capacity);
 
     qd_connection_set_context(conn, qdrc);
     qdr_connection_set_context(qdrc, conn);


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org