Terence Bennett - September 15, 2016

speed-increase.png

Even though DreamFactory is easy to scale, we still need to make sure the core engine runs as fast as possible. For example, the minimum response time for a service call will depend on the absolute speed of a single instance. Another issue is massive mobile and Internet of Things (IoT) deployments. Imagine sitting in a leaky rowboat. If water is leaking in faster than you can bail it out then the boat sinks. In the same manner, a server must expeditiously handle thousands of incoming requests. If the volume of traffic overwhelms the server, then errors are returned to the client instead of JSON service responses.

With the latest release of DreamFactory version 2.3, our engineering team has upgraded the core engine to PHP 7.0. PHP is the world’s most popular server side language, and version 7.0 has been rebuilt and refactored to vastly reduce memory consumption, allowing you to serve more concurrent users without adding any hardware. As before we are using the superhot SQLite for the database, which stores the data in a local server file. This reduces any difference due to database setup or performance.

I took a few minutes to benchmark the actual speed increase that a DreamFactory server running PHP 7.0 would expect to see in a real world scenario. I set up Apache AB to GET 10 records with 100 concurrent users 10,000 times. The API call used a complex filter and also sorted the results. The two machines were m3.xlarge servers running on Amazon Web Services. One server was running DreamFactory 2.1 with PHP 5.6 and the other one was running version 2.3 with PHP 7.0.9.

The results show that the new version of DreamFactory is clearly twice as fast as the old version. This is consistent with other benchmarks showing the performance gains from PHP 7.0. In my testing I noticed that when I returned lots of records I started to run into network bandwidth limitations instead of measuring the actual engine speed. Here is part of the Apache AB listing:

********************************************************
100 Concurrent, PHP 5.6
********************************************************

Concurrency Level: 100
Time taken for tests: 108.567 seconds
Complete requests: 10000
Failed requests: 0
Total transferred: 14630000 bytes
HTML transferred: 11990000 bytes
Requests per second: 92.11 [#/sec] (mean)
Time per request: 1085.674 [ms] (mean)
Transfer rate: 131.60 [Kbytes/sec] received
********************************************************
100 Concurrent, PHP 7.0.9
********************************************************

Concurrency Level: 100
Time taken for tests: 52.519 seconds
Complete requests: 10000
Failed requests: 0
Total transferred: 14620000 bytes
HTML transferred: 11990000 bytes
Requests per second: 190.41 [#/sec] (mean)
Time per request: 525.192 [ms] (mean)
Transfer rate: 271.85 [Kbytes/sec] received

So, there you have it. The new version of DreamFactory is twice as fast! This is a nice improvement and definitely worth the upgrade. Let us know what your results are, and how we can help with your latest project.

Related reading: Creating a Geofence API