2018-04-TC Summit-Golang Proxy.Pdf

2018-04-TC Summit-Golang Proxy.Pdf

Traffic Ops Go Rewrite Progress Dewayne Richardson [email protected] Original Initiative • Mojolicious Perl API Version 1.2 - (2010 - Present) • Perl to Go with the assumption of API compatibility • Minimize Deployment footprint (use the same rpms) • Design philosophy "override" through route mapping to "Strangle Out" the Perl !2 Traffic Control 2.1 !3 Traffic Ops 2.1 Features TC Summit Fall 2017 • 1.2 Go Proxy Conceived (July 13, 2017) • API Version 1.2 • Low Level Features • Configurable Logging • Go Perl Config parser • tocookie for backward compatibility to Mojolicious Perl • Add header (via wrapper) to Go endpoints • CORS headers • Unit Tests • Documentation !4 Traffic Control 2.2 !5 Traffic Ops 2.2 • API Versions 1.2 and 1.3 • CRUD Interfaces framework to standardize Postgres interaction • Login API - PR • Mojolicious Perl (still required) • Change Log Interface !6 Traffic Ops 2.2 • Tenancy - scope control of Delivery Services and Users • CHANGELOG.MD (https://github.com/apache/ incubator-trafficcontrol/blob/master/ CHANGELOG.md) • APIs are moving Semantic Versioning - Major.Minor.Patch • Consensus still needed !7 Traffic Ops Go Components (master) Traffic Router Traffic Monitor Traffic Stats Traffic Ops Client structs Integration Tests Traffic Ops Client /incubator-trafficcontrol/lib/go-tc Traffic Ops !8 Traffic Ops APIs by Language for TC Consumers Traffic Traffic Portal Traffic Router Monitor 14% 29% 50% 50% 86% 71% Traffic Stats ORT Go Perl 40% 45% 60% 55% Traffic Control 2.3 !10 Traffic Ops 2.3 • Collapse Traffic Ops Migrations • (remove JvD's slow migration 20170205101432_cdn_table_domain_name.go) • Fix camelCase Consistency • secondaryParentCachegroupId vs secondaryParentCacheGroupId !11 Traffic Ops 2.3 • Move away from “xmlId” (deliveryservice “name”) and “xmppId” (hash_id) • Correct Foreign Key naming conventions • Foreign Key ID's would be 'cdnId' vs. 'cdn' (database alignment changes would come later) !12 Lessons Learned • Go inexperience, discovering better ways for struct organization • Use of Anonymous Structs • (https://play.golang.org/p/ZbcTwLF_e2H) • Go's strong typing breaks the loosely typed Perl 1.2 API • nil struct field pointers • (https://github.com/apache/incubator-trafficcontrol/blob/ master/lib/go-tc/servers.go#L82) !13 Legacy Problems • Inconsistent Mojo Routes patterns make it a challenge to build consistent frameworks • Existing route patterns prevent proper matching to allow pass through to Perl • For Example: • /cdns vs /cdns/capacity • Move existing Traffic Control API Consumers away from the legacy 1.2 API !14 Traffic Ops Roadmap !15 Traffic Ops API Roadmap • The need for Traffic Ops API 2.0 • Bulk CRUDs using Array Json structures • Consistency will allow for Go scaffold generation • Top Down Design of the API with Swagger for consistency !16 Traffic Ops API Roadmap • Top Down Design of the API with Swagger for consistency • Phase out the TO clients in favor of TO client generation when needed from Swagger Tooling • Explore Swagger for Server Side Stub generation • pyswagger (Python), go-swagger (Go) !17 Traffic Ops API Roadmap • swagger-codegen - Available Languages (86) • android, aspnet5, aspnetcore, async-scala, bash, cwiki, csharp, cpprest, dart, elixir, flash, python-flask, go, groovy, java, jaxrs, jaxrs-cxf-client, jaxrs-cxf, jaxrs-resteasy, jaxrs- resteasy-eap, jaxrs-spec, jaxrs-cxf-cdi, inflector, javascript, javascript-closure-angular, jmeter, nancyfx, nodejs-server, objc, perl, php, python, qt5cpp, ruby, scala, scalatra, finch, silex-PHP, sinatra, rails5, slim, spring, dynamic-html, html, html2, swagger, swagger-yaml, swift, swift3, tizen, typescript-angular2, typescript-angular, typescript-node, typescript-fetch, akka-scala, CsharpDotNet2, clojure, haskell, lumen, go-server, erlang-server, undertow, msf4j, ze-ph !18 Traffic Ops API Roadmap • Hide the Traffic Ops database entirely behind the API • Remove dependency on "Join" tables through the API (for example “/profile_parameters”) • Atomic API's • Nested relationships within API JSON objects !19 Traffic Ops API Roadmap • Extensions through Proxying • Consider Postgres Views to potentially allow for TO database versioning • Refactor the “types” table • separate tables by “use_in_table” column to allow for type safety needs with Go (Go has no Generics) • reduces the use of constraints to help with data integrity !20 API Resources https://cwiki.apache.org/confluence/display/TC/API+Guidelines !21.

View Full Text

Details

  • File Type
    pdf
  • Upload Time
    -
  • Content Languages
    English
  • Upload User
    Anonymous/Not logged-in
  • File Pages
    21 Page
  • File Size
    -

Download

Channel Download Status
Express Download Enable

Copyright

We respect the copyrights and intellectual property rights of all users. All uploaded documents are either original works of the uploader or authorized works of the rightful owners.

  • Not to be reproduced or distributed without explicit permission.
  • Not used for commercial purposes outside of approved use cases.
  • Not used to infringe on the rights of the original creators.
  • If you believe any content infringes your copyright, please contact us immediately.

Support

For help with questions, suggestions, or problems, please contact us