Help with the configuration of apache and fcgi

Hi Everyone,
I am sure this question has been asked many time before but I really
could
not get a good solution.
The problem I am having is that the application I wrote is acting very
slow.
For example for the production database, the query I make takes about
3-4
minutes. The application connects to 2 oracle databases(on a remote
location) and gets information based on a given search criteria.It runs
on
apache2. My understanding is (also based on rails book) that I need to
configure apache-fcgi to get things speed up. The machine I have is
windows
xp and right now the application resides on this machine. Searches are
made
through a vpn connection. Later on, the application will be moved to the
actual location.
I applied the rails book recommended way to do it so far no luck.
I also tried the steps recomended on these websites for different things
(lighttpd, fcgi, etc… etc…)

http://www.kevinworthington.com:8181/?p=102
http://www.zedshaw.com/projects/scgi_rails/lighttpd.html
http://wiki.rubyonrails.org/rails/pages/HowToDeployWithLighttpdOnWindows
and bunch of other places. I am utterly confused and do not know what I
am
doing.
Basically what I am asking is first and foremost
On a given windows xp (later to be moved to windows 2003 server), how do
i
configure my httpd.conf and other necessary files to get things faster
(I
mean much much faster than getting a single query in 3-4 minutes)
because I
know that this should not take that much time (Even for connecting
multiple
oracle databases).
My other question is can someone point me to the right direction on this
(step by step instructions on how to get things much faster, etc)
Could anyone please kindly advise?
Thank you
Deniz Rende

can anybody help please?

deniz rende wrote:

Hi Everyone,
I am sure this question has been asked many time before but I really
could not get a good solution.
The problem I am having is that the application I wrote is acting very
slow. For example for the production database, the query I make takes
about 3-4 minutes. The application connects to 2 oracle databases(on a
remote location) and gets information based on a given search
criteria.It runs on apache2. My understanding is (also based on rails
book) that I need to configure apache-fcgi to get things speed up.

You will only speed up your application by first finding where it is
spending its time, and then choosing how to improve matters. Are you
running in development mode? What does the log tell you about where the
time is being spent?

Have you tried running representative queries using script/console?

With your current apache2/rails configuration, how long does it take to
access a page that doesn’t query the database?

and bunch of other places. I am utterly confused and do not know what I
am doing.
Basically what I am asking is first and foremost
On a given windows xp (later to be moved to windows 2003 server), how do
i configure my httpd.conf and other necessary files to get things faster
(I mean much much faster than getting a single query in 3-4 minutes)
because I know that this should not take that much time (Even for
connecting multiple oracle databases).

For a given HTTP request that results in a DB query, the following
things have to happen:

  1. The request is passed to Rails and routed to the correct controller
    and action method. (If you are using CGI, this will mean loading Ruby,
    the Rails gems, and your application code - you can judge the time this
    takes by looking at the time taken to handle a trivial “hello world”
    Rails request in your environment.)

  2. The action method calls an ActiveRecord query, which is translated to
    SQL and issued to the database. (Running in development mode, look at
    the log and check what SQL is being used. Is it what you expect? Be
    aware that innocent-looking operations on your models may result in
    additional queries - if you have a lot of results from a query and then
    navigate to associated objects to find other information to display, you
    may inadvertently end up with hundreds of queries just to populate one
    page. You should ‘tail’ your log while testing your application - on
    Windows, I use Cygwin to do this.)

  3. The database executes the query and returns the results. (The time
    taken here will be about the same as if you issue the query
    interactively from a DB client.)

  4. ActiveRecord builds model objects from the results. (Unlikely to be
    the problem, but you can get a feel for it by using script/console to
    issue the query through ActiveRecord. Does that take much longer than
    doing the same query from a DB client?)

  5. Rails renders the page containing the results. (The development log
    tells you how much time was spent in rendering.)

You have been assuming that step 1 is the problem, so using FCGI would
make a big difference. I wouldn’t assume that! Assess the contribution
of each step to the total time before deciding what to do.

My other question is can someone point me to the right direction on this
(step by step instructions on how to get things much faster, etc)
Could anyone please kindly advise?
Thank you
Deniz Rende

I hope this helps

Justin