Next Hop selection John Rushford jrushfordapache org Next

  • Slides: 13
Download presentation
Next Hop selection John Rushford jrushford@apache. org

Next Hop selection John Rushford jrushford@apache. org

Next Hop selection definitions • A remap strategy – is an object that implements

Next Hop selection definitions • A remap strategy – is an object that implements a policy such as round robin or consistent hashing to search for and provide the ATS state machine with the name of an available upstream cache for to use to complete a transaction. • ring or group – one or more lists of ATS proxy caches managed by a strategy (parent and secondary parents list in Parent. Selection.

Next Hop Selection • Refactor of the parent selection used in ATS Hierarchical caching.

Next Hop Selection • Refactor of the parent selection used in ATS Hierarchical caching. • Backwards compatible in terms of functionality. • Designed to eventually replace parent selection and its parent. config file. • Uses YAML configuration files. • Adds more hash key options for use with consistent hashing. • Adds additional failover host groups or rings. • Performance improvements, strategy pointer is assigned when the remap. config is parsed. No need to search the parent table. • Next. Hop selection may be used in place of parent. config per remap entry with the @strategy parameter remap. config

Next Hop Selection • New records. config variable, proxy. config. url_remap. strategies. filename (default

Next Hop Selection • New records. config variable, proxy. config. url_remap. strategies. filename (default filename is “strategies. yaml” • New remap. config parameter @strategy=“strategy name” associates a Next. Hop. Selection. Strategy instance with a ”remap” entry map http: //foo. com http: //origin. foo. com @strategy=foo. com @plugin=header_rewrite. so • Eliminates the need to search the parent config table when searching for an upstream cache to handle a request. • A Next. Hop. Selection. Strategy instance configured on a remap entry overrides any Parent. Selection. Strategies configured in the parent. config table for the remap entry.

Simple strategy configuration. strategies: - strategy: ‘mid-tier-1’ policy: consistent_hash_key: cache_key groups: - &g 1

Simple strategy configuration. strategies: - strategy: ‘mid-tier-1’ policy: consistent_hash_key: cache_key groups: - &g 1 - host: proxy 1. foo. com protocol: - scheme: http port: 80 health_check_url: http: //192. 168. 1. 1: 80 weight: 0. 5 - host: proxy 2. foo. com. . . scheme: http failover: ring_mode: exhaust_ring health_check: - passive

Http. Transact <<Next. Hop. Selection. Strategy>> +find. Next. Hop() +mark. Next. Hop. Down() +mark.

Http. Transact <<Next. Hop. Selection. Strategy>> +find. Next. Hop() +mark. Next. Hop. Down() +mark. Next. Hop. Up() Remap. Config @strategy=“strategy-name” uses Next. Hop. Consistent. Hash Next. Hop. Round. Robin Next. Hop. Strategy. Factory creates / owns strategies. yaml

Next. Hop selection strategy classes. • Next. Hop. Selection. Strategy – Base class, does

Next. Hop selection strategy classes. • Next. Hop. Selection. Strategy – Base class, does some YAML parsing, and configuration. Defines API functions. • Next. Hop. Consistent. Hash – Derives from Next. Hop. Selection. Strategies and is a re-implementation of Parent. Consistent. Hash providing similar functionality but with more consistent hash rings and hashing key options. • Next. Hop. Round. Robin – Derives from Next. Hop. Selection. Strategies and is a re-implementation of the Parent. Round. Robin class with new functionality (failover rings). • Next. Hop. Strategy. Factory – loads and configures instances of Next. Hop. Selection. Strategies for use by remap and Http. Transact.

Next Hop Selection – strategies. yaml • A YAML document defining all Next Hop

Next Hop Selection – strategies. yaml • A YAML document defining all Next Hop Selection strategies. • Strategies may be defined across several different files • Files are concatenated by the Next. Hop. Selection. Factory into a single YAML document using ‘#include filename’. • Sample configs at: proxy/http/remap/unit-tests A strategies. yaml example #include hosts. yaml #include groups. yaml strategies: #include strategies-list. yaml

Example hosts. yaml • A YAML map of proxy host definitions, it’s use is

Example hosts. yaml • A YAML map of proxy host definitions, it’s use is optional. • It’s use requires using YAML “anchors”. • Top level name space “hosts” hosts: &proxy 1: proxy 1. foo. com protocol: - scheme: http port: 80 health_check_url: http: //192. 168. 1. 1: 80 - scheme: https port: 443 health_check_url: https: //192. 168. 1. 1: 443

Example groups. yaml • A YAML list of group definitions. It’s use is optional.

Example groups. yaml • A YAML list of group definitions. It’s use is optional. • A group is an array of host definitions corresponding to the consistent hash rings used in parent. config • It’s use requires using YAML anchors and references. groups: - &g 1 - <<: *proxy 1 weight: 0. 5 # extend operator (<<), used to add data to a referenced object # extended proxy 1 reference with a weight parameter. - <<: *proxy 2 weight: 0. 5 - &g 2 - ……. .

Example strategies • YAML list of strategies, required • Each strategy has a name.

Example strategies • YAML list of strategies, required • Each strategy has a name. The strategy is retrieved from the Next. Hop. Strategy. Factory by name #include hosts. yaml #include groups. yaml strategies: - strategy: ‘mid-tier-1’ policy: consistent_hash_key: cache_key groups: - *g 1 # refers to group, g 1’ - *g 2 protocol: http failover: ring_mode: exhaust_ring response_codes: - 404 health_check: - passive

Strategy parameters • strategy: ‘name-of-strategy’ - a named strategy definition • policy: - one

Strategy parameters • strategy: ‘name-of-strategy’ - a named strategy definition • policy: - one of rr_ip, first_live, rr_strict, latched, or consistent_hash • hash_key: - one of hostname, url, path_query, cache_key, or path+fragment • go_direct: - true or false. Transactions may be routed directly to the origin, default is true • parent_is_proxy: true or false. All hosts in the host groups are proxies vs origins, default is true (proxies) • groups: a list of host rings definitions • protocol: protocol for the remap strategy, http or https (default http) • failover: failover definition • • • max_simple_retries: maximum number of simple retries, defaults to 1. ring_mode: exhaust_ring or alternate_ring. exhaust_ring tries all hosts in a ring before moving to next group. alternate_ring alternates between groups to find an available host. Default is exhaust_ring. response_codes: list of response codes that may be retried using another host.

Status • PR #5960 (Under review) - Add Nexthop selection strategies and @strategy tag

Status • PR #5960 (Under review) - Add Nexthop selection strategies and @strategy tag to remap. config. • Targeted for ATS 9. 1 • Future work – add support for Next. Hop. Selection. Strategy plugins.