What is the difference between Phpredis and Predis? The difference between Phpredis and Predis

Source: Internet
Author: User
What is the difference between Phpredis and Predis in this article? Phpredis and Predis contrast, there is a certain reference value, the need for friends can refer to, I hope to help you.

Phpredis and Predis

Phpredis is a php extension written using C, and Predis is written in pure PHP.
The difference in performance is, of course, a better extension, but there is a greater difference between the two implementations, namely, the retention of the connection.

  1. Phpredis use C in the extension to maintain a long connection php-fpm to Redis, so multiple requests on a PHP-FPM process are multiplexed on the same connection. The pconnect of Phpredis is the long connection way.

  2. Predis uses a socket from PHP to connect to Redis, so you need to connect to Redis every time you request it.

It can be seen that the official Laravel is recommended to use Predis, because pure PHP implementation of the reason, only need to composer can be installed, very in line with the idea of laravel convenient.

Phpredis and Predis performance gaps do not span the order of magnitude, of course, to consider the specific business, if the business is very dependent on redis, and single-machine QPS need to support the larger, we recommend the use of Phpredis. If you're just using laravel to achieve a small business using Redis, it's not recommended to change Predis.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.