title: How to implement a distributed semaphore?
body: <p>I have a limited set of resources that I want to share between multiple processes than run on multiple servers. I guess what I need could be called a <em>distributed semaphore</em>.</p>
  
  <p>I have found an old <a href="http://cpansearch.perl.org/src/ZMIJ/Cache-Memcached-Semaphore-0.3/" rel="noreferrer">Perl implementation</a> (based on memcached) that could be adapted. I have not fully investigated it yet.</p>
  
  <p>Is there a library/component/software that already does that? An algorithm, perhaps?
  How about failover?</p>