Over a million developers have joined DZone.
{{announcement.body}}
{{announcement.title}}

PHP 7 Doubles Performance for Dreamfactory

DZone's Guide to

PHP 7 Doubles Performance for Dreamfactory

PHP is the world’s most popular server side language, and version 7.0 vastly reduces memory consumption, allowing you to serve more concurrent users without adding hardware.

· Performance Zone
Free Resource

Evolve your approach to Application Performance Monitoring by adopting five best practices that are outlined and explored in this e-book, brought to you in partnership with BMC.

DreamFactory is a high-performance request/response engine for REST API Services. You can hook up any SQL or NoSQL database and instantly get a comprehensive REST API for that data source. A big part of our platform is the support for JSON Web Tokens. JWTs are an open standard for representing session information that is transferred between the client and server. JWT allows DreamFactory to run in a completely stateless manner, which makes the platform very easy to scale vertically with additional server capabilities or horizontally with multiple instances between a load balancer.

But 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 Laravel framework for the actual engine. Other add-ons leverage V8 for server-side JavaScript, among other languages.

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. I used SQLite for the database, which stores the data in a local server file. This reduces any difference due to database setup or performance.

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.

Learn tips and best practices for optimizing your capacity management strategy with the Market Guide for Capacity Management, brought to you in partnership with BMC.

Topics:
json ,services ,rest ,performance ,web ,engine ,rest api services ,api

Published at DZone with permission of Bill Appleton, DZone MVB. See the original article here.

Opinions expressed by DZone contributors are their own.

THE DZONE NEWSLETTER

Dev Resources & Solutions Straight to Your Inbox

Thanks for subscribing!

Awesome! Check your inbox to verify your email so you can start receiving the latest in tech news and resources.

X

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}