Is there a thread safe ActiveRecord replacement?
Ezra Zygmuntowicz
ez at engineyard.com
Fri Mar 9 16:13:39 EST 2007
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)
More information about the Merb-devel
mailing list