Skip to main content

Routing Architecture

In Gearbox ⚙️, we rely on Radix Tree algorithm for matching requests with user registered handlers (routing) and it's split in two phases

  • Constructing Radix Tree
  • Matching requests with user registered handlers using tree (our optimization focus is here to serve as fast as possible)

When user starts service, gearbox constructs a tree of prefixes by splitting each registered path by slash "/". Each node in tree represents a URL part (Keyword) and contains all information needed for routing (e.g. is this node will be used for match all, available methods and user registered handlers, middlewares, etc.)