What is the number of keys and value values stored in?

Source: Internet
Author: User
There are a lot of key=>value form of value pairs, such as: XXXX=>AAAAAAA, the value once established will not change, the number of words will reach millions later, and often access to, concurrency is not high, but to ensure that the data integrity. What is the best way to save?

Reply content:

There are a lot of key=>value form of value pairs, such as: XXXX=>AAAAAAA, the value once established will not change, the number of words will reach millions later, and often access to, concurrency is not high, but to ensure that the data integrity. What is the best way to save?

In fact, to ask the question again, the answer is naturally.

    • The way to be accessed, in addition to "often access to, concurrency is not high", the form of access is a single key query or check multiple? is the data in order? Is there a requirement like "Search key prefix is foo"? Have a "list of 10 key" requirements? Need to "list all keys"? Is access a random key or is it centered on a partial hotspot key value? What about the ratio of hot and cold key values? Current concurrency is not high, whether you need to consider later concurrency increases the future of the scenario?

    • is the data complete and need to be backed up? How often does the key increase? Does the newly added key need to be accessible immediately?

    • What is the length of key and value, respectively? Millions 1K is a memory strip, millions 1M is a disk.

In general, the condition is not particularly extreme, the menu redis& backup, single mysql& backup, or Mysql+redis, each has a length, see what you want and what resources in your hand to find the balance point

PS: Don't forget that MySQL also points to MySQL on the SSD and the MySQL on the mechanical disk, but also each has the pros and cons of

Redis more convenient generally put in memory can also put the hard disk

Concurrency is not high, the database, millions the single table enough, and high, the front plus a layer of memcached

There are two main points from your requirements: values are not changed once they are established, and data integrity is guaranteed.
Database is not run off, currently in the data integrity to ensure that the database is the first choice, but also the most common most trustworthy. And for the number of words later will reach millions, and often access, concurrency is not high three points can consider using a memory database to provide access efficiency, such as REDIS, data structures using ordinary K-V structure can be.

Memcached

Depending on the key hash to a different file, depending on the amount of traffic to decide whether to add a layer of memory cache

Use MySQL to store it, and then add Redis as the front buffer.

Just key-value, you can not put the database. Find some KV-type NoSQL that can be used. If you have persistence, consider Redis, or ssdb. NoSQL can easily do key-based sharding to solve your data capacity and traffic problems.

Use APC directly, it's easier!

  • 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.