I have a use case where I need to count every request arriving to all endpoints of my services on Kubernetes. For example

**endpoint**                      **counter**
addr:port/a:                     1
addr:port/a/pathX:               4
addr:port/a/pathY:               5
addr:port/a/pathY/subpathM:      7
addr:port/b:                     3
addr:port/b/another-path:        7

Currently, I'm using a custom reverse-proxy that I've implemented in Go, but it has a terrible performance. My server can handle roughly handle ~16k RPS, with Envoy ~15.8k, with Traefik ~12k, and with my implementation ~2k :(

Envoy (or even Traefik) has much better performance than my proxy but AFAIK they can't count hits to endpoints as I need. This counters should be exposed as metrics to be scraped by Prometheus.

Have Envoy or Traefik this feature that I need? If yes, how can I use it? If they don't, there is another proxy with this feature? Perhaps Nginx or HAproxy.

In case of doesn't exists a proxy with this feature, which GoLang HTTP library has best performance to implement this kind of proxy?

My deployment is made on Kubernetes and the proxy is supposed to be a sidecar of each pod of my system. Performance is a must and it is better if it have a small memory footprint.

Any idea is welcome :-)


Well, as no one came with a suggestion I will post myself a solution for my question ¯\_(ツ)_/¯

I leverage FastHTTP, a low latency HTTP library in GoLang, to implement my own reverse proxy. In my experiments, I got a performance close to Envoy that is good enough for my use case. However, FastHTTP isn't enabled for HTTP/2.0, thus in a near future I'll have to update my architecture with another custom reverse proxy.

performance comparation of different reverse-proxies

I used this comment to scaffold my reverse-proxy implementation. It was quite simple to put everything working.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.