J@ArangoDB

{ "subject" : "ArangoDB", "tags": [ "multi-model", "nosql", "database" ] }

ArangoDB-PHP Driver Improvements

While preparing the release of ArangoDB 2.7, some improvements were made for the PHP driver for ArangoDB.

The 2.7 version of the PHP driver now supports the AQL query results cache. The cache can be turned on or off globally, or be set to demand mode. The demand mode will allow controlling caching on a per-AQL-query basis.

Additionally, the HTTP transport layer in the PHP driver was improved. Some internal string handling methods were optimized so that the transport part becomes cheaper. All driver operations that communicate with the ArangoDB server will benefit from this.

For a demonstration of the improvements, here is a script that creates 100,000 documents in a local ArangoDB database via the PHP driver. As we’re interested in assessing the HTTP layer improvements, the script intentionally issues 100,000 HTTP requests instead of using the specialized import method provided by the driver.

The script code can be found here.

The baseline for the improvments is the (non-optimized) 2.6 version of the PHP driver. Here are the results for issuing 100,000 requests with the 2.6 driver (script was run twice to see if there are variations in execution time):

execution times with 2.6 driver
1
2
3
4
5
creating 100000 documents
creating documents took 55.144556999207 s

creating 100000 documents
creating documents took 54.476955890656 s

Running it with the 2.7 version of the PHP driver now shows the improvements. Execution time for the same script goes down from 54 seconds to 42 seconds:

execution times with 2.7 driver
1
2
3
4
5
creating 100000 documents
creating documents took 42.886090040207 s

creating 100000 documents
creating documents took 42.578990936279 s

The PHP version used here was:

PHP version details
1
2
3
4
PHP 5.5.12-2ubuntu4.6 (cli) (built: Jul  2 2015 15:27:14) 
Copyright (c) 1997-2014 The PHP Group
Zend Engine v2.5.0, Copyright (c) 1998-2014 Zend Technologies
    with Zend OPcache v7.0.4-dev, Copyright (c) 1999-2014, by Zend Technologies

Following are the results from a different machine, this time using PHP 5.6:

execution times with 2.6 driver
1
2
3
4
5
creating 100000 documents
creating documents took 48.394731044769 s

creating 100000 documents
creating documents took 47.618598937988 s
execution times with 2.7 driver
1
2
3
4
5
creating 100000 documents
creating documents took 40.535583972931 s

creating 100000 documents
creating documents took 40.041265010834 s

The PHP version details for this machine were:

PHP version details
1
2
3
4
PHP 5.6.4-4ubuntu6.2 (cli) (built: Jul  2 2015 15:29:28) 
Copyright (c) 1997-2014 The PHP Group
Zend Engine v2.6.0, Copyright (c) 1998-2014 Zend Technologies
    with Zend OPcache v7.0.4-dev, Copyright (c) 1999-2014, by Zend Technologies

The actual improvements depend on many factors, so your exact mileage may vary. The improvements may not be noticable for applications that issue only a few requests with the driver, but they will be significant when performing lots of requests, as in the above examples.