PDA

View Full Version : 5 things you can do to improve server performance



Canownueasy`
June 27th, 2010, 08:00
1) Use the server VM tag
Using this tag takes the maximum heap size for a node, and uses it for the process. Note that this can use up to 3x more system resources.

-server

2) Maximize garbage collection (best suited at rate 146ms)
Why not have the fastest and most reliable garbage collection rate? Set your server's garbage collection rate at 146ms.

3) Reduce thread stack size
In Windows, thread stack size is read from java.exe by default. This rate is 320K in Java SE 6. Using this tag reduces the stack size for threads.

-Xss64k

4) Think about speed
Try to use data that is fast and efficient. Research! Look up how fast certain data types are, and think about what your application needs to do to find the fastest solution.

You can use a benchmark to test speeds.

public class Benchmark {
public static void main(String[] arg) {
long before = System.currentTimeMillis();
//stuff to do
long after = System.currentTimeMillis();
System.out.println("Elapsed time: " + Long.toString(after - before) + " milliseconds");
}
}

5) Do all the steps by using these tags!

-Xms512m -Xmx512m -Xss64k -XX:NewSize=128m -XX:MaxNewSize=128m -server

Mish
June 27th, 2010, 08:16
Thanks for this Canownueasy :D.

Comboed
June 27th, 2010, 08:34
Or dont use delta, But Gj.

Canownueasy`
June 27th, 2010, 08:39
Or dont use delta, But Gj.

I love how you target Delta, this was created to improve Hyperion's speeds. I've gotten up to 15ms speed boost on my server by using these tricks :)

Fire cape
June 27th, 2010, 08:42
-server -XX:+AggressiveHeap -XX:MaxHeapFreeRatio=90 -XX:MinHeapFreeRatio=90 -XX:+DisableExplicitGC -XX:+RelaxAccessControlCheck -XX:+UseParallelGC -XX:CompileThreshold=1 -XX:ThreadStackSize=128

Canownueasy`
June 27th, 2010, 08:55
-server -XX:+AggressiveHeap -XX:MaxHeapFreeRatio=90 -XX:MinHeapFreeRatio=90 -XX:+DisableExplicitGC -XX:+RelaxAccessControlCheck -XX:+UseParallelGC -XX:CompileThreshold=1 -XX:ThreadStackSize=128

Why use a the XX tag to define stuff that can be defined in better ways?

SIR MOJO
June 27th, 2010, 08:59
Nice 1 can

Faab234
June 27th, 2010, 09:44
Thanks Canownueasy.

Ryan
June 27th, 2010, 13:02
Thanks. Hoping this makes my shard hold 1k+

jrune_
June 27th, 2010, 14:44
the java garbage collector has limitations, however could save a few milliseconds of performance enhancement. also using the -Xms and -Xms switches helps, also multiprocessing always helps, this is where the jvm spreads threads, making the performance much faster.
fianally if you can l2 synchronize....

SiniSoul
June 27th, 2010, 19:58
Or my favorite option, l2code :D

And instead of using a major update method, have a smaller universal update method that runs with your engine but doesn't directly come from the engine itself. Like saying ever .1 seconds I want you to check for packets, every .5 seconds I want to apply masks and every second I want to run the garbage disposal.

Just an idea.

Trey
June 27th, 2010, 22:35
Your benchmark may not work as well as you think it does. You should always call your method with meaningless data as a warm up, the Hotspot compiler will compile any code that is called over 10000 times. So it is good practice with benchmarking to warm up the method before calling it with legit data and actually timing.