Categories
PHP

Speed test PHP vs Lumen vs Laravel

I am working in the new EmailValidator!, and after developing the EU VAT API, I feel confident to develop it on Laravel Framework.

But before we start… let’s test the speed of the stack.

I used my local computer a 8 cores i7 2ghz 8GB ram 512SSD. Apache2, PHP 7.0.8.

Tested this test with siege 5 times for each and retrieved the highest.

UPDATE: a table to see easier the results 😉

PHP 7.0.8 Lumen 1.0.2 Laravel 5.3 DEV Kohana 3.3.6
Transactions 1368 hits 1567 hits 1244 hits 1355 hits
Availability 100.00 % 100.00 % 100.00 % 100.00 %
Elapsed time 9.00 secs 9.90 secs 9.24 secs 9.91 secs
Data transferred 0.06 MB 0.06 MB 0.05 MB 0.06 MB
Response time 0.03 secs 0.03 secs 0.04 secs 0.04 secs
Transaction rate 152.00 trans/sec 158.28 trans/sec 134.63 trans/sec 136.73 trans/sec
Throughput 0.01 MB/sec 0.01 MB/sec 0.01 MB/sec 0.01 MB/sec
Concurrency 4.99 4.99 4.96 4.98
Successful transactions 1368 1567 1244 1355
Failed transactions 0 0 0 0
Longest transaction 5.03 0.30 0.17 0.23
Shortest transaction 0.00 0.00 0.01 0.01

All the results:

PHP

siege -c 5 -b --time=10s http://test.lo/emailvalidator/[email protected]

Transactions: 1368 hits
Availability: 100.00 %
Elapsed time: 9.00 secs
Data transferred: 0.06 MB
Response time: 0.03 secs
Transaction rate: 152.00 trans/sec
Throughput: 0.01 MB/sec
Concurrency: 4.99
Successful transactions: 1368
Failed transactions: 0
Longest transaction: 5.03
Shortest transaction: 0.00

Code used here.

Lumen

siege -c 5 -b --time=10s http://euvat.lo/api/email/[email protected]

Transactions: 1567 hits
Availability: 100.00 %
Elapsed time: 9.90 secs
Data transferred: 0.06 MB
Response time: 0.03 secs
Transaction rate: 158.28 trans/sec
Throughput: 0.01 MB/sec
Concurrency: 4.99
Successful transactions: 1567
Failed transactions: 0
Longest transaction: 0.30
Shortest transaction: 0.00

Lumen was the fasted in 4/5 tests. Only once reached less than 1368 the highest on plain PHP.

Code used here (I used same project as euvat xD)

Laravel

siege -c 5 -b --time=10s http://mailjagger.lo/api/email/[email protected]

Transactions: 1244 hits
Availability: 100.00 %
Elapsed time: 9.24 secs
Data transferred: 0.05 MB
Response time: 0.04 secs
Transaction rate: 134.63 trans/sec
Throughput: 0.01 MB/sec
Concurrency: 4.96
Successful transactions: 1244
Failed transactions: 0
Longest transaction: 0.17
Shortest transaction: 0.01

Used same code as for lumen before, but full laravel stack.

As we can see Lumen is the fastest (I didn’t expect this at all, and not sure why yet :S) I didn’t use any special cache for the results or similar. What is relevant also is that Laravel is slightly slower than PHP but, I think the difference is so little that there’s no need to worry about it at all.

Bonus: Kohana

Same test in a clean install of Kohana.

sudo siege -c 5 -b --time=10s http://test.lo/emailko/welcome/email/[email protected]

Transactions: 1355 hits
Availability: 100.00 %
Elapsed time: 9.91 secs
Data transferred: 0.06 MB
Response time: 0.04 secs
Transaction rate: 136.73 trans/sec
Throughput: 0.01 MB/sec
Concurrency: 4.98
Successful transactions: 1355
Failed transactions: 0
Longest transaction: 0.23
Shortest transaction: 0.01

Kohana was slightly faster than Laravel in all the tests I did.