Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Consider PhpRedis backend for redis #745

Closed
cebe opened this issue Aug 11, 2013 · 13 comments
Closed

Consider PhpRedis backend for redis #745

cebe opened this issue Aug 11, 2013 · 13 comments

Comments

@cebe
Copy link
Member

cebe commented Aug 11, 2013

#743

Maybe Yii2 should support Pecl Redis (PhpRedis)?
http://pecl.php.net/package/redis

http://alekseykorzun.com/post/53283070010/benchmarking-memcached-and-redis-clients

@ghost ghost assigned cebe Aug 11, 2013
@pmoust
Copy link
Contributor

pmoust commented Aug 27, 2013

Voting for it.

@gimox
Copy link
Contributor

gimox commented Sep 23, 2013

+1

@cebe
Copy link
Member Author

cebe commented Sep 24, 2013

Will do some tests when redis is ready to see whats better / faster.

@gimox
Copy link
Contributor

gimox commented Sep 24, 2013

Resis seem the best performance/stability solution. I m waiting a stable support to test it!

@iJackUA
Copy link
Contributor

iJackUA commented Oct 2, 2013

+1 for ability to use phpredis extension https://github.com/nicolasff/phpredis/
it is quite simple to use and very similar to native redis functions
I also do not like over-simplified-wtf implemetations like Rediska, and have good feeling about phpredis after using it in recent projects.

@gimox
Copy link
Contributor

gimox commented Oct 2, 2013

now i'm usign redis 2.6 with yii2 , and everythink is working good and stable.
it's very fast!!

@qiangxue qiangxue modified the milestones: 2.0 GA, 2.0 RC Apr 16, 2014
@savvot
Copy link
Contributor

savvot commented Jun 5, 2014

+1 for native phpredis ext support

Just tested perfomance difference on this simple script (writting and reading 1000 keys):

        $CNT = 1000;
        $keys = range(1, $CNT);

        $phpredis = new \Redis();
        $redis = Yii::$app->cache;  // Configured as yii\redis\Cache

        //$phpredis->connect('127.0.0.1', 6379);
        $phpredis->connect('/var/run/redis/redis.sock');

        $start = microtime(true);
        for($i=0; $i<$CNT; $i++) {
            $phpredis->setex($keys[$i], $i, 300);
        }
        for($i=0; $i<$CNT; $i++) {
            $phpredis->get($keys[$i]);
        }
        echo (microtime(true)-$start).'<br>';


        $start = microtime(true);
        for($i=0; $i<$CNT; $i++) {
            $redis->set($keys[$i], $i, 300);
        }
        for($i=0; $i<$CNT; $i++) {
            $redis->get($keys[$i]);
        }
        echo (microtime(true)-$start);

Results are (on real production server, Ubuntu 14.04, E5-2620v2):

unix socket phpredis: 0.067816972732544
tcp phpredis: 0.10558891296387
tcp yii2-redis: 0.21003198623657

As for me - difference is huge.

Also:

@neanton
Copy link

neanton commented Jun 5, 2014

Also using phpredis as a di service. Would be a + if we have that out of the box.

@cebe
Copy link
Member Author

cebe commented Jun 5, 2014

Also using phpredis as a di service

What do you mean with that? can you please elaborate a bit?

@neanton
Copy link

neanton commented Jun 9, 2014

I mean that I use https://github.com/nicolasff/phpredis but I set it up in my "components" section of a config. So Redis class is available from DI container as a service.

I DO NOT use redis ActiveRecord

@cebe cebe modified the milestones: 2.0 GA, 2.0 RC Jul 12, 2014
@Insolita
Copy link
Contributor

+1 for native phpredis ext support

@qiangxue qiangxue modified the milestones: 2.0.1, 2.0 GA Sep 27, 2014
@cebe cebe modified the milestones: 2.0.1, 2.0.x Oct 19, 2014
@jasonhancock
Copy link

+1

@samdark
Copy link
Member

samdark commented Nov 25, 2015

Moved to yiisoft/yii2-redis#45

@samdark samdark closed this as completed Nov 25, 2015
@cebe cebe removed this from the 2.0.x milestone Nov 25, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

10 participants