Phpredis: PHP 7.1 response time

Created on 27 Jun 2018  路  6Comments  路  Source: phpredis/phpredis

Did you notice that php-redis is taking about 3ms in get or set operations? (PHP 7.1)

Expected behaviour

$redis->set();
PHP 5.6 -> 1ms

Actual behaviour

$redis->set();
PHP 7.1 -> 3ms

I'm seeing this behaviour on

  • OS: amazon-linux-ami/2018.03
  • Redis: 3.1.1
  • PHP: PHP 7.1.17

Most helpful comment

Testing a newer version is a good idea, but I don't think this is really a bug:

Here's averaged GET timings across a bunch of versions of PHP:

PHP 5.6.30 : Sent 5000 GET commands in 95.88 ms
PHP 7.0.17 : Sent 5000 GET commands in 84.61 ms
PHP 7.0.18 : Sent 5000 GET commands in 86.72 ms
PHP 7.1.3  : Sent 5000 GET commands in 87.52 ms
PHP 7.1.5  : Sent 5000 GET commands in 83.53 ms
PHP 7.1.7  : Sent 5000 GET commands in 86.45 ms
PHP 7.1.10 : Sent 5000 GET commands in 99.99 ms
PHP 7.2.6  : Sent 5000 GET commands in 82.65 ms

These are average timings and will still vary a bit run to run, depending on what else is happening on my system. That said, I don't see anything like a 3x difference between any version of php.

All 6 comments

Are you sure it is depends on PHP version and not environment?

I agree with @yatsukhnenko that it seems more related to environment than PHP version. I did a very simple test with a few versions of PHP and don't see any real difference between 5.x and 7.x. My results are far faster than 1ms per call, but I'm doing all tests locally.

First of all, thank you for your attention.

I did the tests using the same environment.
Just change the php version installed I could see very different times.

My test was in production (aws):

  • EC2 t2.small
  • ElasticCache Redis cache.m3.medium

Both using nginx + php-fpm

PS. correcting the versions:

  • Redis: 2.8.24
  • PHP-Redis: 3.1.1

@btrazzini 3.1.1 was released more than year ago. Could you test the latest stable version?

Testing a newer version is a good idea, but I don't think this is really a bug:

Here's averaged GET timings across a bunch of versions of PHP:

PHP 5.6.30 : Sent 5000 GET commands in 95.88 ms
PHP 7.0.17 : Sent 5000 GET commands in 84.61 ms
PHP 7.0.18 : Sent 5000 GET commands in 86.72 ms
PHP 7.1.3  : Sent 5000 GET commands in 87.52 ms
PHP 7.1.5  : Sent 5000 GET commands in 83.53 ms
PHP 7.1.7  : Sent 5000 GET commands in 86.45 ms
PHP 7.1.10 : Sent 5000 GET commands in 99.99 ms
PHP 7.2.6  : Sent 5000 GET commands in 82.65 ms

These are average timings and will still vary a bit run to run, depending on what else is happening on my system. That said, I don't see anything like a 3x difference between any version of php.

@btrazzini 3ms is really good result comparing to @michael-grunder's ~90ms :smile:

Was this page helpful?
0 / 5 - 0 ratings

Related issues

namjitharavind picture namjitharavind  路  4Comments

yalks picture yalks  路  4Comments

xkenner picture xkenner  路  3Comments

fidelhuang picture fidelhuang  路  5Comments

zacharyhamm picture zacharyhamm  路  3Comments