ketama | C library for consistent hashing , and langauge bindings | Hashing library

 by   RJ C Version: Current License: BSD-2-Clause

kandi X-RAY | ketama Summary

kandi X-RAY | ketama Summary

ketama is a C library typically used in Security, Hashing applications. ketama has no bugs, it has no vulnerabilities, it has a Permissive License and it has medium support. You can download it from GitHub.

We wrote ketama to replace how our memcached clients mapped keys to servers. Previously, clients mapped keys→servers like this:. This meant that whenever we added or removed servers from the pool, everything hashed to different servers, which effectively wiped the entire cache.
Support
    Quality
      Security
        License
          Reuse

            kandi-support Support

              ketama has a medium active ecosystem.
              It has 798 star(s) with 162 fork(s). There are 44 watchers for this library.
              OutlinedDot
              It had no major release in the last 6 months.
              There are 7 open issues and 3 have been closed. On average issues are closed in 263 days. There are 3 open pull requests and 0 closed requests.
              It has a neutral sentiment in the developer community.
              The latest version of ketama is current.

            kandi-Quality Quality

              ketama has no bugs reported.

            kandi-Security Security

              ketama has no vulnerabilities reported, and its dependent libraries have no vulnerabilities reported.

            kandi-License License

              ketama is licensed under the BSD-2-Clause License. This license is Permissive.
              Permissive licenses have the least restrictions, and you can use them in most projects.

            kandi-Reuse Reuse

              ketama releases are not available. You will need to build from source code and install.
              Installation instructions, examples and code snippets are available.

            Top functions reviewed by kandi - BETA

            kandi's functional review helps you automatically verify the functionalities of the libraries and avoid rework.
            Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of ketama
            Get all kandi verified functions for this library.

            ketama Key Features

            No Key Features are available at this moment for ketama.

            ketama Examples and Code Snippets

            No Code Snippets are available at this moment for ketama.

            Community Discussions

            QUESTION

            Istio 0.8. Details about LoadBalancerSettings.ConsistentHashLB
            Asked 2020-May-17 at 20:16

            Could someone provide more details or examples about how works this load balance algorithm?

            https://istio.io/docs/reference/config/istio.networking.v1alpha3/#LoadBalancerSettings.ConsistentHashLB

            Consistent hashing (ketama hash) based load balancer for even load distribution/redistribution when the connection pool changes. This load balancing policy is applicable only for HTTP-based connections. A user specified HTTP header is used as the key with xxHash hashing.

            ...

            ANSWER

            Answered 2020-May-17 at 20:16

            The LoadBalancerSettings.ConsistentHashLB flag is for an Envoy configuration, and there's more detail in Envoy's Load Balancing Docs:

            The ring/modulo hash load balancer implements consistent hashing to upstream hosts. The algorithm is based on mapping all hosts onto a circle such that the addition or removal of a host from the host set changes only affect 1/N requests. This technique is also commonly known as “ketama” hashing.

            It's an hash algorithm that decreases the impact of servers being added and removed from Envoy's balancing pool (e.g. the servers behind a VirtualService).

            Without such an algorithm, adding a single server to the pool causes hashes to map to different servers:

            We wrote ketama to replace how our memcached clients mapped keys to servers...whenever we added or removed servers from the pool, everything hashed to different servers, which effectively wiped the entire cache.

            Back to Istio - Envoy's docs again note:

            A consistent hashing load balancer is only effective when protocol routing is used that specifies a value to hash on.

            which means - specify a header to generate the hash from. From Istio docs:

            httpHeader | string | REQUIRED. The name of the HTTP request header that will be used to obtain the hash key. If the request header is not present, the load balancer will use a random number as the hash, effectively making the load balancing policy random.

            Source https://stackoverflow.com/questions/50666756

            QUESTION

            Python pylibmc syntax / how can I use mc.set in a loop
            Asked 2020-Mar-16 at 16:03

            I want to set keys in a for loop, and read them back in another script also using a loop. To test memcache is working I made these simple scripts:

            a.py

            ...

            ANSWER

            Answered 2020-Mar-16 at 16:03

            you can use f-strings:

            Source https://stackoverflow.com/questions/60708123

            QUESTION

            Unicode error when loading a json_encoded PHP array from memcached
            Asked 2019-Jun-13 at 23:12

            I need to transfer a PHP associative array to further processing using python. The python code however using pylibmc is unable to load the string from memcached, throwing this error:

            ...

            ANSWER

            Answered 2019-Jun-13 at 23:12

            While trying to determine the encoding of the resulting string retrieved from memcached via pymemcache, it occurred to me that the string didn't look like any known encoding, I confirmed this using chardet as well as cchardet.

            After some more digging at the PHP end, I discovered that the PHP memcached module adulterates the strings it saves to memcached by compressing the data!

            Solution was to add this line to the /etc/php/7.2/cli/conf.d/25-memcached.ini file:

            Source https://stackoverflow.com/questions/56574017

            QUESTION

            Does Nginx respect the weight attribute with consistent hashing?
            Asked 2018-Nov-28 at 15:25

            More specific, will this work ?

            ...

            ANSWER

            Answered 2018-Nov-28 at 15:25

            In this configuration, consistent hash is more important than weight.

            In other words, if one upstream presents both weight and a consistent hash, then the main thing will be a consistent hash.

            And hashes are distributed to the servers according to the weight.

            Source https://stackoverflow.com/questions/42003787

            QUESTION

            connecting to flask app over VPN
            Asked 2017-Jul-04 at 05:31

            I am new to Flask and please do not mind if the problem sounds trivial. I have a Flask app (not written by me) which works fine from the local machine as well as remote machines as well when I am directly connected to the network.

            But when I connect to the app over VPN it doesn't work. I am able to ssh on that machine as well as access other servers running on the same machine. It is a physical machine and not a VM

            ...

            ANSWER

            Answered 2017-Jul-04 at 05:31

            It seems that you want to access to local enabled flask over another network. 0.0.0.0 ip is to connect to flask from different machines, but in the same network range. so if your IP isn't in the same range, this fails.

            if you want to access your web page from the internet, you should consider to deploy your webapp.

            Source https://stackoverflow.com/questions/44889727

            QUESTION

            Twemproxy Lag Forces a Restart
            Asked 2017-Feb-15 at 17:55

            We are running a PHP stack on our app servers which use twemproxy locally (via socket), to connect to multiple upstream memcached servers (EC2 small instances) for our caching layer.

            Every so often I get an alert from our app monitor that a page load time takes > 5 seconds. When this occurs, the immediate fix is to restart the twemproxy service on each app server, which is a hassle.

            The only fix I have now is a crontab that runs every minute and restarts the service, but as you can imagine nothing gets written for a few seconds every minute, which is not a desired, permanent solution.

            Has anyone encountered this before? If so, what was the fix? I tried to switch to AWS Elasticache but it didn't have the same performance as our current twemproxy solution.

            Here is my twemproxy config.

            ...

            ANSWER

            Answered 2017-Feb-10 at 13:19

            The number of open / stale socket connections may be the issue

            Source https://stackoverflow.com/questions/41989898

            Community Discussions, Code Snippets contain sources that include Stack Exchange Network

            Vulnerabilities

            No vulnerabilities reported

            Install ketama

            libketama (the general purpose C library). $ cd libketama $ make $ make test $ su -c "make install". This will compile libketama and install it to the default prefix /usr/local. You can change the prefix by editing the PREFIX variable in 'Makefile'. $ cd php-4.4.x/ext $ ln -s /your/ketama/php_ketama ketama $ cd .. $ rm -Rf autom4te.cache $ ./buildconf --force $ ./configure --all_your_configure_options --with-ketama[=/your/ketama/prefix] $ make $ su -c "make install". $ cd python_ketama $ python setup.py build $ sudo python setup.py install $ python tests.py. Use the NIF written at rd.io: https://github.com/abs/ketama/tree/rdio/erlang.
            libketama (the general purpose C library)
            php_ketama (PHP extension that wraps libketama and therefore depends on it)
            python_ketama (python module that depends on libketama)
            erlang

            Support

            For any new features, suggestions and bugs create an issue on GitHub. If you have any questions check and ask questions on community page Stack Overflow .
            Find more information at:

            Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items

            Find more libraries
            CLONE
          • HTTPS

            https://github.com/RJ/ketama.git

          • CLI

            gh repo clone RJ/ketama

          • sshUrl

            git@github.com:RJ/ketama.git

          • Stay Updated

            Subscribe to our newsletter for trending solutions and developer bootcamps

            Agree to Sign up and Terms & Conditions

            Share this Page

            share link