Out of the consistent hash algorithm in C # and. NET and create more efficient distributed caching

Source: Internet
Author: User
Tags hash memcached

Background

When it comes to distributed caching, the first thing you think about is memcached. Indeed, Memcached is one of the most popular options at the moment. But many internet companies don't have to memcached, like new eggs. Why not choose memcached, hit rate? Hot-swappable? or performance. Here we should not put the conclusion and speak with the facts.

Algorithm-1. Remainder method

If you have an old version of the Memcache official document on hand. You will find that they are using the Yufarai to maintain the consistency of the nodes. If you have n cache servers, you need to set an object into a node. With the hash to take the mold so that you can very evenly ensure that each load. So, as the most basic polling algorithm, is suitable for distributed caching we look at the example.

This assumes that there are 4 cache nodes, first set the redundancy scheme.

999 key values are automatically set.

Here's a look at the overall results of the solution

This article URL address: http://www.bianceng.cn/Programming/csharp/201410/45481.htm

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.