Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Ruby processes on OSX keep going above 90%. What's up?

I have a handful of Ruby/Rails apps I'm building locally. I've noticed lately that no matter which app I'm working on, my Ruby process will build up to 90+%, the CPU fan will kick on, and there's no stopping it unless I kill the sucker. Doesn't seem to matter which app I'm working on. Any ideas? Any way to track what's wrong?

I've run the apps on Mongrel, Apache/Passenger, and POW, and every time I get the same result.

And BTW I don't have any jobs or tasks running constantly. This CPU hogging is happening without the servers being hit.

My system:

Ruby: ruby 1.8.7 (2009-06-12 patchlevel 174) [universal-darwin10.0]
Rails: Rails 3.0.4
OSX 10.6.7, MBP 2.53 GHz Core 2 Duo
like image 795
Jason Lynes Avatar asked Oct 28 '25 04:10

Jason Lynes


1 Answers

Have you tried opening a terminal window and running top, or opening Activity Monitor, then running each one individually and seeing when your CPU starts to climb? Both top and Activity Monitor will let you sort by the CPU load an app is generating. Use top -o cpu and watch to see if the highest load is the app you ran or maybe something else the app is causing to run.

A Rails app will spike when it starts up but should settle down as it waits for incoming connections. If you have periodic tasks it's performing you should see those cause the CPU activity to spike again then drop when the task ends.

You're on a MacBook Pro. How much RAM do you have? Maybe your apps are running low and having to swap out too much? That would affect your overall system performance making the CPU work harder, causing it to heat up. A MacBook Pro's hard disk is designed for battery efficiency, not high performance, so if you're hitting the disk hard with a lot of database I/O, you could be heating the machine up and causing the apps to wait due to record locking or some sort of contention.

There's a lot of different things that can cause your machine and apps to slow down, and you haven't really given us a lot to work with, so those are some general ideas of what I'd look into.

like image 77
the Tin Man Avatar answered Oct 30 '25 22:10

the Tin Man



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!