| | | | Browse by category |
Question
Why is performance slow for an application running on a remote server?
Answer
The usual fix for this problem is to set the sun.java2d.pmoffscreen system parameter to false. This can be done either through a JVM parameter:
-Dsun.java2d.pmoffscreen=false
or early during initialization of the program:
System.setProperty("sun.java2d.pmoffscreen", "false");
This flag influences the storage of the Swing double-buffer and other Java Image objects. If the flag is false, they reside in Java memory. If the flag is true, they reside in the X server.
In the 'false' case, drawing with antialiasing or transparency or in XOR mode is fast, but a refresh of the view after it was partially obscured can be a bit slow.
In the 'true' case, refreshing the view from the double-buffer is immediate, but drawing in general is slow, and drawing with antialiasing or transparency or in XOR mode is very slow, especially in the case of a remote display.
For a local display, for normal GUI programming, 'true' is probably the better choice, but for drawing intensive graphics (as with JViews), we recommend 'false'.
For a remote display, 'false' is the right choice, regardless of the type of application.
Since JDK 1.4, the default of this flag is 'true'.
References:
http://docs.oracle.com/javase/1.5.0/docs/guide/2d/flags.html#pmoffscreen