Skip to content

Debugging Path Costs

Paul Lorenz edited this page Oct 19, 2023 · 2 revisions

When trying to figure out why specific paths are selected, here are places to start investigating.

Services

ziti edge list services

$ ziti edge list services
╭────────────────────────┬──────┬────────────┬─────────────────────┬────────────╮
│ ID                     │ NAME │ ENCRYPTION │ TERMINATOR STRATEGY │ ATTRIBUTES │
│                        │      │  REQUIRED  │                     │            │
├────────────────────────┼──────┼────────────┼─────────────────────┼────────────┤
│ 6S0bCGWb6yrAutXwSQaLiv │ test │ true       │ smartrouting        │ goodbye    │
│                        │      │            │                     │ hello      │
│ 6dmu7CFXJZtpUKD9VeSWqM │ echo │ true       │ smartrouting        │ echo       │
╰────────────────────────┴──────┴────────────┴─────────────────────┴────────────╯
results: 1-2 of 2

Main thing to look at here is the terminator strategy. Note that all strategies pick from the terminators at the highest precedence level.

  • smartingrouting - always use lowest cost path
  • random - randomly pick from available terminators
  • weighted - random but weighted by cost. So if the first terminator has cost 10 and the second has cost 20, the first will get selected about twice as often as the second

Terminators

ziti fabric list terminators

$ ziti fabric ls terminators 
╭────────────────────────┬─────────┬───────────────┬─────────┬────────────────────────┬──────────┬──────┬────────────┬──────────────┬────────────╮
│ ID                     │ SERVICE │ ROUTER        │ BINDING │ ADDRESS                │ INSTANCE │ COST │ PRECEDENCE │ DYNAMIC COST │ HOST ID    │
├────────────────────────┼─────────┼───────────────┼─────────┼────────────────────────┼──────────┼──────┼────────────┼──────────────┼────────────┤
│ 7IiI5Q8BMHlWEHONjgoJFA │ echo    │ edge-router-1 │ edge    │ 7IiI5Q8BMHlWEHONjgoJFA │          │    0 │ default    │            0 │ Qk7EP3nHDW │
│ bvUb1oa0ivl05TboGa9oZ  │ echo    │ edge-router-2 │ edge    │ bvUb1oa0ivl05TboGa9oZ  │          │    0 │ default    │            0 │ Qk7EP3nHDW │
╰────────────────────────┴─────────┴───────────────┴─────────┴────────────────────────┴──────────┴──────┴────────────┴──────────────┴────────────╯
results: 1-2 of 2
  • binding - what is hosting the services
    • tunnel - edge router/tunneler
    • edge - edge sdk application, might be tunneler or something else
    • transport - direct edge router
  • cost - static cost, controlled by sdk
  • precedence - one of required, default or failed
  • dynamic cost - goes up as more circuits use a terminator or when there are dial failures to a terminator

Links

ziti fabric list links

$ ziti fabric list links
╭────────────────────────┬───────────────┬───────────────┬─────────────┬─────────────┬─────────────┬───────────┬────────┬───────────╮
│ ID                     │ DIALER        │ ACCEPTOR      │ STATIC COST │ SRC LATENCY │ DST LATENCY │ STATE     │ STATUS │ FULL COST │
├────────────────────────┼───────────────┼───────────────┼─────────────┼─────────────┼─────────────┼───────────┼────────┼───────────┤
│ 1WcuQnm1eZxOouTOBWA829 │ edge-router-2 │ edge-router-1 │           1 │       1.9ms │       2.7ms │ Connected │     up │         4 │
╰────────────────────────┴───────────────┴───────────────┴─────────────┴─────────────┴─────────────┴───────────┴────────┴───────────╯
results: 1-1 of 1

Links are the router to router connections that make up the mesh.

  • full cost - calculated as cost + src latency + dst latency

Routers

ziti edge list edge-routers or ziti fabric list routers

$ ziti edge ls ers
╭────────────┬───────────────┬────────┬───────────────┬──────┬────────────────╮
│ ID         │ NAME          │ ONLINE │ ALLOW TRANSIT │ COST │ ATTRIBUTES     │
├────────────┼───────────────┼────────┼───────────────┼──────┼────────────────┤
│ 38esMCa98K │ edge-router-3 │ false  │ true          │    0 │                │
│ 5uUxuQ3u6Q │ edge-router-2 │ true   │ true          │    0 │ demo           │
│            │               │        │               │      │ demo-host      │
│ LvEVacBGn  │ edge-router-4 │ false  │ true          │    0 │                │
│ tNlYWQ3upQ │ edge-router-1 │ true   │ true          │    0 │ demo           │
│            │               │        │               │      │ demo-intercept │
╰────────────┴───────────────┴────────┴───────────────┴──────┴────────────────╯
results: 1-4 of 4

Each router also has an associated cost.

When ziti is picking a path, it calculates the full path cost which is the cost of the routers, links and terminators in the path.

Circuits

You can also see the current circuits.

$ ziti fabric list circuits
╭───────────┬───────────────────────────┬─────────┬───────────────────────┬─────────────────╮
│ ID        │ CLIENT                    │ SERVICE │ TERMINATOR            │ PATH            │
├───────────┼───────────────────────────┼─────────┼───────────────────────┼─────────────────┤
│ g1zozLMor │ clnx961v800jeejgd9q8lbry5 │ echo    │ bvUb1oa0ivl05TboGa9oZ │ r/edge-router-2 │
╰───────────┴───────────────────────────┴─────────┴───────────────────────┴─────────────────╯
results: 1-1 of 1

Hopefully this will give you some insight into why your paths are the way they are. If you look at it and it still doesn't make sense, and you're ok sharing some information, please share your services/routers/terminators, links and a questionable circuit in discourse and we can take a look. Hopefully we can either explain it or it will point towards a bug.

Clone this wiki locally