Python, CSharp, Go, Next.js: How Much Do Different Frameworks Really Differ in Performance?
AspNetCore 9 crushes the field at 15k RPS. Go+Gin is light on memory but throughput is just so-so. Django is the same old story, and as for Next.js as an API? Don't put it through that.
目录21 个章节
Preface
It's December before I knew it. Too many odds and ends lately, so output hasn't been high. I'll keep organizing some recent notes.
Last time I compared different servers used when deploying the Django framework; details: Performance Research on Different Django Servers and Deployment Methods
While exploring, I also ran comparison tests on frameworks in different languages.
Django Test Follow-up
A few extra conclusions from the last Django performance test:
- drf and ninja don't differ much in performance
- On a 2C2G server, workers=4 performs better than workers=2. As for how much better, I only tested the uwsgi server, and the gap is about 33%
This Test
Languages and frameworks in this test:
- aspnetcore 8.0 (starblog project)
- aspnetcore webapi(controller) 9.0 (ayaka-chats project)
- go + gin (ebook-forge project)
- Next.js (iothub dashboard project)
To keep variables under control, I deployed a copy of each of these projects on a Tencent Cloud 2C2G thin-pipe server and tested them together.
The test command was the same throughout:
wrk -t4 -c200 -d30s <url>
The test targets were all lightweight APIs in each project (returning a short string or simple JSON), focusing on the framework's own throughput and latency rather than business-code complexity.
Test Conclusions
The results are pretty interesting, and they largely match how these frameworks have felt to me over long-term use.
Overview
By the way, Django's best result last time was around 1200RPS. Recap: Performance Research on Different Django Servers and Deployment Methods
| Project / Stack | Requests/sec | Memory | CPU | Notes |
|---|---|---|---|---|
| AspNetCore 8 (legacy MVC architecture) | 5,960 | 560MB | 100% | Bloated architecture, high memory; throughput is only so-so |
| AspNetCore 9 (WebAPI) | 15,031 | 80MB | 95% | Next-gen architecture is very light, extremely strong performance |
| Go + Gin | 6,145 | 35MB | 70% | Memory-efficient, throughput is average |
| Next.js (Edge API / App Router) | 405 | 135MB | 50% | Node.js is inherently at a disadvantage for high-concurrency APIs |
Conclusions
1. Overall performance champion: AspNetCore 9
Highest throughput, moderate memory, strong ecosystem. Suited to future large projects (e.g. the Clipify editor, AI services, Chat API).
2. Lightweight champion: Go + Gin
Lowest memory use, cheapest to deploy and scale. Suited to standalone components or internal services.
3. The reality of traditional web projects: AspNetCore MVC is too heavy
Migrating old projects is costly, but new projects really shouldn't keep using MVC.
4. Node.js/Next.js is not suited to high-concurrency APIs
Fine for frontend pages and simple backend logic, but not as a performance core.
Item-by-item Analysis
AspNetCore 8.0 MVC (StarBlog)
“The old project is holding it back. The performance hit is mainly from the architecture, not .NET itself.”
Memory shot straight up to 560MB, which means:
- All kinds of IOC + MVC + middleware maxed out
- The project structure itself is bloated
- Throughput under 6k RPS
AspNetCore 9.0 WebAPI (Ayaka Chats)
“This is Microsoft showing its real strength.”
- Memory only 80M, very clean and lean.
- 15k RPS is the champion here.
- CPU can be fully utilized, meaning the framework isn't the bottleneck and can squeeze the machine dry.
✔ Suited to high-performance microservices and AI relay services
✔ Suited to AI SaaS and personal-tool API scenarios
⚠ The person writing it needs to know C#
Go + Gin (Ebook Forge)
“Extremely lightweight, but throughput this time wasn't that impressive.”
- Memory only 35M, ridiculously light.
- Throughput 6k RPS, a bit lower than I expected, but stable.
- CPU only at 70%, showing the Go scheduler is steady, but Gin itself didn't fully saturate the CPU.
✔ Especially suited to background queues, message processing, and lightweight services
✔ Suited to cost-sensitive deployment scenarios (small-memory machines)
✘ For developers leaning full-stack + AI, the ecosystem is relatively weaker
Next.js (iothub dashboard)
“Node running APIs: it can run, but don't expect high concurrency.”
- 400 RPS → not an API performance framework (you'd expect the thousand-RPS range of Express/fastify)
- Latency 200ms+ → once again confirms Node.js's single-thread + V8 characteristics
- Suited to SSR/frontend BFF, not as a primary API
✔ If it's page rendering or frontend services, it's decent
✘ If APIs are the main battlefield, don't put it through that
Test Data
aspnetcore 8.0 (starblog project)
Peak memory during the test was around 560M, CPU at 100%; This project is AspNetCore MVC plus a relatively old architecture, so it's bloated, uses a lot of memory, and performance is relatively poor.
$ wrk -t4 -c200 -d30s http://127.0.0.1:9874/Api/DataWrapperTest/StringResult
Running 30s test @ http://127.0.0.1:9874/Api/DataWrapperTest/StringResult
4 threads and 200 connections
Thread Stats Avg Stdev Max +/- Stdev
Latency 44.04ms 44.20ms 304.43ms 88.08%
Req/Sec 1.59k 559.31 2.42k 75.64%
179013 requests in 30.03s, 44.22MB read
Requests/sec: 5960.51
Transfer/sec: 1.47MB
aspnetcore webapi(controller) 9.0 (ayaka-chats project)
Peak memory during the test was around 80M, CPU at 95%
$ wrk -t4 -c200 -d30s http://127.0.0.1:16080/api/auth/csrf
Running 30s test @ http://127.0.0.1:16080/api/auth/csrf
4 threads and 200 connections
Thread Stats Avg Stdev Max +/- Stdev
Latency 13.94ms 8.17ms 111.67ms 83.87%
Req/Sec 3.78k 1.06k 5.68k 72.92%
451205 requests in 30.02s, 99.40MB read
Requests/sec: 15031.56
Transfer/sec: 3.31MB
go + gin (ebook-forge project)
Peak memory during the test was around 35M, CPU at 70%
$ wrk -t4 -c200 -d30s http://127.0.0.1:8080/health
Running 30s test @ http://127.0.0.1:8080/health
4 threads and 200 connections
Thread Stats Avg Stdev Max +/- Stdev
Latency 37.13ms 33.65ms 499.93ms 82.09%
Req/Sec 1.55k 328.35 2.86k 74.04%
184447 requests in 30.02s, 114.86MB read
Requests/sec: 6145.14
Transfer/sec: 3.83MB
Next.js (iothub dashboard project)
Peak memory during the test was around 135M, CPU at 50%
$ wrk -t4 -c200 -d30s http://127.0.0.1:3000/api/health
Running 30s test @ http://127.0.0.1:3000/api/health
4 threads and 200 connections
Thread Stats Avg Stdev Max +/- Stdev
Latency 251.98ms 110.23ms 1.95s 68.01%
Req/Sec 112.01 89.28 515.00 61.88%
12192 requests in 30.03s, 4.45MB read
Socket errors: connect 0, read 0, write 0, timeout 118
Requests/sec: 405.96
Transfer/sec: 151.80KB
Wrap-up
For individual developers and lightweight SaaS:
If you want “satisfying” and “stable”, pick AspNetCore 9 first;
If you want “cheap” and “quick to pick up”, Go + Gin is great;
Django / Python has a strong ecosystem but performance isn't the main selling point; it depends on the ASGI server you choose;
Node.js is suited to BFF, not to carrying high-throughput APIs.
_EOF_
Python, CSharp, Go, Next.js: How Much Do Different Frameworks Really Differ in Performance?
- 本文作者:
- 程序设计实验室
- 版权声明:
- 本博客所有文章除特别声明外,均采用 BY-NC-SA 许可协议。转载请注明出处!
相关文章
我也入坑折腾黑苹果,还成功了~
前言 Windows真的太难做开发了啊。。。Linux本来是最好的选择,然而又缺少太多软件,像微信、QQ这些就是想都不要想腾讯会给你开发的,用wine版本的又卡,用网页版又不能发表情包= = 所以很难受,也没有多少选择了,只剩下一个mac可以选,但是苹果电脑又贵性价比又低,怎么可能买mac呢,于是只能黑苹果啦~~ 先放一张桌面的截图吧,免得后面字太多没人想看。 其实在以前我就了解到有黑苹果这种东西
2021-12-18 · 杂七杂八 · 约 1 分钟
一些实用工具软件记录
CrystalDisk系列 https://crystalmark.info/en/download/ CrystalDiskInfo CrystalDiskMark 磁盘空间分析 推荐 wiztree,速度很快 https://diskanalyzer.com/download
2022-11-06 · 杂七杂八 · 约 1 分钟
抓住九月小尾巴的小总结,祖国生日快乐~
为期一个月的实训到27号就结束了,我估摸着这夏天也快结束了,到处是秋天的味道。 这个月在广州还是以学习为主,在培训班能学到的很有限,不过我自己倒是折腾了不少东西出来,感觉还蛮好的。 技术学习方面 培训班也不能说没用吧,至少是前端扫盲了,在此基础上我自己又看了一下书,学了布局、动画和一点点js啊,js其实真的挺好用的,收回我之前的成见~(少见多怪) 还用js做了几个好玩的东西,比如说斗鱼、B站刷弹幕
2022-11-05 · 杂七杂八 · 约 1 分钟
解决Chrome浏览器强制http重定向到https的问题
在chrome地址栏中输入 chrome://net-internals/ 选择 Domain Security Policy 在 Delete domain security policies 标签里输入要删除的域名
2021-12-18 · 杂七杂八 · 约 1 分钟
讨论
共 0 条加载评论中…