This is actually a combination of expensive mtime and an errant GC.start in
the reloading thread that happens on every iteration. On MRI, GC.start is
innocuous, but in JRuby it's expensive as hell.
The reason that Rails doesn't use CPU is that it reloads all files on every
request, so it doesn't need to watch for changes. This is so expensive that
a plugin called dev_mode_performance exists for Rails that changes Rails'
behavior so that it *does* poll.

We'll be removing the errant GC.start in 1.0.4 (to be released Monday) and
then we can take another look at how to speed up the devmode thread.

-- Yehuda

On Thu, Dec 4, 2008 at 1:52 PM, Mark Watson <[EMAIL PROTECTED]> wrote:

>
> Hello Charles,
>
> I sometimes forget to run merb with "-e production" when I don't need
> polling for file updates - causes a huge increase in CPU utilization.
> As someone else mentioned, this occurs for C-Ruby and JRuby.
>
> -Mark
>
> On Dec 4, 1:49 pm, Charles Oliver Nutter <[EMAIL PROTECTED]>
> wrote:
> > If it's dev mode it could be merb polling for file updates. I think
> > Yehuda mentioned he saw that taking more CPU in JRuby than in MRI,
> > likely due to JDK's rather slow file-information APIs. I think he was
> > looking into using FFI for notification. Does the same thing happen in
> > production?
> >
> > On Dec 4, 2:33 pm, "Vivek Pandey" <[EMAIL PROTECTED]> wrote:
> >
> > > I was trying out a simple merb app using jruby on Glassfish gem and see
> that
> > > the CPU consumption is anywhere between 25-30% in idle condition. It
> does
> > > not look like specific to glassfish alone as I see the exact CPU
> consumption
> > > on Mongrel. Does anyone experience the same thing? I have merb-core,
> > > merb-more, merb-activerecord among many other gems. The app is running
> on
> > > Rails 2.2.2 and jruby 1.1.6RC1.
> >
> > > The thread dump for mongrel[1] and glassfish[2] shows that something is
> > > polling the sockets. Any one with better clues? Anyone notices same
> problem
> > > on MRI?
> >
> > > [1]http://pastie.org/331185
> > > [2]http://pastie.org/331229
> >
> > > *** LOCAL GEMS ***
> >
> > > abstract (1.0.0)
> > > actionmailer (2.2.2)
> > > actionpack (2.2.2)
> > > activerecord (2.2.2)
> > > activerecord-jdbc-adapter (0.9)
> > > activerecord-jdbcmysql-adapter (0.9)
> > > activerecord-jdbcsqlite3-adapter (0.9)
> > > activeresource (2.2.2)
> > > activesupport (2.2.2)
> > > addressable (2.0.1)
> > > data_objects (0.9.9)
> > > diff-lcs (1.1.2)
> > > dm-core (0.9.7)
> > > dm-migrations (0.9.7)
> > > erubis (2.6.2)
> > > extlib (0.9.8)
> > > fastercsv (1.4.0)
> > > gem_plugin (0.2.3)
> > > glassfish (0.9.1)
> > > haml (2.0.5)
> > > highline (1.5.0)
> > > jdbc-mysql (5.0.4)
> > > jdbc-sqlite3 (3.5.8)
> > > json_pure (1.1.3)
> > > mailfactory (1.4.0)
> > > merb-action-args (1.0.3)
> > > merb-assets (1.0.3)
> > > merb-auth (1.0.3)
> > > merb-auth-core (1.0.3)
> > > merb-auth-more (1.0.3)
> > > merb-auth-slice-password (1.0.3)
> > > merb-cache (1.0.3)
> > > merb-core (1.0.3)
> > > merb-exceptions (1.0.3)
> > > merb-gen (1.0.3)
> > > merb-haml (1.0.3)
> > > merb-helpers (1.0.3)
> > > merb-mailer (1.0.3)
> > > merb-more (1.0.3)
> > > merb-param-protection (1.0.3)
> > > merb-slices (1.0.3)
> > > merb_activerecord (0.9.13)
> > > merb_datamapper (1.0.3)
> > > mime-types (1.15)
> > > mongrel (1.1.5)
> > > ParseTree (3.0.2)
> > > rack (0.4.0)
> > > rails (2.2.2)
> > > rake (0.8.3)
> > > RedCloth (4.1.1)
> > > rspec (1.1.11)
> > > ruby2ruby (1.2.1)
> > > RubyInline (3.8.1)
> > > sexp_processor (3.0.0)
> > > sources (0.0.1)
> > > templater (0.5.0)
> > > thor (0.9.8)
> > > ZenTest (3.11.0)
> >
> > >  -vivek.
> >
>


-- 
Yehuda Katz
Developer | Engine Yard
(ph) 718.877.1325

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"merb" 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/merb?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to