# SCGI and Concurrency

**URL:** <https://www.ruby-forum.com/t/scgi-and-concurrency/97071>\
**Category:** Rails\
**Created:** [December 10, 2005, 12:44am UTC](https://www.ruby-forum.com/t/scgi-and-concurrency/97071 "2005-12-10T00:44:55Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![lists](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/cdc98d/32.png) [@lists](https://www.ruby-forum.com/u/lists)\
**Post date:** [December 10, 2005, 12:44am UTC](https://www.ruby-forum.com/t/scgi-and-concurrency/97071/1 "2005-12-10T00:44:55Z")

</div>

A potentially dumb SCGI question here…

I am trying out SCGI. It’s a great departure from the complexity of  
FastCGI.

Anyway, with FCGI I am used to seeing multiple dispatcher.fcgi processes  
in  
my ‘ps aux’ output.

With SCGI I see only a single entry. I assume then that SCGI is doing  
internal threading instead of process forking?

The only thing that threw me is that with FCGI I would see multiple  
database  
connections open and I only see a single connection with my SCGI setup.

Did I miss a flag to have multiple listeners? Looking at the doco, I  
didn’t  
see anything.

If anyone has any info, it is appreciated.

Cheers.

---

<div class="post-metadata">

**Author:** ![lists](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/cdc98d/32.png) [@lists](https://www.ruby-forum.com/u/lists)\
**Post date:** [December 10, 2005, 2:34am UTC](https://www.ruby-forum.com/t/scgi-and-concurrency/97071/2 "2005-12-10T02:34:59Z")

</div>

Hi !

2005/12/9, Hunter’s Lists [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid):

> A potentially dumb SCGI question here…

Nope, never. What you want is an SCGI cluster.

Works mostly the same way, except you replace scgi\_ctrl with  
scgi\_cluster.

Configuration example:  
scgi\_cluster config -c 3 -e production -p 2049 -h 127.0.0.1

Configure 3 children (-c 3) in production environment (-e production),  
listening on consecutive ports starting at 2049 (-p 2049), and bind  
only on 127.0.0.1 (-h 127.0.0.1).

Then, you start the cluster like this:  
scgi\_cluster start

Hope that helps !

---

<div class="post-metadata">

**Author:** ![lists](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/cdc98d/32.png) [@lists](https://www.ruby-forum.com/u/lists)\
**Post date:** [December 10, 2005, 3:36am UTC](https://www.ruby-forum.com/t/scgi-and-concurrency/97071/3 "2005-12-10T03:36:22Z")

</div>

Excellent!

I did see that in the documentation.

Now, on to my next question - do I have to change my Apache 2 config?

I have a single SCGIMount directive:

SCGIMount / 127.0.0.1:9999

Do I need to do anything to tell Apache to hand off to the extra  
instances?

Thanks again,  
Hunter

> From: Francois B. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
> Reply-To: [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
> Date: Fri, 9 Dec 2005 20:33:05 -0500  
> To: [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
> Subject: Re: [Rails] SCGI and Concurrency
> 
> Hi !

2005/12/9, Hunter’s Lists [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid):

> A potentially  
> dumb SCGI question here…

Nope, never. What you want is an SCGI

> cluster.

Works mostly the same way, except you replace scgi\_ctrl with

> scgi\_cluster.

Configuration example:  
scgi\_cluster config -c 3 -e production

> -p 2049 -h 127.0.0.1

Configure 3 children (-c 3) in production environment

> (-e production),  
> listening on consecutive ports starting at 2049 (-p 2049),  
> and bind  
> only on 127.0.0.1 (-h 127.0.0.1).

Then, you start the cluster like

> this:  
> scgi\_cluster start

## Hope that helps !

François

> Beausoleil  
> [http://blog.teksol.info/](http://blog.teksol.info/)

---

<div class="post-metadata">

**Author:** ![lists](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/cdc98d/32.png) [@lists](https://www.ruby-forum.com/u/lists)\
**Post date:** [December 10, 2005, 4:49am UTC](https://www.ruby-forum.com/t/scgi-and-concurrency/97071/4 "2005-12-10T04:49:54Z")

</div>

Hi !

2005/12/9, Hunter’s Lists [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid):

> Now, on to my next question - do I have to change my Apache 2 config?

Eh, I have the same problem. Seems Apache does not play well with  
SCGI clusters… See the thread entitled “SCGI cluster configuration  
example for Apache”. I can’t provide you with a link, unfortunately,  
because I can’t find it in the gmane archive…

There were two solutions in there. Haven’t tried any of them yet.

Bye !

---

<div class="post-metadata">

**Author:** ![lists](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/cdc98d/32.png) [@lists](https://www.ruby-forum.com/u/lists)\
**Post date:** [December 10, 2005, 11:07pm UTC](https://www.ruby-forum.com/t/scgi-and-concurrency/97071/5 "2005-12-10T23:07:59Z")

</div>

Yeah, I can’t find the thread either…

Does anyone have a link?

> From: Francois B. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
> Reply-To: [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
> Date: Fri, 9 Dec 2005 22:46:18 -0500  
> To: [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
> Subject: Re: [Rails] SCGI and Concurrency
> 
> Hi !

2005/12/9, Hunter’s Lists [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid):

> Now, on to my  
> next question - do I have to change my Apache 2 config?

Eh, I have the same

> problem. Seems Apache does not play well with  
> SCGI clusters… See the  
> thread entitled “SCGI cluster configuration  
> example for Apache”. I can’t  
> provide you with a link, unfortunately,  
> because I can’t find it in the gmane  
> archive…

There were two solutions in there. Haven’t tried any of them

> yet.

## Bye !

François Beausoleil  
[http://blog.teksol.info/](http://blog.teksol.info/)

---

<div class="post-metadata">

**Author:** ![lists](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/cdc98d/32.png) [@lists](https://www.ruby-forum.com/u/lists)\
**Post date:** [December 11, 2005, 9:24am UTC](https://www.ruby-forum.com/t/scgi-and-concurrency/97071/6 "2005-12-11T09:24:37Z")

</div>

2005/12/10, Hunter’s Lists [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid):

> Yeah, I can’t find the thread either…
> 
> Does anyone have a link?

Here it is : [http://article.gmane.org/gmane.comp.lang.ruby.rails/33836](http://article.gmane.org/gmane.comp.lang.ruby.rails/33836)

---

<div class="post-metadata">

**Author:** ![lists](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/cdc98d/32.png) [@lists](https://www.ruby-forum.com/u/lists)\
**Post date:** [December 11, 2005, 9:57pm UTC](https://www.ruby-forum.com/t/scgi-and-concurrency/97071/7 "2005-12-11T21:57:13Z")

</div>

Thanks.

So, is anyone using this method or using an SCGI cluster with Apache 2?

Does this uber hack work?

Hunter
