Improve routing and path building CPU and memory efficiency

Context

This is a followup from gitlab-com/gl-infra/scalability#479.

Problem

Now that the Stackdriver profiler was added to the registry and enabled for GitLab.com, the CPU time and allocated heap flame graphs are showing that we're spending more resources in routing and path building than what would be (theoretically) desirable:

CPU:

image

Allocated heap:

image

This seems to be closely related with the custom route definition and path building logic that is used on the API handlers.

Solution

A quick win would be achieving a considerable improvement by bumping some related (and outdated) dependency libs, which we already did in !378 (merged) but not yet released. We should release these upgrades and see if that makes any difference.

However, considering the existing nature of the routing and path building logic (e.g. registry/api/v2/urls.go and registry/api/v2/descriptors.go), the ultimate improvement will likely come from a (much needed) rewrite.

Edited by João Pereira