Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: After each boot, slow Java startup, then no problems



Found the problem. At first, I was only viewing "My Processes" in Activity Monitor, which showed nothing weird. Then I realized my mistake and switched it over to "All Processes". I ran 'java -version' and immediately found the problem. A process called 'InterCheck' was consuming over 90% of CPU time. InterCheck is an on-access file scanner that is part of the Sophos Anti-Virus system that is installed on my laptop. I rebooted my system, open Sophos, turned off the on-access scanning feature, and ran 'time java -version'. Here are the results...

lola:~ jstewart$ time java -version
java version "1.5.0_06"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_06-112)
Java HotSpot(TM) Client VM (build 1.5.0_06-64, mixed mode, sharing)

real    0m2.790s
user    0m0.099s
sys     0m0.141s

These are much better times. It makes complete sense that this problem only occurred once per boot. I would assume that the on-access scanner only scans files once per boot (unless they change).

So, thanks for all the tips in tracking this down. Eclipse starts up much quicker this way as well. As I'm writing this, I'm starting up a bunch of apps. THEY ALL START FASTER! (Of course.) I thought that was just how slow they were.

Josh


Greg Guerin wrote:
Jerry wrote:

I'm wondering if it is actually the shared archive building thing which is
happening and something is broken in the code which determines that the
archive needs building. It's supposed to be built once per Java install,
but maybe it's being built once per boot instead. I'd definitely try and
run Shark or Sampler to see if there are any clues in the VM native code
profiling and also run fs_usage to see if the archive is being written to
and not just read from.

Yup, if the disk is being hogged for some reason, then class-loading will be drastically slowed. At this point, the first thing to figure out is where the time is spent. We don't yet know where that is. Once we know where, we can narrow down exactly what, then why.

Activity Monitor shows disk activity and is simple to use.  If it shows
heavy disk activity, then follow up with fs_usage (see 'man fs_usage' and
'man sudo') to narrow down the file.  But if disk activity is normal, then
fs_usage just generates a lot of output that reveals little.


These reported elapsed times are just insane: real 0m59.110s user 0m0.101s sys 0m0.152s

  real    0m45.576s
  user    0m0.205s
  sys     0m0.120s

When I've seen disparities like this before, it usually involves swapping
or other disk-hogging.  Runaway network traffic might also cause this, but
'java -version' does no networking, so I doubt it.  Or is this machine
sharing files?

The posted profile data points a finger at ClassLoader.loadClass(), but
that's all I can see.  Unfortunately, the data doesn't illuminate where the
real time is being spent.  However, a simpler real-time profile might:
  java -Xprof -version

It emits a profile to stdout when the program ends.  Its profile is
measured in ticks, which are real-time sample events (100 ticks/sec, as I
recall).  If the disk is slow, then huge tracts of real time will be spent
in a small number of file-related classes or in loadClass().  If something
else is slow, then time accrues there.

Be sure to watch Disk Activity in Activity Monitor while the command is
running, to get a sense of the overall system behavior.  Context is crucial.


Are there any third-party extensions, kext's, or other additions on this slow machine, or is it a stock standard OS install?

Is this a brand-new machine, which Spotlight might still be doing a
full-scale indexing on?

If it's not brand new, how long has this problem been happening?  The
original post just says "I noticed...".

Double-check that Energy Saver isn't set to a short disk-sleep period.
It's unlikely, but conceivable.

  -- GG


_______________________________________________ Do not post admin requests to the list. They will be ignored. Java-dev mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/java-dev/email@hidden

This email sent to email@hidden
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Java-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/java-dev/email@hidden

This email sent to email@hidden
References: 
 >Re: After each boot, slow Java startup, then no problems (From: Greg Guerin <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.