Expressive + Swoole vs Node.js + Express.js

Hey Guys,

Been experimenting running Zend Expressive on Swoole. A few weeks ago I ran a comparison of Expressive on Apache / Nginx / and Swoole and posted the results to Slack. What I found was Swoole ran Expressive a lot faster then the others. So Tonight I decided to run some benchmarks with Expressive on Swoole against Node.js + Express.js.

Nothing fancy, just letting each framework serve it’s default index page with absolutely NO optimizations for Node, Express, PHP, or Expressive. Everything is right out of the box.

Here’s the environment I used
AWS:
2 Medium Instances (one for running the server and one for benchmarking)
Ubuntu 16.04

PHP:
PHP 7.2.1-1+ubuntu16.04.1+deb.sury.org+1
swoole 2.0.12 stable
Expressive@2.1.0 - Module Install + Zend Service Manager + FastRoute + Zend View

Node:
node@v9.4.0
express@4.15.5
NODE_ENV=production

Here’s the results:

Comparison One:
benchmark3

Comparison Two:
benchmark4

My Conclusions:
They seem neck and neck. What’s interesting is the initial warm up of Express.js. That seemed be what hurt the first comparison and why Expressive looks so much faster at first glance. That said, I had to flip Express into production mode to even get it close to PHP + Expressive right out of the box.

At any rate, I hope you enjoyed this post, and remember, these benchmarks are for entertainment purposes only.

Gj and thanks. I’ve been quite interested in this subject of late.

Could you rerun your tests for the current version of swoole ( 4.0 )?

I’d be happy to. However I’d like to wait until this PR makes it’s way in: https://github.com/zendframework/zend-diactoros/pull/304

Once that’s released, I’ll run some new tests and see where we’re at.