# Pound and Long running actions

**URL:** <https://www.ruby-forum.com/t/pound-and-long-running-actions/116410>\
**Category:** Deployment\
**Created:** [October 5, 2007, 8:15am UTC](https://www.ruby-forum.com/t/pound-and-long-running-actions/116410 "2007-10-05T08:15:27Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![squeegy](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/dec6dc/32.png) [@squeegy](https://www.ruby-forum.com/u/squeegy)\
**Post date:** [October 5, 2007, 8:15am UTC](https://www.ruby-forum.com/t/pound-and-long-running-actions/116410/1 "2007-10-05T08:15:27Z")

</div>

I have a site with some administration actions that are long running.  
The problem seems to be that pound is sending requests to this locked up  
mongrel process, even though it has three other open ones. This is  
manifested as intermittent “Internal Server Error” when browsing the  
site while this action is running. It happens about 1 in 4 page loads,  
and there are 4 mongrels so I am pretty sure this is whats going on.

I cant find any log entries about anything going wrong. How do I tell  
pound to only send requests to unused mongrels?

I had this working on another box with lighttpd, which handled this  
beautifully.

Thanks!

---

<div class="post-metadata">

**Author:** ![squeegy](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/dec6dc/32.png) [@squeegy](https://www.ruby-forum.com/u/squeegy)\
**Post date:** [October 6, 2007, 2:03pm UTC](https://www.ruby-forum.com/t/pound-and-long-running-actions/116410/2 "2007-10-06T14:03:57Z")

</div>

Alex,

```
I would strongly recommend reworking your code to execute your

```

long running actions in a separated thread. This way you will prevent  
that every Mongrel gets busy with long running threads and your  
aplication becomes unresponsive.

```
There are different ways to handle Rails long running threads, the

```

simplest is to spawn a new script/runner process, also you could use  
BackgroundDrb:

```
http://backgroundrb.rubyforge.org/

Best regards,

```

–  
Aníbal Rojas

> **[Home - Has Many Developers](https://hasmanydevelopers.com/)**
>
> We are the best choice for your building design and development

> **[RUBYCORNER.COM](https://www.rubycorner.com/)**
>
> RUBYCORNER.COM - Contact us for any business inquiries

> **[Sin título](https://www.tumblr.com/anibal)**
>
> Follow @anibal and get more of the good stuff by joining Tumblr today. Dive in!

On Oct 5, 2:15 am, Alex W. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)

---

<div class="post-metadata">

**Author:** ![squeegy](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/dec6dc/32.png) [@squeegy](https://www.ruby-forum.com/u/squeegy)\
**Post date:** [October 7, 2007, 12:18am UTC](https://www.ruby-forum.com/t/pound-and-long-running-actions/116410/3 "2007-10-07T00:18:37Z")

</div>

AnÃ­bal Rojas wrote:

> Alex,
> 
> ```
> I would strongly recommend reworking your code to execute your
> 
> ```
> 
> long running actions in a separated thread. This way you will prevent  
> that every Mongrel gets busy with long running threads and your  
> aplication becomes unresponsive.
> 
> ```
> There are different ways to handle Rails long running threads, the
> 
> ```
> 
> simplest is to spawn a new script/runner process, also you could use  
> BackgroundDrb:
> 
> ```
> http://backgroundrb.rubyforge.org/
> 
> Best regards,
> 
> ```

I knew that was an option, but this is a somewhat old rails app at this  
point for an old client. I was trying to avoid spending this refactor  
time, hoping that mongrel + pound could handle this as elegantly as  
lighttpd + fcgi did.

There is also the added issue that the long running action writes to the  
session periodcally to update the user on its process. This would not  
work with Drb or script/runner since there is no session there. I guess  
I can write it to a file, and read that in.

But it’s work I was hoping I wouldn’t have to do.

Thanks for the tips
