# Expensive request processing

**URL:** <https://www.ruby-forum.com/t/expensive-request-processing/142017>\
**Category:** Rails\
**Created:** [July 2, 2008, 5:05pm UTC](https://www.ruby-forum.com/t/expensive-request-processing/142017 "2008-07-02T17:05:31Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![bpartridge](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/b9e5f3/32.png) [@bpartridge](https://www.ruby-forum.com/u/bpartridge)\
**Post date:** [July 2, 2008, 5:05pm UTC](https://www.ruby-forum.com/t/expensive-request-processing/142017/1 "2008-07-02T17:05:31Z")

</div>

I’m trying to decide between Rails and Seam (a Java framework) for an  
application whose main traffic will be PUT requests, with lengthy text  
parameters that will need to be parsed, split apart, and update multiple  
records. This could be quite CPU intensive, and I’m worried about  
ActiveRecord being single-threaded. I can’t put the processing in a  
background thread because of this. Any thoughts? Would I be able to  
use native SQL in a background thread?

---

<div class="post-metadata">

**Author:** ![bpartridge](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/b9e5f3/32.png) [@bpartridge](https://www.ruby-forum.com/u/bpartridge)\
**Post date:** [July 2, 2008, 5:16pm UTC](https://www.ruby-forum.com/t/expensive-request-processing/142017/2 "2008-07-02T17:16:07Z")

</div>

> I’m trying to decide between Rails and Seam (a Java framework) for an  
> application whose main traffic will be PUT requests, with lengthy text  
> parameters that will need to be parsed, split apart, and update  
> multiple  
> records. This could be quite CPU intensive, and I’m worried about  
> ActiveRecord being single-threaded. I can’t put the processing in a  
> background thread because of this. Any thoughts? Would I be able to  
> use native SQL in a background thread?

You may want to look at Merb as well.

---

<div class="post-metadata">

**Author:** ![bpartridge](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/b9e5f3/32.png) [@bpartridge](https://www.ruby-forum.com/u/bpartridge)\
**Post date:** [July 5, 2008, 1:34am UTC](https://www.ruby-forum.com/t/expensive-request-processing/142017/3 "2008-07-05T01:34:52Z")

</div>

I’m using backgroundrb, which is not (strictly speaking) a thread.  
It’s distributed Ruby, and runs in a separate process, but the usage  
is almost exactly as you would expect with threads. Because the  
processes are separate, each maintains separate ActiveRecord state and  
you don’t have the most pernicious concurrency issue. The database  
should maintain coherence.

Native SQL is not a problem, and if you don’t really care how long the  
background process takes to complete, this is just a great way to  
offload processing.

HTH.
