Sawtooth Router

Motivation

Provide a router that can detect and report route conflicts.

Why use it?

Sawtooth is similar to Prefix Tree in how it generally operates, and is nearly as fast — within 5 to 10% of prefix-tree in benchmarks, and on the order of a micro- (not milli-) second to route a request.

Further, when the routing table consists only of static paths (that is, no path parameters), Sawtooth has performance nearly as fast as Map Tree Router (a fraction of a micro-second to route a request).

Sawtooth’s distinguishing characteristic is that it will, at startup, write (to standard error) a report describing any conflicting routes. This gives you, as the developer, feedback about routing problems.

sawtooth report

How to use it?

Sawtooth is the default router; it will be used when no value is specified for the :io.pedestal.http/router key of the service map.

Caveats

The behavior of Sawtooth is not defined when there are route conflicts; prefix-tree expressly favors paths with path parameters over paths that are entirely static.

Additional Notes

Like the prefix-tree and map-tree routers, query and path constraints are not used in routing decisions. They are only used to invalidate a route match.

References