How to Fiber (5 Part Series)
Good news, everyone! 😉 We did it! Fiber version
1.8.43 scored awesome benchmark results! Now we hold a strong third place on TechEmpower as a full fledged Golang HTTP framework!
❗️ This post is not about if Fiber is faster than Express, this is obvious since Node.js is an interpreted language, while Golang is a compiled language.
☝️ We mainly focus on testing Fiber versus other Go frameworks with the following disciplines: plaintext, data updates, multiple queries, single query and of course, JSON serialization! 😎
- A few words about Fiber and Express
- Config of test stand
- Benchmark results
- The choice is obvious
- Is it worth to switch to Go?
- Do you like Fiber?
- Your assistance to project
First of all, me and all Fiber authors love Express so much and made a lot of projects with it! But, Fiber is different.
- CPU Intel Xeon Gold 5120 @2,20 GHz
- MEM 32 GB
- GO go1.13.6 linux/amd64
- OS Linux
- DISK Enterprise SSD
- NET Dedicated Cisco 10-gigabit Ethernet switch
See Project Information Framework Tests Overview for more info.
The Plaintext test is an exercise of the request-routing fundamentals only, designed to demonstrate the capacity of high-performance platforms in particular.
- Requests will be sent using HTTP pipelining.
- The response payload is still small, meaning good performance is still necessary in order to saturate the gigabit Ethernet of the test environment.
✅ Fiber handled 6,162,556 resp./sec with an average latency of 2.0 ms.
✅ Express handled 367,069 resp./sec with an average latency of 354.1 ms.
The Database Updates test is a variation of the Multiple database queries that exercises the ORM's persistence of objects and the database driver's performance at running UPDATE statements or similar.
The spirit of this test is to exercise a variable number of read-then-write style database operations.
✅ Fiber handled 11,846 resp./sec with an average latency of 42.8 ms.
✅ Express handled 2,066 resp./sec with an average latency of 390.44 ms.
The Multiple Database Queries test is a variation of Single Database Query test and also uses the World table. Multiple rows are fetched to more dramatically punish the database driver and connection pool.
At the highest queries-per-request tested (20), this test demonstrates all frameworks' convergence toward zero requests-per-second as database activity increases.
✅ Fiber handled 19,664 resp./sec with an average latency of 25.7 ms.
✅ Express handled 4,302 resp./sec with an average latency of 117.2 ms.
The Single Database Query test exercises the framework's object-relational mapper (ORM), random number generator, database driver, and database connection pool.
✅ Fiber handled 368,647 resp./sec with an average latency of 0.7 ms.
✅ Express handled 57,880 resp./sec with an average latency of 4.4 ms.
The JSON Serialization test exercises the framework fundamentals including keep-alive support, request routing, request header parsing, object instantiation, JSON serialization, response header generation, and request count throughput.
✅ Fiber handled 1,146,667 resp./sec with an average latency of 0.4 ms.
✅ Express handled 244,847 resp./sec with an average latency of 1.1 ms.
If you haven't tried running your web projects in Go, Fiber might be the right framework for you!
It really depends on the use case. But it might benefit, if you need more performance.
Fiber authors are always listening to its users in issues and all over the Internet. Therefore, it would be great, if you could share your opinion or/and experience with Fiber to authors in GitHub repository!
[...] because it's only right way to create a fast, flexible and friendly Go web framework for any tasks, deadlines and developer skills!
— Fiber Authors
- Add a GitHub Star to project.
- Tweet about Fiber on your Twitter.
- Help to translate
READMEand API Docs to another language (at this moment, Fiber was translated to 10 languages).
[Title] Sonic from the Google Pictures
 Ashley McNamara https://github.com/ashleymcnamara/gophers
If you want more — write a comment below & follow me. Thx! 😘