Forum: Ruby on Rails RoR and Threads...

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.
Pete Palmer (Guest)
on 2006-04-07 00:14
Hi,

Anyone who has seen my posts so far will know straight away that I'm new
to Ruby. The kind help and advice I've received here has been invaluable
to me and is greatly appreciated! I wish all programming communities
were this friendly! :)

Anyway, on to the question...

I started off on PHP which didn't require any real multi-threading
techniques - at least for me - and was more to do with making sure two
people didn't update the same bit of the database...

I moved to Java which was a whole different ball game - threads and
related issues abounded...

But now that I'm working with RoR - I'm wondering how exactly threading
works in this environment. I want to use a couple of Mongrels as the
backend - and I'm writing the software as per the "Aguile" book.

Basically, am I likely to get tripped up by any thread related issues?
One of the applications I'm porting does a lot of HTTP requests - and
the threading on that (this was in Java) was pretty fiddly - and I want
to make sure I'm doing it right in Ruby if I am going to port a live
application to it :)

Any help or advice would be greatly appreciated as always!


Cheers,


Pete
Berin L. (Guest)
on 2006-04-07 00:54
(Received via mailing list)
Pete Palmer wrote:
<snip/>
>
<snip/>

 From one fellow Java developer to another, with RoR you don't worry
about threads--much the same way as with PHP.  You let the environment
handle those details.

Ruby does have "psuedo threading" similar to Java's "green threads" from
the past, but Ruby or Java I would have to wonder if there is something
that can be done differently to avoid the threading issue all together.
Without much info on your project, this is about as much guidance as I
can give you.
Pete Palmer (Guest)
on 2006-04-07 01:13
Hi,

Well users can use a page on my server to request and display a page on
another server. On Java I used the apache httpclient library to do it.
In theory hundreds of people could be requesting hundreds of different
pages at the same time.

I just wanted to be sure that if I use the http library in Ruby and
"pretended" that threading didn't exist, my application wouldn't end up
in a big heap in the corner :)
Ben M. (Guest)
on 2006-04-07 08:03
(Received via mailing list)
Ruby has threads but rails is single-threaded. Rather than using a
thread to handle each
request, you run multiple instances of your app behind a fastcgi pipe to
a web server.
This also means that their is no "application context" as in Java.

b
This topic is locked and can not be replied to.