• Post Reply Bookmark Topic Watch Topic
  • New Topic

Low response time when reactivating Swing GUI

 
Dan Beuve
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi, I am struggling with a low response time. I have a Swing GUI based application that works quite well as long as the user is busy with. If the user stops to interact with the GUI, leaving the application on its own for a while (more or less 1h), when he clicks on it for reactivating it, the time for getting the GUI responsive again is quite long (up to 30 seconds). Once the GUI is activated everything works fine and the response time is normal

The OS is Windows XP (Sorry about that...). Does somebody has any idea how I could get the application responsive in a shorter delay ?
[ November 30, 2004: Message edited by: Dan Beuve ]
 
Ernest Friedman-Hill
author and iconoclast
Sheriff
Posts: 24213
35
Chrome Eclipse IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sounds like swapping. Put some memory in the computer.
 
Dan Beuve
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for the reply. For sure swapping is a factor but is it the only one, I wonder. I have 512 MB of RAM on my PC. My Swing apllication when launched takes 60 MB. If my application is the only one launched and I leave it alone for the night on the next morning when I try to reactivate it, it takes time to have it responsive and I can see the hard drive working. Why on earth would the application be swapped out if it is the only one running (apart from the OS)?
 
Joe Ess
Bartender
Posts: 9361
11
Linux Mac OS X Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Dan Beuve:
Why on earth would the application be swapped out if it is the only one running (apart from the OS)?


Look at the XP task manager. If it is anything like the computer I'm in front of you will have a couple dozen applications running, each competing for resources. When your Swing app goes idle, the priority will switch to other apps. Take a look at the Performance tag in task manager. How much memory is free? What percent of your CPU is used when "noone" is using the computer?
 
Dan Beuve
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If my application is the only one running and if I don't interact with it, the performance tab in the task manager show that the CPU is used at 0% with a peek at 1% from time to time and the pagefile graphics stay absolutely constant. I had a look on it for 10 minutes with no other applications running at all. The indicated available memory is more than 250 MB.

I have asked to the system team if they were running some jobs during the night and the answer is no.

So the situation is CPU rate = 0 % (with few peek at 1 %), 250 available MB and a swapped out application taking at most 60MB. Why this application is sawpped out ? Is there a way to prevent the JVM to be swapped out ?
 
Stefan Wagner
Ranch Hand
Posts: 1923
Linux Postgres Database Scala
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes.
The solution is to manually define the swapspace and set it to zero.
But this is might be a bad decision for other situations...
 
Dan Beuve
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Setting the swapspace to 0 is not an option, but the swapspace was badly configured. By changing the configuration, it improved the swap in/swap out during the day but apparently there is nothing to do to prevent the application to be swapped out after a few hours of inactivity.
 
Sergey Pariev
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello !

AFAIK this bug is already fixed in java 1.5 - see Sun Bug Database BugID 5043070 :

Synopsis : Long time to restore minimized application
Category : java:classes_awt
Reported Against :1.4.2
Release Fixed : 1.5(tiger-rc)
State : Closed, fixed

Description : When you minimize any other large Java app (like NetBeans IDE) that manages to be really idle when minimized on Windows, it is totally swapped out, and once you switch to it, it is feeling like a zombie for next few minutes.

Solution: Make a system property to allow Java application disable the working set trimming as described in MSKB article 293215. To do so application should override the processing of WM_SYSCOMMAND (wParam == SC_MINIMIZE) and programmatically minimize the window.

The feature is turned off by default, so the behavior of unwilling
applications will not be changed.

sun.awt.keepWorkingSetOnMinimize :
if sun.awt.keepWorkingSetOnMinimize=="true", the working set
trimming is disabled, otherwise the default OS behavior is
preserved.

So you'll have to upgrade to Java1.5 in order to fix it
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!