惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

博客园 - 聂微东
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
L
LangChain Blog
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
博客园 - 司徒正美
WordPress大学
WordPress大学
T
The Blog of Author Tim Ferriss
Blog — PlanetScale
Blog — PlanetScale
J
Java Code Geeks
Y
Y Combinator Blog
H
Hackread – Cybersecurity News, Data Breaches, AI and More
GbyAI
GbyAI
Vercel News
Vercel News
大猫的无限游戏
大猫的无限游戏
T
Tailwind CSS Blog
Jina AI
Jina AI
B
Blog
Recorded Future
Recorded Future
MyScale Blog
MyScale Blog
I
InfoQ
aimingoo的专栏
aimingoo的专栏
博客园_首页
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
The Cloudflare Blog
雷峰网
雷峰网
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
腾讯CDC
爱范儿
爱范儿
Last Week in AI
Last Week in AI
博客园 - 三生石上(FineUI控件)
博客园 - Franky
Schneier on Security
Schneier on Security
V
V2EX
TaoSecurity Blog
TaoSecurity Blog
H
Hacker News: Front Page
Cloudbric
Cloudbric
D
DataBreaches.Net
B
Blog RSS Feed
P
Palo Alto Networks Blog
云风的 BLOG
云风的 BLOG
NISL@THU
NISL@THU
I
Intezer
Recent Commits to openclaw:main
Recent Commits to openclaw:main
Cyberwarzone
Cyberwarzone
F
Fortinet All Blogs
D
Darknet – Hacking Tools, Hacker News & Cyber Security
C
Cybersecurity and Infrastructure Security Agency CISA
C
Cisco Blogs
K
Kaspersky official blog
Forbes - Security
Forbes - Security

Dizzy zone

Pangolin Private Resources With Domain Https About Redis is fast - I'll cache in Postgres n8n and large files Malicious Node install script on Google search Wrapping Go errors with caller info BLAKE2b performance on Apple Silicon State of my Homelab 2025 My homelabs power consumption On Umami ML for related posts on Hugo Probabilistic Early Expiration in Go SQLC & dynamic queries Enums in Go Streaming Netdata metrics from TrueNAS SCALE SQL string constant gotcha Moving from Jenkins to Drone My new server: MSI Cubi 3 Silent My thoughts on Ansible® Profiling gin with pprof How I host this blog, CI and tooling Refactoring Go switch statements OAuth with Gin and Goth I made my own commenting server. Here's why. Why I hate OpenApi(swagger) IDE for GO Jenkins on raspberry pi 3 How I started my professional career Go's defer statement Self-hosted disqus alternative for 5$ a month Why I like go Speeding hexo (or any page) for PageSpeed insights Starting a blog with hexo and AWS S3
Kestrel vs Gin vs Iris vs Express vs Fasthttp on EC2 nano
Vik · 2018-01-24 · via Dizzy zone

Since this post got quite a bit of traction, I decided to update it by rerunning all the benchmarks as well as adding GO’s fasthttp and Node’s express to the comparison.

I came across this blog post on ayende.com. Here Oren Eini tries to see how far he could push a simple ipify style of api on an EC2 by running a synthetic benchmark. He hosts the http server on a T2.nano instance and then uses wrk to benchmark it from a T2.small instance. After reading this, I thought to myself - surely .NET cannot be quicker than GO. I decided to try and make a similar effort and get a little bit of competition going between a .NET implementation with, hopefully, a representative version of Oren’s .NET server made with GO. For GO - I went with 3 candidates gin, fasthttp and iris. I also benchmark Node’s Express. All the tests were performed on the same EC2 instance, with production/release configurations, so variance should be low. I also use the same parameters for wrk as Oren. This is as close as I could get to apples to apples type of comparison.

Kestrel setup

For Kestrel I used the same code that Oren did. I did manage to get to 35000 requests/sec.

The results were as follows:

Kestrel results.

And here’s a snap of TOP somewhere mid run:

Snap of Kestrel's top.

Iris setup

For Iris I went with the code that Gerasimos from the comments below suggested.

Results:

Iris results.

Top:

Snap of Iris's top.

Gin setup

For Gin, I used the built in ClientIP() which does a few more things than just looking at the X-Forwarded-For header. Here’s the code I ended up with.

Results:

Gin results.

Top:

Snap of Gins's top.

FastHttp setup

This is the server I went with for fasthttp.

Results:

Fasthttp results.

Top:

Snap of fasthttp's top.

Express setup

To be fair, I knew Express would not perform too well here but I added it nonetheless. Here’s the Express code.

Results:

Express results.

Top:

Express results.

Conclusion

Server Requests/sec Memory MB
Kestrel 35404 131.0
Iris 21868 26.4
Gin 20856 21.0
FastHttp 37361 14.1
Express 7902 76.3

From this, I drew the following conclusions:

  • I’m pleasantly surpised by Kestrels performance(I mostly code Go).
  • Kestrel(most likely .NET, not Kestrel itself) is way harder on the memory than GO’s equivalents.
  • Nano instance can be quite good at handling not very intensive tasks.
  • Fasthttp outperforms kKstrel, but not by a large margin.
  • Fasthttp uses only 1/10th of Kestrels memory.
  • Gin and Iris are not as fast as Kestrel, which surprised me.
  • Express is nowhere close, as expected.

I also ran the tests on my Mac Pro - every server comfortably went into the 100 000 requests/second. Go seemed to do a tiny bit better than .NET on this one though. Express only managed 16000 requests/s.

Take note that I’m not an expert in benchmarking by any means. Let me know if I made any mistakes in the comments below!