I''m using merb as an application server backend for a client application, the goal is to be able to handle thousands of parallell sessions (not parallell requests). It will use sendfile to send files. The controller uses an singleton that saves sessions in a hash that is memory resident cross requests, but isn''t persistent otherwise. I''m using ActiveRecord since there is an Rails site used to administer the whole thing, and I thought it would be nice to share the models. Since ActiveRecord is mutexed this not only scales bad (or atleast the scaling point is not where I''d like it), but if something murphy-like is happening on the database server (or in between), the whole server is hung which is "not ideal". So: is there a (lightweight) ActiveRecord replacement that I can use instead? I''m not sure yet if I really need the belongs_to style relational mappings yet, but I would consider that a big plus. It doesn''t need to be compatible with ActiveRecord, but I can''t rename the tables or modify the table definitions since the Rails app will break. Any ideas? Regards, Magnus P.S.: I love merb so far, I only wish it existed when the original Rails site was created :)
On Mar 7, 2007, at 12:43 PM, Magnus Naeslund wrote:> I''m using merb as an application server backend for a client > application, the goal is to be able to handle thousands of > parallell sessions (not parallell requests). It will use sendfile > to send files. > The controller uses an singleton that saves sessions in a hash that > is memory resident cross requests, but isn''t persistent otherwise. > > I''m using ActiveRecord since there is an Rails site used to > administer the whole thing, and I thought it would be nice to share > the models. > Since ActiveRecord is mutexed this not only scales bad (or atleast > the scaling point is not where I''d like it), but if something > murphy-like is happening on the database server (or in between), > the whole server is hung which is "not ideal". > > So: is there a (lightweight) ActiveRecord replacement that I can > use instead? > I''m not sure yet if I really need the belongs_to style relational > mappings yet, but I would consider that a big plus. > It doesn''t need to be compatible with ActiveRecord, but I can''t > rename the tables or modify the table definitions since the Rails > app will break. > > Any ideas? > > Regards, > Magnus > > P.S.: I love merb so far, I only wish it existed when the original > Rails site was created :) >There aren''t any lightweight ORM''s that i know of that would work better here. I have been using the Mysql library directly with a small wrapper and it works much better then AR when you need high concurrency. As far as using send_file thats good but realize that mongrel is serving those files still. You would be better off with nginx up front and using nginx''s X-Accell_redirect feture . With this way all you woudl do in your merb action is use nginx_send_file. This just sets the header to the path to the file to be server and nginx serves the file fast instead of mongrel doing it. Cheers- -- Ezra Zygmuntowicz -- Lead Rails Evangelist -- ez at engineyard.com -- Engine Yard, Serious Rails Hosting -- (866) 518-YARD (9273)
Ezra Zygmuntowicz wrote:> > There aren''t any lightweight ORM''s that i know of that would work > better here. I have been using the Mysql library directly with a > small wrapper and it works much better then AR when you need high > concurrency. >Yes I''m thinking this is the way to go unless there pops up a framework that I can use before I get around to it. In the meantime, how about turning off locking around AR? I''ve seen you say that this won''t get me any performance gain, but I don''t care about that in this context, I''m just worried that one request going bad will lock up the whole app.> As far as using send_file thats good but realize that mongrel is > serving those files still. You would be better off with nginx up > front and using nginx''s X-Accell_redirect feture . With this way all > you woudl do in your merb action is use nginx_send_file. This just > sets the header to the path to the file to be server and nginx serves > the file fast instead of mongrel doing it. >I thought that you just passed it on to mongrel, and it immediately issued a sendfile() system call. But you''re saying it''s just a verb and mongrel will do something not-so-fast? Small thing: why don''t I get replies on my mails through the list, is there some setting for this? It''s no biggie, but I''m used to getting both the direct mail and also via the mailinglist... Regards, Magnus
On Mar 9, 2007, at 5:01 PM, Magnus Naeslund wrote:> Ezra Zygmuntowicz wrote: >> >> There aren''t any lightweight ORM''s that i know of that would work >> better here. I have been using the Mysql library directly with a >> small wrapper and it works much better then AR when you need high >> concurrency. >> > > Yes I''m thinking this is the way to go unless there pops up a > framework that I can use before I get around to it. > In the meantime, how about turning off locking around AR? > I''ve seen you say that this won''t get me any performance gain, but > I don''t care about that in this context, I''m just worried that one > request going bad will lock up the whole app. > >> As far as using send_file thats good but realize that mongrel is >> serving those files still. You would be better off with nginx up >> front and using nginx''s X-Accell_redirect feture . With this way all >> you woudl do in your merb action is use nginx_send_file. This just >> sets the header to the path to the file to be server and nginx serves >> the file fast instead of mongrel doing it. >> > > I thought that you just passed it on to mongrel, and it immediately > issued a sendfile() system call. > But you''re saying it''s just a verb and mongrel will do something > not-so-fast? > > Small thing: why don''t I get replies on my mails through the list, > is there some setting for this? > It''s no biggie, but I''m used to getting both the direct mail and > also via the mailinglist... > > Regards, > MagnusMagnus- Ok so I just made the mutex lock a configration option so you can turn it on or off as needed. http://merb.devjavu.com/projects/merb/changeset/198 The mutex will lock by default for the shortest amount of time possible where you could make ActiveRecord calls. If you aren''t using AR then you can turn it off by doing this in your merb.yml: :use_mutex: false or you can do it with the merb command line tool $ merb --mutex off $ merb --mutex on Cheers- -- Ezra Zygmuntowicz -- Lead Rails Evangelist -- ez at engineyard.com -- Engine Yard, Serious Rails Hosting -- (866) 518-YARD (9273)