# Background Processing

**URL:** <https://www.ruby-forum.com/t/background-processing/89313>\
**Category:** Rails\
**Created:** [March 19, 2007, 2:22pm UTC](https://www.ruby-forum.com/t/background-processing/89313 "2007-03-19T14:22:47Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![simon1](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/fbc32d/32.png) [@simon1](https://www.ruby-forum.com/u/simon1)\
**Post date:** [March 19, 2007, 2:22pm UTC](https://www.ruby-forum.com/t/background-processing/89313/1 "2007-03-19T14:22:47Z")

</div>

Hi,

I have an application that accepts XML files through an HTTP POST, and  
then needs to process these files and send back a response. On some  
larger file sizes, this processing isn’t occurring quickly enough, and  
the HTTP request times out on the client side. In addition to this,  
the server could be receiving several of these files at the same time,  
leaving several clients hanging. I have been doing some reading  
regarding handling background processing, and was wondering if anybody  
had any experience with it?

What I’m hoping to do is to receive the XML document, and then send  
back a response to the client right away, before handling the  
processing. In my reading I have seen that some possible solutions  
might be to use ScriptRunner, or possibly to create a new Thread to  
handle the processing. Does anybody have some advice on a good way to  
handle this situation?

Thanks,

Simon

---

<div class="post-metadata">

**Author:** ![simon1](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/fbc32d/32.png) [@simon1](https://www.ruby-forum.com/u/simon1)\
**Post date:** [March 19, 2007, 2:26pm UTC](https://www.ruby-forum.com/t/background-processing/89313/2 "2007-03-19T14:26:48Z")

</div>

Personally, I wouldn’t go with either of those solutions… use  
Backgroundrb, this is exactly what it is built for… it interfaces  
seamlessly with Rails and will do exactly what you’re asking for. You  
can  
find out about it at: [http://backgroundrb.rubyforge.org/](http://backgroundrb.rubyforge.org/)

---

<div class="post-metadata">

**Author:** ![simon1](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/fbc32d/32.png) [@simon1](https://www.ruby-forum.com/u/simon1)\
**Post date:** [March 19, 2007, 2:32pm UTC](https://www.ruby-forum.com/t/background-processing/89313/3 "2007-03-19T14:32:49Z")

</div>

What you are looking for is backgroundrb.

[http://brainspl.at/articles/tag/background](http://brainspl.at/articles/tag/background)

> **[Introduction to BackgrounDRb](https://www.infoq.com/articles/BackgrounDRb/)**
>
> As the problem domain of your Rails applications expands, you may need to run computationally intensive or long running background tasks. How can you run these long background tasks without your web server timing out? And how do you display the...

You create worker objects that go about business that you define for  
them.  
These workers can be initialised by user driven events such as the xml  
upload in your case, or periodically from the time when the backgroundrb  
server is started.

regards  
ivor

---

<div class="post-metadata">

**Author:** ![simon1](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/fbc32d/32.png) [@simon1](https://www.ruby-forum.com/u/simon1)\
**Post date:** [March 19, 2007, 3:45pm UTC](https://www.ruby-forum.com/t/background-processing/89313/4 "2007-03-19T15:45:26Z")

</div>

Simon [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> What I’m hoping to do is to receive the XML document, and then send  
> back a response to the client right away, before handling the  
> processing. In my reading I have seen that some possible solutions  
> might be to use ScriptRunner, or possibly to create a new Thread to  
> handle the processing. Does anybody have some advice on a good way to  
> handle this situation?

I’m working on a system for stuff like this, but it’s not quite ready  
yet.  
Here’s what I have to far.

Cheers,  
Tyler

---

<div class="post-metadata">

**Author:** ![simon1](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/fbc32d/32.png) [@simon1](https://www.ruby-forum.com/u/simon1)\
**Post date:** [August 29, 2007, 12:32pm UTC](https://www.ruby-forum.com/t/background-processing/89313/5 "2007-08-29T12:32:04Z")

</div>

Thank you all  
I am trying this now  
🙂

---

<div class="post-metadata">

**Author:** ![simon1](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/fbc32d/32.png) [@simon1](https://www.ruby-forum.com/u/simon1)\
**Post date:** [August 30, 2007, 7:47am UTC](https://www.ruby-forum.com/t/background-processing/89313/6 "2007-08-30T07:47:30Z")

</div>

Selvaraj S. wrote:

> Jin Han wrote:
> 
> > Thank you all  
> > I am trying this now  
> > 🙂
> 
> This is good plugin for background process.I am using about last six  
> month.But this is giving more feature than what i require.
> 
> Generally it is creating new process for every request.After completing task.  
> the process are still alive.This is hitting the system performance.
> 
> Is there any way to kill the completing task or know the status of the  
> process?
> 
> Otherwise this is good one.

Sorry i corrected the small typing mistake…

---

<div class="post-metadata">

**Author:** ![simon1](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/fbc32d/32.png) [@simon1](https://www.ruby-forum.com/u/simon1)\
**Post date:** [August 30, 2007, 7:45am UTC](https://www.ruby-forum.com/t/background-processing/89313/7 "2007-08-30T07:45:55Z")

</div>

Jin Han wrote:

> Thank you all  
> I am trying this now  
> 🙂

This is good plugin for background process.I am using about last six  
month.But this is giving more feature than what i require.

Generally it is creating new process for every request.After completing  
the process are still alive.This is hitting the system performance.

Is there any way to kill the completing task or know the status of the  
process?

Otherwise this is good one.
