# FastCGI performance question

**URL:** <https://www.ruby-forum.com/t/fastcgi-performance-question/52072>\
**Category:** Rails\
**Created:** [December 4, 2005, 7:43pm UTC](https://www.ruby-forum.com/t/fastcgi-performance-question/52072 "2005-12-04T19:43:18Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![frocco](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/f/a87d85/32.png) [@frocco](https://www.ruby-forum.com/u/frocco)\
**Post date:** [December 4, 2005, 7:43pm UTC](https://www.ruby-forum.com/t/fastcgi-performance-question/52072/1 "2005-12-04T19:43:18Z")

</div>

Hello,

I’m coming from a PHP, ASP and JSP environment and learning Rails.  
I just purchased the “Agile Web D. with Rails” and find it  
excellent.

Here’s my question:  
I always thought that CGI apps were slow and memory hogs as compared to  
servlets that have one copy in memory.

Is this true when hosting rails apps on Windows?  
I hope not as I am really impressed with Rails web development.

Thanks

Frank

---

<div class="post-metadata">

**Author:** ![frocco](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/f/a87d85/32.png) [@frocco](https://www.ruby-forum.com/u/frocco)\
**Post date:** [December 4, 2005, 7:47pm UTC](https://www.ruby-forum.com/t/fastcgi-performance-question/52072/2 "2005-12-04T19:47:23Z")

</div>

On 5/12/2005, at 7:40 AM, Frank R. wrote:

> Here’s my question:  
> I always thought that CGI apps were slow and memory hogs as  
> compared to servlets that have one copy in memory.
> 
> Is this true when hosting rails apps on Windows?

Rails uses FastCGI which behaves similar to a servlet - it loads one  
copy and keeps it loaded, and therefore is quite fast.

–  
Phillip H.  
removed\_email\_address@domain.invalid

---

<div class="post-metadata">

**Author:** ![frocco](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/f/a87d85/32.png) [@frocco](https://www.ruby-forum.com/u/frocco)\
**Post date:** [December 4, 2005, 7:59pm UTC](https://www.ruby-forum.com/t/fastcgi-performance-question/52072/3 "2005-12-04T19:59:33Z")

</div>

Hi, Frank,

coming from java-webapp-development myself I’m petty impressed until  
now, what rails has achieved performance wise. Here is a pointer to some  
research done by Justin Gehtland:  
[http://weblog.rubyonrails.com/articles/2005/04/04/justin-160-gehtland-is-back-with-numbers-to-back-it-up](http://weblog.rubyonrails.com/articles/2005/04/04/justin-160-gehtland-is-back-with-numbers-to-back-it-up)  
. You might also be interested in switchtower:  
[Peak Obsession](http://manuals.rubyonrails.com/read/book/17) which you’ll want to use if  
scaling is an issue.

Regards  
Jan Pril.

---

<div class="post-metadata">

**Author:** ![frocco](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/f/a87d85/32.png) [@frocco](https://www.ruby-forum.com/u/frocco)\
**Post date:** [December 4, 2005, 8:03pm UTC](https://www.ruby-forum.com/t/fastcgi-performance-question/52072/4 "2005-12-04T20:03:37Z")

</div>

On Sun, 4 Dec 2005, Frank R. wrote:

> Hello,
> 
> I’m coming from a PHP, ASP and JSP environment and learning Rails. I just  
> purchased the “Agile Web D. with Rails” and find it excellent.
> 
> Here’s my question: I always thought that CGI apps were slow and memory hogs  
> as compared to servlets that have one copy in memory.

a fastcgi process **is** a servlet. rails runs in two modes cgi **and**  
fastcgi. cgi is slow and for development only, fastcgi is a servlet  
type  
model which is several orders of magnitude faster that plain cgi.

google fastcgi.

cheers.

-a

---

<div class="post-metadata">

**Author:** ![frocco](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/f/a87d85/32.png) [@frocco](https://www.ruby-forum.com/u/frocco)\
**Post date:** [December 5, 2005, 2:45am UTC](https://www.ruby-forum.com/t/fastcgi-performance-question/52072/5 "2005-12-05T02:45:58Z")

</div>

Thanks for the links.  
I appreciate everybody’s help.

Frank  
----- Original Message -----  
From: “Jan P.” [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
To: [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
Sent: Sunday, December 04, 2005 1:55 PM  
Subject: Re: [Rails] FastCGI performance question

---

<div class="post-metadata">

**Author:** ![frocco](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/f/a87d85/32.png) [@frocco](https://www.ruby-forum.com/u/frocco)\
**Post date:** [December 4, 2005, 8:07pm UTC](https://www.ruby-forum.com/t/fastcgi-performance-question/52072/6 "2005-12-04T20:07:40Z")

</div>

Thanks you, I did not realize that.

Frank

----- Original Message -----  
From: [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
To: [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
Sent: Sunday, December 04, 2005 2:02 PM  
Subject: Re: [Rails] FastCGI performance question

> > as compared to servlets that have one copy in memory.  
> > –  
> > ===============================================================================  
> > | ara [dot] t [dot] howard [at] noaa [dot] gov  
> > | all happiness comes from the desire for others to be happy. all misery  
> > | comes from the desire for oneself to be happy.  
> > | – bodhicaryavatara  
> > ===============================================================================

* * *

> * * *
> 
> Rails mailing list  
> removed\_email\_address@domain.invalid  
> [http://lists.rubyonrails.org/mailman/listinfo/rails](http://lists.rubyonrails.org/mailman/listinfo/rails)

* * *

---

<div class="post-metadata">

**Author:** ![frocco](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/f/a87d85/32.png) [@frocco](https://www.ruby-forum.com/u/frocco)\
**Post date:** [December 6, 2005, 9:42am UTC](https://www.ruby-forum.com/t/fastcgi-performance-question/52072/7 "2005-12-06T09:42:43Z")

</div>

removed\_email\_address@domain.invalid wrote:

> > as compared to servlets that have one copy in memory.
> 
> a fastcgi process **is** a servlet. rails runs in two modes cgi **and**  
> fastcgi. cgi is slow and for development only, fastcgi is a servlet type  
> model which is several orders of magnitude faster that plain cgi.

I _strongly_ suggest not to use CGI at all, not even for development  
mode. For several reasons:

1. The execution model of CGI is very different from FCGI.
2. Developing in an environment that doesn’t resemble your production  
environment as closely as possible is bound to hide potential production  
environment problems.
3. It will slow down your development process considerably.

– stefan

[http://railsexpress.de/blog](http://railsexpress.de/blog)

---

<div class="post-metadata">

**Author:** ![frocco](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/f/a87d85/32.png) [@frocco](https://www.ruby-forum.com/u/frocco)\
**Post date:** [December 6, 2005, 10:11pm UTC](https://www.ruby-forum.com/t/fastcgi-performance-question/52072/8 "2005-12-06T22:11:37Z")

</div>

I’m curious about this…does lighttpd running through script/server use  
FCGI or not?

skaes wrote:

> I _strongly_ suggest not to use CGI at all, not even for development  
> mode. For several reasons:
> 
> 1. The execution model of CGI is very different from FCGI.
> 2. Developing in an environment that doesn’t resemble your production  
> environment as closely as possible is bound to hide potential production  
> environment problems.
> 3. It will slow down your development process considerably.
> 
> – stefan
> 
> [http://railsexpress.de/blog](http://railsexpress.de/blog)

---

<div class="post-metadata">

**Author:** ![frocco](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/f/a87d85/32.png) [@frocco](https://www.ruby-forum.com/u/frocco)\
**Post date:** [December 7, 2005, 3:28am UTC](https://www.ruby-forum.com/t/fastcgi-performance-question/52072/9 "2005-12-07T03:28:12Z")

</div>

lighttpd does use fcgi, but as it was stated earlier, it runs  
completly differently then regular cgi. Webrick uses its very own  
method I’m assuming, becuse its all in rails.
