Hi Ken, could you think in some concrete example of what you consider a
common non-thread-safe code to justify not enabling it by default?
I guess most people, with background in other frameworks and languages,
will indeed expect their web application to be multi-thread.
It was actually a surprise for me when I first realized Rails wasn't
multi-thread the first time I used, when it didn't support the threaded
model yet.
So, maybe Rails still doesn't enable multi-thread by default for
historical reasons, like MRI Ruby 1.8 poor performance in threaded
environments due to a lack of support of system threads (only green
threads supported) and the lack of support of Rails itself in its first
versions.
But JRuby has always support great concurrency and now that MRI 1.9 has
better thread support too, maybe the only reason for not enabling the
"config.threadsafe!" under production by default is just a historical
consequence.
Actually, I've seen some people working to make "autoload" thread-safe
in MRI so that it could also be enabled for development mode after a
while...
Maybe Rails 3.1 would provide a great opportunity to change this default.
Em 12-08-2011 09:44, Ken Collins escreveu:
I think it is off by default implicitly in all environments and the line in
production.rb is a hint to turn it on. IIRC, it hints or warns that you would
have to write thread-safe code to begin with and to use this carefully. Since
most people do not write thread-safe code and doing so is the exception vs the
rule, then this setting makes sense to most I have talked to. My opinion.
- Ken
On Aug 12, 2011, at 8:40 AM, Rodrigo Rosenfeld Rosas wrote:
One of the things I love in Rails are the good defaults. Now that jQuery is the
default Javascript framework it got even better! :D Maybe sometime Rspec will
get there too ;) (Just kidding - although I prefer Rspec, I don't want to start
this discussion)
But one thing that has always bothered me is why config.threadsafe! is disabled
by default in production.rb.
This seems really odd to me.
Could someone explain me the reasons behind this decision?
Or, is it time for changing this default?
Best regards,
Rodrigo.
--
You received this message because you are subscribed to the Google Groups "Ruby on
Rails: Core" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/rubyonrails-core?hl=en.