saucelabs / forwarder

Forwarder is a production-ready, fast MITM proxy with PAC support. It's suitable for debugging, intercepting and manipulating HTTP traffic. It's used as a core component of Sauce Labs Sauce Connect Proxy.
https://forwarder-proxy.io
Mozilla Public License 2.0
221 stars 13 forks source link

perf: use go routine pooling #663

Closed mmatczuk closed 4 months ago

mmatczuk commented 7 months ago

As we know from metrics Forwarder can be heavy on Go routines.

I suggest we use a go routine pool, more specifically https://github.com/panjf2000/ants - one of more mature implementation - it is used in gnet project.

Using gnet is out to scope at this point, it does not support TLS among other things.

Choraden commented 4 months ago

796 has shown that ants give little to no improvement in CPU/memory usage, while increasing code complexity and adding a dependency.

It might be that the go runtime has improved or Forwarder is smart enough not to waste resources, so that the runtime has room to handle the goroutines seamlessly