You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@trafficcontrol.apache.org by GitBox <gi...@apache.org> on 2020/04/02 17:21:27 UTC

[GitHub] [trafficcontrol] rawlinp commented on a change in pull request #4537: Add blueprint for Flexible Topologies

rawlinp commented on a change in pull request #4537: Add blueprint for Flexible Topologies
URL: https://github.com/apache/trafficcontrol/pull/4537#discussion_r402480788
 
 

 ##########
 File path: blueprints/flexible-topologies.md
 ##########
 @@ -0,0 +1,426 @@
+<!--
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements.  See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership.  The ASF licenses this file
+to you under the Apache License, Version 2.0 (the
+"License"); you may not use this file except in compliance
+with the License.  You may obtain a copy of the License at
+
+    http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing,
+software distributed under the License is distributed on an
+"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+KIND, either express or implied.  See the License for the
+specific language governing permissions and limitations
+under the License.
+-->
+
+# Flexible Topologies
+
+## Problem Description
+
+Today, a Traffic Control CDN is limited to 2 tiers -- *EDGE* and *MID* -- with the option to skip the *MID* tier for certain Delivery Service types (e.g. `HTTP_LIVE` and `HTTP_NO_CACHE`). In addition, a CDN is limited to one global parent hierarchy, which is defined via the `parent_cachegroup` and `secondary_parent_cachegroup` fields of cachegroups. Both of these problems limit a CDN's ability to scale with increased demand and changing usage patterns, and providing the ability to add more tiers to a CDN helps it keep up with that growth. A Topology that works well for one set of Delivery Services might not be ideal for a different set of Delivery Services, and a CDN needs the flexibility to provide the best Topology for any given Delivery Service -- with any number of tiers and custom caching hierarchies.
+
+## Proposed Change
+
+Traffic Control will provide the ability to define one or more Topologies, and a Topology can have any number of Delivery Services assigned to it. A Topology will be composed of Cachegroups along with their primary/secondary parent relationships to other Cachegroups as defined by the Topology.
+
+If a Delivery Service is assigned to a Topology, any `deliveryservice_server` assignments it has to `EDGE` caches will be ignored, because it will be assigned to all caches in the Delivery Service's CDN (filtered by server capabilities) that belong to the Topology's cachegroups. Ideally, this feature will obsolete legacy `deliveryservice_server` assignments, since Topologies negate the need to assign Delivery Services to individual `EDGE` caches. Nonetheless, legacy `deliveryservice_server` assignments will be supported alongside Topology-based Delivery Services for some time until all Delivery Services have been migrated to Topologies.
+
+### Traffic Portal Impact
+
+Traffic Portal will need new pages for:
+- creating and viewing Topologies (and since TP sidebar menu currently has "Topology" as an item already, that may need to be renamed if "Topologies" is going to be a sub-menu item of that)
+
+Existing Traffic Portal pages will need to be updated:
+- all the delivery services and delivery service requests views, to include the new `topology` field
+- delivery service server assignment views should prohibit assigning `EDGE` servers to a delivery service that has a Topology assigned already (`ORIGIN` servers may still need to be assignable for MSO purposes)
+- the CDN snapshot view, in order to account for a new top-level section (`topologies`) in the `CRConfig`
+
+Since Delivery Services will no longer be constrained to one global Topology as they are today, it would be extremely useful to be able to visualize a Delivery Service's Topology like a tree, where each node in the tree is a cachegroup, and the edges between nodes are the primary/secondary parent relationships between them. Clicking on a particular node would show all the servers in that cachegroup that could serve a request for the Delivery Service. This visualization will most likely be different from the Topology form for creating a Topology and does not necessarily need to be provided by Traffic Portal.
+
+### Traffic Ops Impact
+
+Traffic Ops will provide the ability to create Topologies, composed of cachegroups and parent relationships, which will be assignable to one or more Delivery Services.
+
+#### REST API Impact
+
+The following is the JSON representation of a `Topology` object:
+
+```JSON
+{
+    "name": "foo",
+    "description": "a foo topology",
+    "nodes": [
+        {
+            "cachegroup": "child-cachegroup",
+            "parents": [1, 2]
+        },
+        {
+            "cachegroup": "parent-cachegroup",
+            "parents": []
+        },
+        {
+            "cachegroup": "secondary-parent-cachegroup",
+            "parents": []
+        }
+    ]
+}
+```
+
+The following table describes the top-level `Topology` object:
+
+| field       | type                        | optionality | description                                                         |
+| ----------- | --------------------------- | ----------- | ------------------------------------------------------------------- |
+| name        | string                      | required    | a unique name for identifying this Topology                         |
+| description | string                      | required    | the description of this Topology                                    |
+| nodes       | array of `node` sub-objects | required    | the set of `nodes` in this topology, similar to an *adjacency list* |
+
+The following table describes the `node` sub-object:
+
+| field      | type              | optionality | description                                                                                                                                                                                                 |
+| ---------- | ----------------- | ----------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
+| cachegroup | string            | required    | the `short_name` of a cachegroup this node maps to in the Topology                                                                                                                                          |
+| parents    | array of integers | required    | zero-based indexes to other nodes in the Topology's `nodes` array, where the 1st element is for the *primary* parent relationship and the 2nd element is for the *secondary* parent relationship, and so on |
+
+API constraints:
+- a Topology's `name` must consist of alphanumeric or hyphen characters
+- a Topology must have at least 1 `node`; otherwise, it is useless
+- there cannot be multiple `nodes` for the same cachegroup in a Topology
+- `parents` must have 0, 1 or 2 elements, cannot contain duplicates, cannot contain the index of its own `node`, and cannot contain the index of `nodes` whose cachegroup is of type `EDGE_LOC`
+- leaf `nodes` must be cachegroups of type `EDGE_LOC`
+- all `nodes` in the Topology must be reachable -- i.e. a `node` is either a leaf (which would be an `EDGE_LOC`) or is a parent of at least one other node
+- a Topology cannot contain a cycle (through any combination of primary/secondary parent relationships)
+- a Topology cannot be deleted if one or more Delivery Services are still assigned to it
+- a Cachegroup cannot be deleted if it is currently being used in a Topology
+- a Topology cannot have `STEERING` or `CLIENT_STEERING` delivery services assigned to it (because those types are not assigned to caches -- their _targets_ are)
+
+The following new endpoints will be required:
+
+##### `GET /topologies`
+
+response JSON:
+```JSON
+{ "response": [
+    {
+        "name": "foo",
+        "description": "a foo topology",
+        "nodes": [
+            {
+                "cachegroup": "child-cachegroup",
+                "parents": [1, 2]
+            },
+            {
+                "cachegroup": "parent-cachegroup",
+                "parents": []
+            },
+            {
+                "cachegroup": "secondary-parent-cachegroup",
+                "parents": []
+            }
+        ]
+    }
+]}
+```
+
+##### `POST /topologies`
+
+request JSON:
+```JSON
+{
+    "name": "foo",
+    "description": "a foo topology",
+    "nodes": [
+        {
+            "cachegroup": "child-cachegroup",
+            "parents": [1, 2]
+        },
+        {
+            "cachegroup": "parent-cachegroup",
+            "parents": []
+        },
+        {
+            "cachegroup": "secondary-parent-cachegroup",
+            "parents": []
+        }
+    ]
+}
+```
+
+response JSON:
+```JSON
+{
+    "alerts": [
+        {
+            "text": "topology was created successfully",
+            "level": "success"
+        }
+    ],
+    "response": {
+        "name": "foo",
+        "description": "a foo topology",
+        "nodes": [
+            {
+                "cachegroup": "child-cachegroup",
+                "parents": [1, 2]
+            },
+            {
+                "cachegroup": "parent-cachegroup",
+                "parents": []
+            },
+            {
+                "cachegroup": "secondary-parent-cachegroup",
+                "parents": []
+            }
+        ]
+    }
+}
+
+```
+
+##### `PUT /topologies?name=foo`
+
+request JSON:
+```JSON
+{
+    "name": "foo",
+    "description": "a foo topology",
+    "nodes": [
+        {
+            "cachegroup": "child-cachegroup",
 
 Review comment:
   So we discussed this offline a bit already, and it sounds like we're just going to use the results of `GET /cachegroups` rather than including that in the topology resource.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services