X
    Categories: All Symfony Tutorials, Tips And Guides you needLearn PHP Tutorials, Tips And Guides
Reading Time: 3 minutes

Symfony 4 is a hot topic these days and I have covered the topic in several previous articles. Since Symfony continues to be the choice for web development projects, I decided to benchmark Symfony 3.x and 4.x for PHP 7.0 and 7.1.

For the purpose of the benchmarking process, I decided to test out the PHP apps hosted on Cloudways managed servers. Thanks to ThunderStack (Cloudways own custom stack based on servers and cache), Cloudways offers a highly optimized environment for Symfony applications.

I’m assuming that you have already signedup and launch DigitalOcean server with custom PHP app as described in the next step.

Test Scenario

I will use Apache Benchmarks to carry out the Symfony performance benchmark. You can easily use ab commands on Cloudways via SSH terminal right after the launch of the server.

The test scenario is divided into two cases:

The first test configuration is:

  • Cloudways managed 2GB DigitalOcean server
  • Datacenter location: London
  • PHP 7.0
  • No caching libraries
  • No of Users: 50, Requests 500-1000
  • Symfony 3.3 and 3.4 with PHP 7.0

The second test configuration is:

  • Cloudways managed 2GB DigitalOcean server
  • Datacenter location: London
  • PHP 7.1
  • No caching libraries
  • No of Users: 50, Requests 500-1000
  • Symfony 3.3 and 3.4 and 4 with PHP 7.1

Note: Varnish caching is off and PHP-FPM is running along with Redis and Memcached.

Let’s do the test.

Detailed Table View Of Symfony Performance Testing:

Here is the detailed view of numbers I got from the test. You can see how Symfony 3.3, 3.4  and 4 performed when powered by PHP 7.0 and 7.1

500 Requests and 50 Concurrent users with PHP 7.0 1000 Requests and 50 Concurrent users with PHP 7.0
S.no Parameters SF 3.3 SF 3.4 SF 3.3 SF 3.4
1 Concurrency Level 50 50 50 50
2 Time Taken for Test [seconds] 0.530 0.573 1.049 1.111
3 Complete Request 500 500 1000 1000
4 Failed Request 0 0 0 0
5 Total Transferred [bytes] 328000 328000 656000 656000
6 HTML Transferred [bytes] 187000 187000 374000 374000
7 Request/Second [#/sec](mean) 943.95 873.23 953.00 899.88
8 Time/Request [ms] (mean) 52.969 57.259 52.466 55.563
9 Time/Request [mean ms](mean across concurrent users) 1.059 1.145 1.049 1.111
10 Transfer Rate [kb/sec] 604.72 559.41 610.52 576.48

 

500 Requests and 50 Concurrent users with PHP 7.1 1000 Requests and 50 Concurrent users with PHP 7.1
S.no Parameters SF 3.3 SF 3.4 SF 4.0 SF 3.3 SF 3.4 SF 4.0
1 Concurrency Level 50 50 50 50 50 50
2 Time Taken for Test [seconds] 0.507 0.528 0.524 1.204 1.106 1.158
3 Complete Request 500 500 500 1000 1000 1000
4 Failed Request 0 0 0 0 0 0
5 Total Transferred [bytes] 328000 328000 269500 656000 656000 539000
6 HTML Transferred [bytes] 187000 187000 157500 374000 374000 315000
7 Request/Second [#/sec](mean) 986.42 946.91 954.82 830.77 903.82 863.31
8 Time/Request [ms] (mean) 50.688 52.803 52.366 60.185 55.321 57.917
9 Time/Request [mean](mean across concurrent users) 1.014 1.056 1.047 1.204 1.106 1.158
10 Transfer Rate [kb/sec] 631.92 606.61 502.59 532.21 579.01 454.42

Here’s the visual representation of the request/sec handled by the various Symfony versions:

By observing the above graph, I can conclude the following points:

  • On PHP 7.0, Symfony 3.3 performed very well and handled more requests than Symfony 3.4.
  • On PHP 7.1, Symfony 3.3 again performed well with the highest number of requests handled.
  • Symfony 3.3 handled more requests with PHP 7.1 than PHP 7.0.
  • Symfony 3.4 handled more requests with PHP 7.1 than PHP 7.0.
  • Symfony 4 worked good with PHP 7.1 and appeared much better at handling requests than Symfony 3.4.

The above graph suggests:

  • On PHP 7.0, Symfony 3.3 performed very well, and handled more requests(953) than Symfony 3.4
  • Again, on PHP 7.1, Symfony 3.3 did not perform well with the lowest number of handled requests.
  • Symfony 3.3 handled more request with PHP 7.0 than PHP 7.1.
  • Symfony 3.4 handled more request with PHP 7.1 than PHP 7.0.
  • When compared with Symfony 3.4, Symfony 4 does not work well with PHP 7.1. However, it did perform well when compared to Symfony 3.3

You might also like: PHP 5.6 Vs PHP 7 – Performance Benchmarks With Symfony 3

To Wrap Up

It is clear that Symfony performs well enough on both PHP 7.0 and PHP 7.1. Remember that these Symfony benchmarks are the result of a controlled test environment. However, they provide a very good indication of how things play out in real world projects.

Shahroze Nawaz :Shahroze is a PHP Community Manager at Cloudways - A Managed PHP Hosting Platform. He’s always in search of new frameworks and methods to implement them. Besides his coding life, he loves movies and playing soccer with friends. You can email him at shahroze.nawaz@cloudways.com