Pedestal

Using the Built-in Routers

As documented in the Routing Quick Reference, Pedestal provides three routing implementations: Linear Search, Prefix Tree and Map Tree. While the Map Tree router is the default router, you can specify the router Pedestal uses by adding the :io.pedestal.http/router key to the Service Map with one of the following keyword values:

  • :map-tree

  • :prefix-tree

  • :linear-search

Router Performance Scaling in # Routes Limitations

Map Tree (default after 0.5.2)

Very fast

Constant

Applies when all routes are static. Falls back to prefix tree if any routes have path parameters or wildcards.

Prefix Tree (default prior to 0.5.2)

High performance, space efficient

Log32(N)

Wildcard routes always win over explicit paths in the same subtree. E.g., /path/:wild will always match, even if /path/user is defined

Linear Search

Lowest performance

O(N)

Routes are checked in order. Precedence is precise.