Memcached and Redis performance test comparison

Source: Internet
Author: User
Tags add time memcached

Much of the online introduction to the memcached and Redis differences is that Redis is more of a topic than the data types supported by memcached, and the performance ratio is very small, and I'm doing a performance test for both.

The test content is as follows:

Both add 50,000 key-value, and value is a string, the test script is PHP and the system is a dual-core processor.

Add time-consuming:

Memcached: The first time takes 18 seconds, followed by a repeat load of 10 times, averaging 4.7 seconds. Memory consumption: 47M 32

Redis: The first time takes 19 seconds, followed by a repeat load of 10 times, averaging 4.8 seconds. Memory consumption: 54M

Data statistics for 50,000 keys are time consuming:

Memcached: Average 1.2 seconds

Redis: 1.5 seconds on average

The difference between the two performance is not very large, memcached slightly higher.

For key-value storage, the value of memcached, in addition to supporting strings, can also be stored directly in the array, directly storing the array to write code conveniently, but the memory and time consuming than storing the string is significantly time consuming.

$arr = [

' A ' = ' 1 ',

' B ' = ' 2 ',

' C ' = ' 3 ',

...

];

$cache->set (' Key0 ', Json_encode ($arr)); Storing strings

$cache->set (' Key0 ', $arr); Storing arrays

Memcached and Redis performance test comparison

Related Article

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.