Forum: Ruby on Rails Controller Methods gets called twice on single invocation

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Navin Samuel (Guest)
on 2006-02-24 11:08
I have no idea why this is happening but it seems like every method on
my controller gets called twice. Here is what it looks like when I call
a list using the scaffold code


==========================

Processing DepartmentsController#index (for 127.0.0.1 at 2006-02-24
01:05:00) [GET]
  Parameters: {"action"=>"index", "controller"=>"departments"}
  Department Count (0.000000)   SELECT COUNT(*) FROM
departments 
  Department Load (0.010000)   SELECT * FROM
departments LIMIT 0, 10
Rendering layoutfalseactionlist within layouts/StandardLayout
Rendering departments/list
  Department Columns (0.030000)   SHOW FIELDS FROM
departments
Completed in 0.22100 (4 reqs/sec) | Rendering: 0.10000 (45%) | DB:
0.04000 (18%) | 200 OK [http://localhost/departments/]


Processing DepartmentsController#index (for 127.0.0.1 at 2006-02-24
01:05:01) [GET]
  Parameters: {"action"=>"index", "controller"=>"departments"}
  Department Count (0.000000)   SELECT COUNT(*) FROM
departments 
  Department Load (0.000000)   SELECT * FROM
departments LIMIT 0, 10
Rendering layoutfalseactionlist within layouts/StandardLayout
Rendering departments/list
  Department Columns (0.020000)   SHOW FIELDS FROM
departments
Completed in 0.06000 (16 reqs/sec) | Rendering: 0.03000 (50%) | DB:
0.02000 (33%) | 200 OK [http://localhost/departments/]


================================

I dont know why this is happening. Please helpme
Simon C. Wex (Guest)
on 2006-02-24 18:18
(Received via mailing list)
Hey guys,

I started a new job recently in a mobile R&D dept for a large company.
Our team is small and has some autonomy. My boss has given me the
go-ahead to write a couple of apps that are coming down the pipe using
Rails. - With one proviso: Any apps we write have to run in our dept's
environment. - IIS.

I know it's possible to run RoR on IIS using ISAPI filters and fastCGI.
So here are my Q's:

1. Has anyone done any benchmarks with it? Is there any reason this
couldn't be viable for production loads?  (feel free to speculate if you
haven't)

2. Are there any practical suggestions for laying out an application
(one web site) that is both asp.net and RoR for the regex isapi filters?
(sub-domain them, different paths etc)

I really appreciate any help you guys can offer, I'm dreading the
thought of 40 hrs a week of red tape and static typing.

Cheers, Simon.
Charles L. (Guest)
on 2006-02-24 22:42
(Received via mailing list)
I had a single Rails app running on ISAPI with IIS at one point.  It is
a royal pain to configure though...  and it doesn't run multiple Rails
applications very well because you have to basically create a new DNS
alias for each application if I remember correctly.

What I did was put a 2nd NIC in my IIS server and bound port 80 on the
2nd NIC to Apache and a different DNS alias.  That way I could utilize
existing an existing Windows server already running IIS.  My RoR on
Apache/FastCGI on Windows 2003 now hosts several RoR apps for our
company.  The company I work for is a big company with 6000+ employees.
I got some pain from some of my co-workers and management about
introducing a new development environment we would have to support.
However now that I have written some incredible RoR apps in a fraction
of the time it would take to write the same application in ASP.NET I
have now converted management into Ruby on Rails fans.  They know that
the _best_ developers in the company prefer RoR to inferior development
environments :)

The bottom line is yes, IIS + ISAPI + FastCGI works.  But it is ugly as
sin, hard to configure, and a performance hog.  Maybe toss out the idea
of running Apache or Lighttpd on port 80 on a 2nd NIC and see if you can
get a chance to try it.

Just watch out for 2003 server grabbing port 80 on the 2nd NIC away from
Apache.  There is something you have to do to stop it from grabbing port
80 on the 2nd NIC.

Charles
unknown (Guest)
on 2006-02-25 00:46
(Received via mailing list)
That sounds like a pretty good idea, for now I might run apache/FastCGI
on a different port and later on a new NIC. And once this "crazy ruby"
stuff proves itself get a couple of *nix boxes.

Thanks, Simon.
Rafael S. (Guest)
on 2006-02-25 21:46
(Received via mailing list)
> couldn't be viable for production loads?  (feel free to speculate if you
> haven't)
>
> 2. Are there any practical suggestions for laying out an application
> (one web site) that is both asp.net and RoR for the regex isapi filters?
> (sub-domain them, different paths etc)
>
> I really appreciate any help you guys can offer, I'm dreading the
> thought of 40 hrs a week of red tape and static typing.


I am in the same boat. The solution that I am working on right now is
to have a VMWare GSX server hosting a properly configured linux server
on a win2k3 box.

Of course even here I have run into an issue by choosing ubuntu server
;-(. It seems that I am stuck with ruby 1.8.3...
Boris (Guest)
on 2006-02-26 17:04
(Received via mailing list)
Simon C. Wex wrote:
>
>
> Cheers, Simon.
> _______________________________________________
> Rails mailing list
> removed_email_address@domain.invalid
> http://lists.rubyonrails.org/mailman/listinfo/rails
Hi Simon,

The fastcgi solution is a bit of a 'thing' to get up and get running.
And I think some mentioned this earlier, it does not perform that well.

I am writing a scgi solution but it is not finished yet (uploads does
not works). Setup is much, much better on windows / IIS and it will work
in subdirectories. If you have .NET experience you can probably get
session sharing or single signon working. I would be happy to share this
with you, but I'm really not sure about performance. I think on Windows
scalability of scgi is limited compared to the fcgi solution. You can
have several fcgi processes running, but you can not have multiple scgi
processes running on windows. (Zed, if you are reading this, am I
correct and if so, is this something you are still investigating?). By
default I think the scgi solution is faster.

For now - in production environments - I guess on windows the best
solutions are using Apache and fcgi. If you do not want this as your
'outbound' server use a reverse proxy in IIS (You could give
isapirewriter a go for this). You could also give Mongrel a go, and
eventually set it up using a reverse proxy. I have not tried Mongrel
yet, so I'm not sure about performace of this webserver. Thing with the
reverse proxies is that unless you write a proxy yourself there are not
that many (none?)  single signon solutions.

/Boris
http://rubyforiis.sosukodo.org/
This topic is locked and can not be replied to.