From PHP to Java #1 – First production-ish application

So I’ve got a task to check difference in performance between Silex app, Symfony 3 with all goodies and JAVA/Spring Boot. Results surprised even me.

TLDR; because there will be separate post about that – PHP is obviously slower than Java and with proper use of opcache there is no difference between Symfony 3 with JMS Serializer and Doctrine and 60 lines unmaintainable app in Silex.

But it should be about Java. Stack Driven Development with Spring Boot took me maybe 1 or 2 hours in comparison about 1h with Symfony. As I’m still newbie I’m not optimising what so eves as I have just slight idea what I’m doing. App is working exactly the same way. Let’s do testing then.


I’m having all the apps on my poor Vagrant VM with not so much processing power and I’m using DB which is somewhere in the infrastructure. No cache, no in-memory storage. Everything is as dumb as possible ;)

For testing I’m suing Great tool with Scala based DSL for test scripts.

We’re set up so let’s do some testing. Goal is to kill all the apps and check what’s the most they can handle.

The test

So PHP died before 50 req/s. It was so disappointing I haven’t checked exact number. Note I’ve done all optimisation on opcache and fpm normal user would do. Nothing crazy tho.

Let’s do Java then. same 50 req/s. No sweat. graph flat at response time about 10ms. Boring. As naive I was pushing by 25 on iteration of test. It took some time but finally got some struggle after reaching 250 req/s. At this point I’m shocked and confused. Mainly because even if I got longer response time I’ve got all the response data when PHP started to throw 500’s and 504’s in my face.

Next step my friend from the office came over and we’ve done some system optimisations on my VM. Then I’ve just

(╯°□°)╯︵ ┻━┻

Last successful test we’ve done got us average 360 req/s. On my VM, on small and slow-ish Mac Mini. And no errors. after that point, when I bumped test to over 400 req/s I simply killed TCP driver on my mac, not application. T bloody CP connections couldn’t be made on that rate on my host. App was fine.


I don’t want to say PHP is bad. It’s still good for frontend and not that high load. But if you really want performance you shouldn’t waste time on PHP IMO. Spring Boot feels like Symfony, all the good tooling is basically done for you.

You’re gaining like 7-8 times better performance out of the box with rock solid stability (I haven’t got even one 5xx from Java app).

Well, choice is yours if you gonna like it.