Spork startup 2+ minutes

7 views
Skip to first unread message

ericindc

unread,
Apr 7, 2010, 1:14:50 PM4/7/10
to sporkgem
I am experiencing 2+ minute startup times for spork cucumber and spork
rspec. Once the spork instances are running, it still takes at least
a minute to start running tests/features. I just performed a fresh
install of Snow Leopard (10.6.3), rvm, and the latest gems.

I recall previously having to hardcode the port number in one of the
system files, but I believe what was requiring that was fixed some
time ago. I'll provide a pastie link to the output of my diagnostic
output below, which looks problematic, but I'm not sure what the
problem is or how to fix it.

Anyone have ideas? Thanks.

** Spork -d output **
http://pastie.org/907842

Tim Harper

unread,
Apr 7, 2010, 1:18:00 PM4/7/10
to spor...@googlegroups.com
This would definitely be a job of ruby-prof. Run that (I like the graph output format best, but I don't know why it's called "graph")

Tim


--
You received this message because you are subscribed to the Google Groups "sporkgem" group.
To post to this group, send email to spor...@googlegroups.com.
To unsubscribe from this group, send email to sporkgem+u...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/sporkgem?hl=en.


ericindc

unread,
Apr 7, 2010, 5:06:23 PM4/7/10
to sporkgem
I'm not sure if I ran this correctly but here is the output. I'll
have to look at it in a bit, but it looks like a bunch of missing
gems. I wonder if this has anything to do with RVM and using
gemsets. Thanks.

http://pastie.org/908275

> > sporkgem+u...@googlegroups.com<sporkgem%2Bunsubscribe@googlegroups.c om>

Tim Harper

unread,
Apr 7, 2010, 5:20:24 PM4/7/10
to spor...@googlegroups.com


On Wed, Apr 7, 2010 at 3:06 PM, ericindc <ericm...@gmail.com> wrote:
I'm not sure if I ran this correctly but here is the output.  I'll
have to look at it in a bit, but it looks like a bunch of missing
gems.  I wonder if this has anything to do with RVM and using
gemsets.  Thanks.

http://pastie.org/908275
                                                                                                              
Ummm, yeah :) So I take it you've never run ruby-prof before.  Since your using rvm, you may want to force it to switch to the gem environment to make sure that when you install ruby-prof, it's installed in the same gem environment that your project gems are installed in.

Then, invoke ruby-prof like so:

ruby_prof -p graph -f profile.txt `which spork` -- rspec

After the server starts up (hopefully, successfully), quit the server by pressing "control-c" once. If you press it to many times, it will abort the output phase of the profiling (while it's writing the file).

Once that's done, you should have a pretty big file called profile.text. That's going to contain the information necessary to find out what took so long.

It's worth noting that when you run Ruby code under the profiler, it usually takes about three times as long.

Good luck!

ericindc

unread,
Apr 7, 2010, 11:40:08 PM4/7/10
to sporkgem
Good guess. :-)

I ran ruby-prof and after several attempts of hitting ctrl + c once
was unable to get it to kill just spork and to write the file.
Thankfully, an exception was thrown on one attempt due to an existing
spork instance running and that provided the desired output file.
That said, the server never fully started, though i think the bulk of
the slowness happens prior to that point.

Here is a link to the output (http://dl.dropbox.com/u/1788885/
profile2.txt). I skimmed over the numbers and as far as I can tell
nothing looks to stand out too much. Does anything jump out at you?
I appreciate the help.

Thanks,
Eric

On Apr 7, 5:20 pm, Tim Harper <timchar...@gmail.com> wrote:

Tim Harper

unread,
Apr 8, 2010, 12:31:36 AM4/8/10
to spor...@googlegroups.com
On Wed, Apr 7, 2010 at 9:40 PM, ericindc <ericm...@gmail.com> wrote:
Good guess.  :-)

I ran ruby-prof and after several attempts of hitting ctrl + c once
was unable to get it to kill just spork and to write the file.
Thankfully, an exception was thrown on one attempt due to an existing
spork instance running and that provided the desired output file.
That said, the server never fully started, though i think the bulk of
the slowness happens prior to that point.

Here is a link to the output (http://dl.dropbox.com/u/1788885/
profile2.txt).  I skimmed over the numbers and as far as I can tell
nothing looks to stand out too much.  Does anything jump out at you?
I appreciate the help.

Thanks,
Eric


did you wait until the server was completely loaded before pressing control + C? From the looks of this output, it doesn't seem like the server finished loading.
Tim 

ericindc

unread,
Apr 8, 2010, 1:14:41 AM4/8/10
to sporkgem
Right, the server never loaded in the example I posted because an
exception was raised prior due to an instance of spork already
running. As for having waited the other times, yes the server was
up...I saw the standard text output displayed when the server is up
and I begin with autospec.

On Apr 8, 12:31 am, Tim Harper <timchar...@gmail.com> wrote:

Tim Harper

unread,
Apr 8, 2010, 1:44:04 AM4/8/10
to spor...@googlegroups.com
On Wed, Apr 7, 2010 at 11:14 PM, ericindc <ericm...@gmail.com> wrote:
Right, the server never loaded in the example I posted because an
exception was raised prior due to an instance of spork already
running.  As for having waited the other times, yes the server was
up...I saw the standard text output displayed when the server is up
and I begin with autospec.

OK, well in order to profile it successfully it must boot completely. Can you do it again, this time quitting the other instance of Spork? 

Tim

ericindc

unread,
Apr 8, 2010, 2:02:03 AM4/8/10
to sporkgem
That's the problem...I'm able to start the spork server successfully
with ruby-prof, but hitting ctrl + c just once seems to kill the whole
process before the profile.txt file is written. I've tried it several
times and always the same result.

On Apr 8, 1:44 am, Tim Harper <timchar...@gmail.com> wrote:

ericindc

unread,
Apr 8, 2010, 12:20:44 PM4/8/10
to sporkgem
Alright, this probably shouldn't be difficult...but I still hit ctrl +
c just once and get no profile.txt file. Is there another way to quit
just spork?

ericindc

unread,
Apr 9, 2010, 12:57:32 PM4/9/10
to sporkgem
Here is exactly what I see. Unfortunately still no profile.txt file
on the desktop.

$ ruby-prof -p graph -f ~/Desktop/profile.txt `which spork` -- rspec
Using RSpec
Preloading Rails environment
Loading Spork.prefork block...
/Users/Eric/.rvm/gems/ruby-1.8.7-p249@33n/gems/rails-2.3.5/lib/rails/
gem_dependency.rb:119:Warning: Gem::Dependency#version_requirements is
deprecated and will be removed on or after August 2010. Use
#requirement
No server is running
Running specs locally:
Spork is ready and listening on 8989!
^C

Reply all
Reply to author
Forward
0 new messages