alternatives to script/runner?

I've been using script/runner to add and delete files from the database in response to inotify events. This works in theory, but is too slow to keep up with a large number of events in succession; I'm suspecting that the bottleneck is that script/runner has a huge startup cost.

One thing I thought of was to queue inotify events, and call script/runner once a minute to clear the queue, but that seems a bit inelegant - ideally, what I'd like to do is have a persistent process that is aware of my rails models, and which I can just keep sending events to and have it process them as they come in. Any thoughts on strategies to accomplish this?

martin

You can set up a separate process with DRB server on a well known address/port. Then, you can manage it through DRB.

Won't that incur the extra overhead of a controller call? All I really need is activerecord and access to the models. I'm trying to do this in realtime (i.e. insert a file into the db as soon as inotify detects it) rather than via a cron job, and I have a feeling that if I can get rid of the script/runner startup time, the rest of the process will be able to keep up nicely.

martin

Can you point me to some resources on running a DRB server from within my rails app? Everything I've seen works the other way, with rails acting as the DRB client.

martin

google for the nice backgroundrb plugin.

Jens

[...]

Thanks - that worked beautifully. I did have a look at backgroundrb, but I had the same problem with it as with regular drb - as far as I could make out, all the documentation assumed that Rails was running the client, not the server.

martin