Ruby on Rails Monday, January 12, 2015



On Monday, January 12, 2015 at 5:44:42 AM UTC, Ruby-Forum.com User wrote:
I am developing Rails application(ruby2.1.5 and rails4.2.0) for embedded
device.I have observed that every time when I run Rails Application,CPU
utilization spikes to 100% for few seconds on startup


That's just the way it is - it's preloading all of your app's code. (the config.eager_load and config.eager_load_paths control this)

Fred
 

My system info is as follows:


   root@wandboard-quad:~/test3# uname -a
    Linux wandboard-quad 3.0.35-4.0.0-wandboard+gd35902c #1 SMP PREEMPT
Wed Aug 6 12:42:22 IST 2014 armv7l GNU/Linux


I have followed following steps:

1. Created new application with following command:

rails new test3

Started rails server

rails server

I have got following cpu utillization on startup


 1569 root      20   0 10392 6960 2472 R     29  0.4   0:00.88 ruby
 **1579 root      20   0 25404  19m 3448 R     97  1.1   0:03.04 ruby
 1579 root      20   0 44416  35m 4196 R    100  1.9   0:06.04 ruby**
 1579 root      20   0 61084  51m 4460 S     76  2.8   0:08.32 ruby
 1579 root      20   0 62148  52m 4516 S      5  2.9   0:08.47 ruby
 1579 root      20   0 62148  52m 4516 S      0  2.9   0:08.48 ruby
 1579 root      20   0 62148  52m 4516 S      0  2.9   0:08.49 ruby
 1579 root      20   0 62148  52m 4516 S      0  2.9   0:08.50 ruby
After digging further using BYEBUG ,I think cpu spikes in
commands_tasks.rb file in method server at following line


require APP_PATH

what might be reason for CPU going high on startup?
I have tried this various webservers like Webbrick,thin,unicorn.

--
Posted via http://www.ruby-forum.com/.

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/cba63f39-5021-4317-a60c-09b16558427d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment