from Hacker News

Gnet is the fastest networking framework in Go

by mfru on 3/14/24, 7:14 PM with 16 comments

  • by tutfbhuf on 3/14/24, 10:26 PM

    People in the Go community often respond with "use net/http for building web apps", the standard library is good enough and has better support in the long run. This is good advice in most cases. However, if you are using Go for API building and explicitly want to squeeze out every little bit of performance, then there are much faster libraries available than the standard net/http. Gnet is one such example.
  • by Akronymus on 3/14/24, 10:40 PM

    And what are the downsides? Hard to maintain code? Having to deeply integrate the code to get the advertised performance?

    Also: "Multiple Porotocols"

    Oh, there it is on the github: "Note that the HTTP implementation of gnet on TechEmpower is half-baked and fine-tuned for benchmark purposes only and far from production-ready."

  • by weitendorf on 3/14/24, 10:59 PM

    https://gnet.host/docs/about/overview/ - This is a very similar threading model to envoy [0] and lmax disruptor [1]. Unfortunately IIUC writing this in Go still prevents the spin-locked acceptor thread from achieving the kind of performance you could get in a non-GC language, unless you chose to disable GC, so I'd guess Envoy is still faster.

    https://gnet.host/docs/quickstart/ it's nice that you can use this simply though. Envoy is kind of tricky to setup with custom filters, so most of the time it's just a standalone binary.

    [0] https://blog.envoyproxy.io/envoy-threading-model-a8d44b92231...

    [1] https://lmax-exchange.github.io/disruptor/#_what_is_the_disr...

  • by tazu on 3/14/24, 10:34 PM

    Is there an HTTP server library built on top of this? I'm getting tired of Fiber/FastHTTP.
  • by rmac on 3/15/24, 12:47 AM

    the perf is for plaintext? why not encoded?

    no quic / h3 ?

    love the work and that it's open source but let's push the envelope!

  • by latchkey on 3/15/24, 1:45 AM

    I built a tcp service using gnet and it was fantastic. I was really impressed with how easy it was to integrate with.
  • by linter on 3/15/24, 12:53 AM

    Lacking documentation. Take a look at Django if you want to learn how to write your documentation.
  • by bsaul on 3/14/24, 11:41 PM

    can you run grpc over it ?