List:General Discussion« Previous MessageNext Message »
From:Jerry Schwartz Date:July 2 2008 2:40pm
Subject:RE: Queues on MySQL?
View as plain text  
>-----Original Message-----
>From: Waynn Lue [mailto:waynnlue@stripped]
>Sent: Tuesday, July 01, 2008 5:26 PM
>To: Jerry Schwartz
>Cc: MySQL List
>Subject: Re: Queues on MySQL?
>
>>>Thanks for the suggestion--is that essentially using
>>>http://www.php.net/posix_mkfifo within PHP?
>>>
>> [JS] Yes, that's what I had in mind. Be warned, though: I've never
>used this
>> from PHP; and, although I found no references to this in the PHP
>> documentation, I couldn't find the POSIX functions in a Windows
>> installation.
>
>Hm, I've spent some more time investigating this, and I'm not sure
>it'll work quite as expected.  It looks like it's a blocking write to
>the pipe, which means it'll block until a reader actually acts on the
>pipe.
[JS] That is what the documentation says, so I presume it is true; and it is
a horrible limitation. In fact, even opening a fifo will block unless there
is somebody at the other end.

I took a quick look around the documentation, and although you can use
stream_set_blocking() (I think), it only takes affect after the stream is
open. That gets you back to the fopen issue.

A trick I have used is to have a dummy process that always has the fifo
open. This process could even be started up by init, and defined so that it
is restarted if it fails. You don't want this process to read the file, just
open it for reading and sit there looping on a sleep(). Once you have that
guy going, your other programs can execute with impunity.

In any case, I think I've lead you down the garden path. I believe that
sockets are the way to go.



Thread
Queues on MySQL?Waynn Lue30 Jun
  • RE: Queues on MySQL?Jerry Schwartz30 Jun
    • Re: Queues on MySQL?Waynn Lue1 Jul
      • RE: Queues on MySQL?Jerry Schwartz1 Jul
        • Re: Queues on MySQL?Waynn Lue1 Jul
          • RE: Queues on MySQL?Jerry Schwartz2 Jul