-
Notifications
You must be signed in to change notification settings - Fork 5
Description
I've been using all 3 of these languages a lot over the last few years (PHP5 and PHP7 as for PHP). These benchmarks suffer based on the different implementations the Redis have in the different languages.
Good benchmarks for these kind of broader comparison should compare multiple situations that look a lot more like real-world examples.
My proposal would be to redo this and then actually do:
- base calls with no content
- simulate base API calls (without any external libraries that might affect the language, but only core modules)
- simulate longer-running calls (also based on core modules only)
I'll try to enrich this post later with some real benchmarks, but I have to disappoint you that when you actually do these runs validly, on Go v1.6 (and 1.5 too) Node.JS and PHP will shit their pants by far.
Saying this is PHP's performance is wrong, it's benefitting on an external tool (Nginx/CGIfast/Apache). And added to that saying that caching is enabled is even more cheating. Do you know what happens with Go when you cache native objects and do live recompiles with no down-time? You get nanosecond-results. PHP can't even stay under hundreds of microseconds just by starting up. Even with (semi-implemented) JIT in PHP7 you can't achieve speeds in PHP that would match any compiled implementation.
Finally you're suffocating both Go and NodeJS' performance by using ab. ApacheBench can't handle tens of thousands of requests per second; it will drown in the NodeJS/Go performance of sequential request handling (mostly due filesystem limitations). Use wrk, sniper or vegeta to actually see what the systems are capable of.
I just reread my post and it might come up a bit harsh, but I'm merely trying to portray that what this repo tries to show is misconceiving. PHP7 on it's own is hundreds (sometimes thousands of times) slower than Go. Even behind an optimized server (preferably Nginx) it can't outrun Go. I have a Go API running with a native in-memory caching (without library overhead) and doing requests that easily get responses within a few microseconds (thousands of nanoseconds). And that's even over HTTPS. This is not bragging about my code, but merely showing that PHP is still much slower. Not to forget that if you would use something like Laravel, Symphony, CodeIgniter or ZEND you would have such immense degradation in performance. Also with a library like endless you can make your Go-installation indestructible, guaranteeing no down-time, even on DDoS. We did a DDoS test some weeks ago on a highly optimized Nginx PHP7 installation and it took about 3 seconds and the whole server have a server-load over 150.0 (CentOS) and fully crashed. Go's HTTP package is graceful and won't be daunted by overhead. It will deliver much higher loads of successful responses (Nginx, even on ab returns so many fails over NodeJS and Go). Running endless under Google App Engine with Google's package to auto-upgrade under heavier load can make a Go API written in a few days deliver millions of requests per second. From my experience working in PHP-based companies, for very big customers, you need semi-rocket-scientist that tweak your Nginx/Apache and Linux distro constantly to upkeep all the issues that come by in production. NodeJS and Go are just better and more modern solutions in so many more ways than just performance. Both will save you money, a LOT, trust me :P.