[Backgroundrb-devel] Problem with blocking workers
Marc Evans
Marc at SoftwareHackery.Com
Tue Apr 3 16:02:29 EDT 2007
On Tue, 3 Apr 2007, Christian Schlaefcke wrote:
> Marc Evans schrieb:
>> Based on my experiences, you will have a difficult time doing what you want
>> to do, at least if trying to use backgroundrb. If I were attacking this
>> problem, I probably would use a far less elegant approach, that being to
>> fork a new child in which the query is run.
>>
>> Hopefully, others on this list have a better suggestion than I do...
> Could you provide an example for your suggestion? I played around with ruby
> threads before I switched to backgroundrb. I set up a test where have two
> threads that should download a large file from my server. This should pretty
> much simulate what I want to do at work. It seems to me that one thread works
> after the other and not concurrently. I also encountered the situation where
> none of the thread started (race condition?).
>
> I would be glad for any hint on this. Hopefully it is possible to solve with
> Backgroundrb...
My suggestion was to use Process.fork, e.g. avoid the ruby thread issue.
It's much heavier weight, and requires that you re-invent status tracking
and related mechanisms. That said, I don't believe that you will encounter
the blocking problems observed in thread-style code.
- Marc
More information about the Backgroundrb-devel
mailing list