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.

1 Answer
1

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.