Hey Everybody! I was wondering if/how Camping can process more than one request at once (i.e. not what Rails does). I''m fairly new to threads, and I bought a book, and read some of it, and dived into the Camping source... I found some thread stuff but I''m not... entirely sure. So I thought I would ask! RYan. http://yeahnah.org/
On Thu May 10, 2007 at 02:22:39PM +1000, Ryan Allen wrote:> Hey Everybody! > > I was wondering if/how Camping can process more than one request at > once (i.e. not what Rails does). I''m fairly new to threads, and I > bought a book, and read some of it, and dived into the Camping source... > > I found some thread stuff but I''m not... entirely sure. So I thought > I would ask!recent discussion on IRC suggests one technique is to use mongrel for its HTTP parsing, responding to requests in the EventMachine loop. so far i think only IOWA has been hooked up this way.. ive asked what it would take to make normal plain old camping respond tom ore than one request at a time, and havent gotten a response - i guess i''ll have to figure it out myself - but i probably never will, since the ruby VM keeps segfaulting and theres a lot more work in the cometd / simultaneous http model going on in Lua and Erlang so i can kill 2 birds with one stone...> > RYan. > http://yeahnah.org/ > _______________________________________________ > Camping-list mailing list > Camping-list at rubyforge.org > http://rubyforge.org/mailman/listinfo/camping-list >
Evented mongrel probably would help. I have a prerelease kicking around I think, but the real one should drop soon: http://swiftiply.swiftcore.org/mongrel.html We should read about the IOReactor pattern. I think the deal right now is that ActiveRecord isn''t really 100% threadsafe, despite the Base::allow_concurrency flag. I don''t know how Camping''s routes would respond in a threaded environment. If you want a quick solution, just run multiple mongrel processes. RV can do this with some minor hacking of PID file locations: http://blog.evanweaver.com/articles/2006/12/19/rv-a-tool-for-luxurious-camping Evan On 5/10/07, carmen <_ at whats-your.name> wrote:> On Thu May 10, 2007 at 02:22:39PM +1000, Ryan Allen wrote: > > Hey Everybody! > > > > I was wondering if/how Camping can process more than one request at > > once (i.e. not what Rails does). I''m fairly new to threads, and I > > bought a book, and read some of it, and dived into the Camping source... > > > > I found some thread stuff but I''m not... entirely sure. So I thought > > I would ask! > > recent discussion on IRC suggests one technique is to use mongrel for its HTTP parsing, responding to requests in the EventMachine loop. so far i think only IOWA has been hooked up this way.. > > ive asked what it would take to make normal plain old camping respond tom ore than one request at a time, and havent gotten a response - i guess i''ll have to figure it out myself - but i probably never will, since the ruby VM keeps segfaulting and theres a lot more work in the cometd / simultaneous http model going on in Lua and Erlang so i can kill 2 birds with one stone... > > > > > RYan. > > http://yeahnah.org/ > > _______________________________________________ > > Camping-list mailing list > > Camping-list at rubyforge.org > > http://rubyforge.org/mailman/listinfo/camping-list > > > _______________________________________________ > Camping-list mailing list > Camping-list at rubyforge.org > http://rubyforge.org/mailman/listinfo/camping-list >-- Evan Weaver Cloudburst, LLC
2007/5/10, Ryan Allen <ryan at yeahnah.org>:> Hey Everybody! > > I was wondering if/how Camping can process more than one request at > once (i.e. not what Rails does). I''m fairly new to threads, and I > bought a book, and read some of it, and dived into the Camping source... > > I found some thread stuff but I''m not... entirely sure. So I thought > I would ask!Hi, Camping is green-thread-safe on the requests. At every requests, YourApp.run is called and an instance of your routed controller is created. You just need a web server that allows concurrency, like mongrel. Just don''t use ActiveRecord for your data backend because I don''t believe it''s green-thread-safe. -- Cheers, zimbatm