Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I am looking for a simple locking daemon which listens for clients over TCP and processes locking requests.

I need to synchronize parallel PHP processes at MULTIPLE machines. E.g. one machine may say "I lock the 'abcd' identifier from now and until my death", and if the second machine says the same "lock 'abcd'", its request will be delayed until 'abcd' is released by the first machine. An identifier is also freed if obtaining process is accidently dies (when it dies, the disconnect happens, so locking daemon may process this disconnect as lock release).

Note that memcached add() is not so good in this case, because it cannot handle unexpected disconnects (it is important: process may die in many cases unexpectedly and without a chance to free the lock; also the lock cannot be freed by timeout, because some of processes works for a long time). I need a daemon which keeps opened connections and cares about them.

share|improve this question

1 Answer 1

Not sure exactly what you're trying to do. Might Amazon's Simple Queue Service be appropriate?

http://aws.amazon.com/sqs/

In their explanation of the service, they say:

  • Developers can create an unlimited number of Amazon SQS queues with an unlimited number of messages.
  • A queue can be created in 4 regions – US East (Northern Virginia), US West (Northern California), EU (Ireland) and Asia Pacific (Singapore) regions.
  • The message body can contain up to 64 KB of text in any format (default is 8KB).
  • Messages can be retained in queues for up to 14 days (default is 4 days).
  • Messages can be sent and read simultaneously.
  • When a message is received, it becomes “locked” while being processed. This keeps other computers from processing the message simultaneously. If the message processing fails, the lock will expire and the message will be available again. In the case where the application needs more time for processing, the “lock” timeout can be changed dynamically via the ChangeMessageVisibility operation.
  • Developers can access Amazon SQS through standards-based SOAP and Query interfaces.
  • Developers can securely share Amazon SQS queues with others. Queues can be shared with other AWS accounts and Anonymously. Queue sharing can also be restricted by IP address and time-of-day.
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.