DEV Community


Discussion on: Fiber released v1.7! 🎉 What's new and is it still fast, flexible and friendly?

fenny profile image
Fenny • Edited

Hi Luca, I'm one of the authors of Fiber and I will try to answer your questions.

  1. Why use fasthttp over net/http?
    The worker pool model is a zero allocation model, as the workers are already initialized and are ready to serve, whereas in the net/http implementation the go c.serve() has to allocate memory for the goroutine.
    The handler function definition signature is better, as it takes in only a context which includes both the request and writer needed by the handler.
    Overall fasthttp is a zero allocation model with a low memory footprint.

  2. Lack of HTTP/2 support
    Proxies/load-balancers like nginx, cloudflare ...etc take care of the HTTP/2 requests from the client browser. Most proxies do not support the HTTP/2 protocol from and to origin servers, since most web apps are behind a proxy/load-balancer this should not be a problem.

  3. "hackish", implementation of WebSockets
    I'm not sure what you mean with "hackish" but Fiber uses and this is a fast, well-tested and widely used WebSocket implementation for Go.

  4. Where and when should I use Fiber over something like Echo?
    If you need raw performance with a low memory footprint.
    If you ever worked with Expressjs (Fiber has a similair API).
    In the end it's up to you where you feel more comfortable

I hope I answered your questions, and if you have more feel free to ask!

lucafmarques profile image
Luca F. Marques

Thanks for the awesome reply Fenny.

Hadn't thought about how proxies and load-balancers can help with the lack of HTTP/2 support.
The worker pool model is great, wonder why it couldn't be adopted by the standard lib, probably some lower level problem I'm not currently aware of.

As for Fiber, are you guys tackling documentation right now? I found the lack of a godoc page to slow my efforts in messing with the framework. Does the team need any help in this aspect?

Anyhow, thanks for the response and I wish the team good luck!

Thread Thread
fenny profile image
Fenny • Edited

No problem!

We have an extended online API documentation:
I forgot to add some benchmark sources that might change your mind to use fiber versus other frameworks:

JSON serialization
Data updates

Forem Open with the Forem app