Somewhat related to the earlier post:
Some time ago another ruby user tried UNSUCCESSFULLY the following code:
FCGI.each do |fcgi|
Thread.new(fcgi) { |f|
f.out.print "Content-type: text/html\r\n\r\n"
f.out.print f.out.type, "<br>\n"
...
}
end
matz replied:
fcgi is not thread-safe. Unlike other IO facilities, it does not try to
avoid IO blocking. I'll make fcgi thread-safe soon (or I hope someone
voluneer to update it).
Is fcgi thread safe now ? Can code like this work with fcgi?
thanks in advance,
George Moschovitis
what will this buy you? fastcgi is process based from apache's point of view
- it's not going to send another request until it gets all the output from the
first one so this approach buys you nothing. in fact, it should slow a
fastcgi process down since it now has the cost of creating a thread for every
request. also, if the load is very high for a particular fcgi program
mod_fastcgi will start another one to manage the load (process pools). in
short, i think this will only complicate matters for no improvement.
regards.
-a
···
On Mon, 15 Aug 2004, George Moschovitis wrote:
Somewhat related to the earlier post:
Some time ago another ruby user tried UNSUCCESSFULLY the following code:
FCGI.each do |fcgi|
Thread.new(fcgi) { |f|
f.out.print "Content-type: text/html\r\n\r\n"
f.out.print f.out.type, "<br>\n"
...
}
end
matz replied:
fcgi is not thread-safe. Unlike other IO facilities, it does not try to
avoid IO blocking. I'll make fcgi thread-safe soon (or I hope someone
voluneer to update it).
Is fcgi thread safe now ? Can code like this work with fcgi?
thanks in advance,
George Moschovitis
--
EMAIL :: Ara [dot] T [dot] Howard [at] noaa [dot] gov
PHONE :: 303.497.6469
A flower falls, even though we love it;
and a weed grows, even though we do not love it. --Dogen
===============================================================================
True that in this particular case threads aren't necessary, but it
would still be nice to know if fcgi is thread-safe for other
purposes, such as that automatic process reloader that you and I were
talking about a while back.
···
On Tue, 17 Aug 2004 03:11:00 +0900, Ara.T.Howard <ahoward@noaa.gov> wrote:
On Mon, 15 Aug 2004, George Moschovitis wrote:
> Somewhat related to the earlier post:
>
> Some time ago another ruby user tried UNSUCCESSFULLY the following code:
>
> FCGI.each do |fcgi|
> Thread.new(fcgi) { |f|
> f.out.print "Content-type: text/html\r\n\r\n"
> f.out.print f.out.type, "<br>\n"
> ...
> }
> end
>
> matz replied:
>
> fcgi is not thread-safe. Unlike other IO facilities, it does not try to
> avoid IO blocking. I'll make fcgi thread-safe soon (or I hope someone
> voluneer to update it).
>
> Is fcgi thread safe now ? Can code like this work with fcgi?
>
> thanks in advance,
>
> George Moschovitis
what will this buy you? fastcgi is process based from apache's point of view
- it's not going to send another request until it gets all the output from the
first one so this approach buys you nothing. in fact, it should slow a
fastcgi process down since it now has the cost of creating a thread for every
request. also, if the load is very high for a particular fcgi program
mod_fastcgi will start another one to manage the load (process pools). in
short, i think this will only complicate matters for no improvement.
regards.
-a
--
> EMAIL :: Ara [dot] T [dot] Howard [at] noaa [dot] gov
> PHONE :: 303.497.6469
> A flower falls, even though we love it;
> and a weed grows, even though we do not love it.
> --Dogen
what will this buy you? fastcgi is process based from apache's point of view
....
short, i think this will only complicate matters for no improvement.
hmm thanks for this info I was not aware of this limitation.
-g.
True that in this particular case threads aren't necessary, but it
would still be nice to know if fcgi is thread-safe for other
purposes, such as that automatic process reloader that you and I were
talking about a while back.
oh yeah - non-output related thread would indeed be nice. although i must add
that even that code is just as easily implemented w/o threads: just check
after each request is handled and exit if the source is updated (or on some
other condition).
in the end, the route i took was to test via a link
page.cgi -> page.fcgi
since this will be loaded everytime, and simply reload the fcgi when i was
satisfied. ended up being just as easy.
you still doing much fcgi work then? i haven't been able to do anything web
related lately... ;-(
-a
Somewhat related to the earlier post:
Some time ago another ruby user tried UNSUCCESSFULLY the following code:
FCGI.each do |fcgi|
Thread.new(fcgi) { |f|
f.out.print "Content-type: text/html\r\n\r\n"
f.out.print f.out.type, "<br>\n"
...
}
end
matz replied:
fcgi is not thread-safe. Unlike other IO facilities, it does not try to
avoid IO blocking. I'll make fcgi thread-safe soon (or I hope someone
voluneer to update it).
Is fcgi thread safe now ? Can code like this work with fcgi?
thanks in advance,
George Moschovitis
what will this buy you? fastcgi is process based from apache's point of view
- it's not going to send another request until it gets all the output from the
first one so this approach buys you nothing. in fact, it should slow a
fastcgi process down since it now has the cost of creating a thread for every
request. also, if the load is very high for a particular fcgi program
mod_fastcgi will start another one to manage the load (process pools). in
short, i think this will only complicate matters for no improvement.
regards.
-a
--
> EMAIL :: Ara [dot] T [dot] Howard [at] noaa [dot] gov
> PHONE :: 303.497.6469
> A flower falls, even though we love it;
> and a weed grows, even though we do not love it.
> --Dogen
-a
···
On Tue, 17 Aug 2004, Carl Youngblood wrote:
On Tue, 17 Aug 2004 03:11:00 +0900, Ara.T.Howard <ahoward@noaa.gov> wrote:
On Mon, 15 Aug 2004, George Moschovitis wrote:
--
EMAIL :: Ara [dot] T [dot] Howard [at] noaa [dot] gov
PHONE :: 303.497.6469
A flower falls, even though we love it;
and a weed grows, even though we do not love it. --Dogen
===============================================================================
WRT io i don't think it acutally ends up being much of a limitation:
[ahoward@www ahoward]$ ab -n1024 http://127.0.0.1/env.fcgi|grep Requests
Requests per second: 221.96 [#/sec] (mean)
however - not being able to do something other than produce io in a thread
could be viewed as a limitation.
regards.
-a
···
On Sun, 22 Aug 2004, George Moschovitis wrote:
what will this buy you? fastcgi is process based from apache's point of view
...
short, i think this will only complicate matters for no improvement.
hmm thanks for this info I was not aware of this limitation.
--
EMAIL :: Ara [dot] T [dot] Howard [at] noaa [dot] gov
PHONE :: 303.497.6469
A flower falls, even though we love it;
and a weed grows, even though we do not love it. --Dogen
===============================================================================