fasthttp icon indicating copy to clipboard operation
fasthttp copied to clipboard

bad performance with ryzen 7950x (Arch Linux, Go 1.19)

Open abenz1267 opened this issue 3 years ago • 6 comments
trafficstars

Hi,

i've recently noticed that performance with Fiber is way below what i'd usually expect. I tried using fasthttp directly and noticed it might be directly related to fasthttp and not fiber. Code can be found here: https://github.com/abenz1267/benchmark.

Fasthttp is performing worse than Gin here, although on my old 1700x it would perform way better. I noticed that the fasthttp version isn't even close to utilizing 100% CPU, it's more around 75%, hence the bad result.

The problem occurs when using a single instance of fasthttp, running multiple ones doesn't suffer the same problem.

Regards

abenz1267 avatar Oct 16 '22 12:10 abenz1267

How are you sending the requests for your benchmark? Can you do some profiling to see what is going on? https://blog.golang.org/2011/06/profiling-go-programs.html

erikdubbelboer avatar Oct 16 '22 14:10 erikdubbelboer

Hi, sorry for missing that info: benchmarking was done on the same machine using wrk wrk -t32 -d10s -c1000 http://localhost:8080/

In the meanwhile i've found out that this might be related to the fact the 7950x has 2 CCDs. Disabling a whole CCD, so 8 cores, resulted in "expected" performance, as in: fasthttp beating vanilla Go. Vanilla Go itself was faster with only 8 cores vs. 16 cores as well. So i suspect goroutines and multiple CCDs don't go well together.

abenz1267 avatar Oct 16 '22 15:10 abenz1267

That would be weird as fasthttp should use a lot less goroutines than net/http (1 per connection vs 3 per connection I think). Maybe it was something with GOMAXPROCS, or something in the Go scheduler.

erikdubbelboer avatar Oct 16 '22 20:10 erikdubbelboer

well, i can just report what i encounter. I haven't touched gomaxprocs... and too suspect something about the Go scheduler, but keep in mind: Go with Gin is FASTER than Fiber/Fasthttp. That's simply not normal.

Fiber took around 75% CPU usage, while everything else took 90%+. As if something is blocking. I don't know.

abenz1267 avatar Oct 16 '22 21:10 abenz1267

@abenz1267 Did ever find any more information regarding this? Have you tried updating both fasthttp/fiber to their latest versions and testing again

gaby avatar Mar 13 '23 03:03 gaby

@abenz1267 Did ever find any more information regarding this? Have you tried updating both fasthttp/fiber to their latest versions and testing again

Hi,

no, I haven't tested nor investigated ever since. I was hoping for a more general 'fix' regarding inter-ccx performance and Go. I haven't looked into why fasthttp in particular is so slow.

Regards

abenz1267 avatar Mar 13 '23 05:03 abenz1267