Java-Gaming.org    
Featured games (79)
games approved by the League of Dukes
Games in Showcase (475)
Games in Android Showcase (106)
games submitted by our members
Games in WIP (530)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
    Home     Help   Search   Login   Register   
Pages: [1]
  ignore  |  Print  
  The Most Awesomely Useful GC Tuning Tool Ever  (Read 3047 times)
0 Members and 1 Guest are viewing this topic.
Online princec

JGO Kernel


Medals: 339
Projects: 3
Exp: 16 years


Eh? Who? What? ... Me?


« Posted 2003-10-30 13:01:26 »

You too can tune your Java applications' GC performance to total perfection! How can you do this?

Using jvmstat, the most useful GC tool ever!

It displays graphically the amount of memory the eden, two survivor spaces, and tenured generations are using; and when compile and GC blips occur. You simply run your Java game, get the task manager up to find its process ID, and then from the command prompt type visualgc <pid> and Bob's your uncle.

By watching the graphs whilst playing Alien Flux I've discovered to my delight that the only memory allocations going on during the game were in eden space, slowly, and that during the normal course of the game none of the objects survived to the survivor or tenured generation. So I set my eden space to be super small (500K) and hence collected much, much more frequently. I also picked an appropriate collector from the 4 now available to use on my dualie 1GHz dev box and ended up with this neat-o set of parameters for running AF:
1  
-server -XX:CompileThreshold=200 -XX:MaxInlineSize=16 -Xmx32m -Xms32m -XX:+UseConcMarkSweepGC -XX:+UseParNewGC -XX:NewSize=500K -XX:MaxNewSize=500K -XX:+DisableExplicitGC -Djava.library.path=.

I'd be especially interested if anyone could test this config. on a slower box (300-600MHz) to tell me if it's unnacceptably slow starting up (>20secs).



Cas Smiley

Offline swpalmer

JGO Coder




Where's the Kaboom?


« Reply #1 - Posted 2003-10-30 16:03:27 »

Yeah I've been playing with that too.. (I mentioned it here a couple weeks ago - didn't get any comments Sad )

It is pretty darn sweet.

Offline swpalmer

JGO Coder




Where's the Kaboom?


« Reply #2 - Posted 2003-10-30 16:05:27 »

Aren't -XX:+UseConcMarkSweepGC and -XX:+UseParNewGC mutually exclusive?Huh?

Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Online princec

JGO Kernel


Medals: 339
Projects: 3
Exp: 16 years


Eh? Who? What? ... Me?


« Reply #3 - Posted 2003-10-30 16:46:39 »

I pasted those two options directly out of the Hotspot GC tuning guide, where they appear together.

Cas Smiley

Offline swpalmer

JGO Coder




Where's the Kaboom?


« Reply #4 - Posted 2003-10-30 18:46:28 »

Well there you go.. I've probably been using the parallel thing wrong all along... Roll Eyes
I'm glad someone read the manual  Grin

Offline swpalmer

JGO Coder




Where's the Kaboom?


« Reply #5 - Posted 2003-11-07 17:09:56 »

Ah I just discovered my confusion about those GC options...  There is an older option -XX:+UseParallelGC  and it DOES conflict with -XX:+UseConcMarkSweepGC

Offline swpalmer

JGO Coder




Where's the Kaboom?


« Reply #6 - Posted 2004-01-18 23:31:00 »

Gregory and others that were following the GC issues thread.
This thread is about jvmstat a tool available from Sun that graphs all sorts of nice stats in realtime pertaining to GC and other stuff. (e.g. JIT compiling)

Offline gregorypierce

Senior Member




I come upon thee like the blue screen of death....


« Reply #7 - Posted 2004-01-18 23:56:37 »

I was looking at this before but wasn't able to get this to run on OSX (JDK1.4.1). Since it looks like its supposed to work, I will try running it again and report issues to the Apple java team.

http://www.gregorypierce.com

She builds, she builds oh man
When she links, she links I go crazy
Cause she looks like good code but she's really a hack
I think I'll run upstairs and grab a snack!
Offline swpalmer

JGO Coder




Where's the Kaboom?


« Reply #8 - Posted 2004-01-19 01:02:48 »

Yeah, actually I realize now that I only used it on Windows.

Also keep in mind that version 2.0 of jvmstat requires Java 1.4.2

Like you say it looks like it should work.  It is Java and appears to use RMI or something.

On Mac I have trouble getting it to link up with my Java process. "Could not find expected counter"

Offline Sanxion

Junior Member




Java games rock!


« Reply #9 - Posted 2004-01-22 14:10:15 »

I installed it. It looks very cool with all these dials, bars and stuff, but what do they all mean? I couldn't find any extensive documentation. I got no clue what eden is. Where do I start to learn to decipher all of this.

In short:
a) What is it trying to tell me?
b) What should I do about it?
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Online princec

JGO Kernel


Medals: 339
Projects: 3
Exp: 16 years


Eh? Who? What? ... Me?


« Reply #10 - Posted 2004-01-22 14:24:59 »

What you're trying to achieve is a jitter-free frame rate for the vast majority of your game, with no regular or long pauses.

To achieve this you need to understand how the garbage collectors work in Java:
http://java.sun.com/docs/hotspot/gc1.4.2/index.html

Armed with knowledge of how memory is allocated and deallocated in Java, you can then use this tool to see the pattern of memory allocation in your game. You can watch for example eden filling up every 60 frames graphically, which is really quite handy. It's then a matter of tweaking the GC tuning parameters outlined in that document until the pauses you get during normal running of your game fit into a frame or only occur when it doesn't matter.

Cas Smiley

Offline Azeem Jiva

Junior Member




Java VM Engineer, Sun Microsystems


« Reply #11 - Posted 2004-07-14 22:02:49 »

One recommendation, dump the -XX:CompileThreshold=200, you are causing way more compilations then are required.  This will cause less profile data to be collected, and subsequently worse performance.  -XX:MaxInlineSize=16 is also suspect, dump it.
Offline dranonymous

Junior Member




Hoping to become a Java Titan someday!


« Reply #12 - Posted 2004-07-15 04:33:17 »

I tried to get jvmstat to run, but had no luck.  Nutters!

I can run jvmstat -gcutil 0 1000 3, from the docs, but running jvmps gives nothing.  Is there some other way to get the process id I need?

I'm using eclipse to start my app, but I also tried double clicking the jar.  jvmps never showed anything.

I'm in windows XP.

Help!   Huh

Regards,
Aaron R>
Offline swpalmer

JGO Coder




Where's the Kaboom?


« Reply #13 - Posted 2004-07-15 05:22:39 »

Get the process id on Windows with the Windows Task Mananger.  Look at the "Processes" tab and in the "View" menu choose "Select Columns..." and check off  "PID (Process Identifier)"

Online princec

JGO Kernel


Medals: 339
Projects: 3
Exp: 16 years


Eh? Who? What? ... Me?


« Reply #14 - Posted 2004-07-15 09:32:57 »

ajiva - could you divulge the default value of MaxInlineSize? (& FreqInlineSize)?

Cas Smiley

Offline Azeem Jiva

Junior Member




Java VM Engineer, Sun Microsystems


« Reply #15 - Posted 2004-07-15 15:52:57 »

The best way is to download the 1.4.2 source code, but here are the answers anyway:

FreqInlineSize=325    (This is X86 specific)
MaxInlineSize = 35
Online princec

JGO Kernel


Medals: 339
Projects: 3
Exp: 16 years


Eh? Who? What? ... Me?


« Reply #16 - Posted 2004-07-15 18:44:33 »

Thanks, that's interesting to know.

Cas Smiley

Pages: [1]
  ignore  |  Print  
 
 
You cannot reply to this message, because it is very, very old.

 

Add your game by posting it in the WIP section,
or publish it in Showcase.

The first screenshot will be displayed as a thumbnail.

ctomni231 (37 views)
2014-07-18 06:55:21

Zero Volt (35 views)
2014-07-17 23:47:54

danieldean (28 views)
2014-07-17 23:41:23

MustardPeter (31 views)
2014-07-16 23:30:00

Cero (46 views)
2014-07-16 00:42:17

Riven (47 views)
2014-07-14 18:02:53

OpenGLShaders (36 views)
2014-07-14 16:23:47

Riven (36 views)
2014-07-14 11:51:35

quew8 (32 views)
2014-07-13 13:57:52

SHC (69 views)
2014-07-12 17:50:04
HotSpot Options
by dleskov
2014-07-08 03:59:08

Java and Game Development Tutorials
by SwordsMiner
2014-06-14 00:58:24

Java and Game Development Tutorials
by SwordsMiner
2014-06-14 00:47:22

How do I start Java Game Development?
by ra4king
2014-05-17 11:13:37

HotSpot Options
by Roquen
2014-05-15 09:59:54

HotSpot Options
by Roquen
2014-05-06 15:03:10

Escape Analysis
by Roquen
2014-04-29 22:16:43

Experimental Toys
by Roquen
2014-04-28 13:24:22
java-gaming.org is not responsible for the content posted by its members, including references to external websites, and other references that may or may not have a relation with our primarily gaming and game production oriented community. inquiries and complaints can be sent via email to the info‑account of the company managing the website of java‑gaming.org
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines | Managed by Enhanced Four Valid XHTML 1.0! Valid CSS!