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 18:52:45 UTC

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

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

 ##########
 File path: blueprints/flexible-topologies.md
 ##########
 @@ -0,0 +1,395 @@
+<!--
+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 the Delivery Service form will need to be updated to add a new Topology field for assigning a Delivery Service to a Topology. If a Delivery Service is assigned to a Topology, Traffic Portal should prohibit assigning `EDGE` servers to the Delivery Service (`ORIGIN` servers may still need to be assignable for MSO).
+
+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 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)
+
+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",
+            "parents": [1, 2]
+        },
+        {
+            "cachegroup": "parent-cachegroup",
+            "parents": []
+        },
+        {
+            "cachegroup": "secondary-parent-cachegroup",
+            "parents": []
+        }
+    ]
+}
+```
+
+response JSON:
+```JSON
+{
+    "alerts": [
+        {
+            "text": "topology was updated 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": []
+            }
+        ]
+    }
+}
+```
+
+##### `DELETE /topologies?name=foo`
+
+response JSON:
+```JSON
+{
+    "alerts": [
+        {
+            "text": "topology was deleted successfully",
+            "level": "success"
+        }
+    ]
+}
+```
+
+##### `/deliveryservices` endpoints
+
+All relevant Delivery Service APIs will have their JSON request and response objects modified to include a new `topology` field which references the name of the topology it's assigned to:
+```JSON
+{
+    ...
+    "topology": "foo"
+}
+```
+
+##### The various `/snapshot` endpoints
+
+The various `/snapshot` endpoints will need to be updated to include new Topologies data along with their associations to Delivery Services in the `CRConfig.json` snapshot. The data should only include the `EDGE_LOC` cachegroups of the Topologies, because those are all Traffic Router needs.
+
+##### Various endpoints that are affected by cachegroup parentage or deliveryservice-server assignment
+
+API endpoints that do things such as the following may need to be updated to take Topology-based Delivery Service assignment and parentage into account:
+- assign a Delivery Service to a server (or vice versa)
+- return the servers that are assigned to a Delivery Service (or vice versa)
+- perform an operation on "child" cachegroups -- like queueing updates on "child" caches when changing the status of a "parent" cache
+
+#### Client Impact
+
+New Go client methods will be added for the `/topologies` endpoints in order to write TO API tests for the new endpoints. The `/deliveryservices` client methods won't need modified as the new `Topology` field will simply be added to the `DeliveryService` struct. New client methods for the Python client will also be added for each of the new `/topologies` endpoints.
+
+#### Data Model Impact
 
 Review comment:
   So what about when we need to add a header rewrite to adjust the ATS behavior on a second mid tier?

----------------------------------------------------------------
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