Java application developped under Linux running ridiculously slow under Windows

Discussion in 'Java' started by hshdude, Oct 24, 2004.

  1. hshdude

    hshdude Guest

    Hi,

    I have been working with a time-criticial application written in Java by my
    predecessors in the lab. It's a server that keeps track of objects running
    around in real time, with clients connecting via TCP/IP to get information
    about those objects. The clients can then display that information in
    various (mostly graphical) ways and send requests to the server for a
    particular object to change its behavior (e.g. speed). Clients and server
    initially ran in separate processes, but now run as separate threads within
    the same process (in a largely unsuccessful attempt to speed things up).

    The application has so far only been used under Linux but now the need arose
    for it to be runnable under Windows. Running it isn't really the problem,
    the problem is the speed with which it runs. There aren't any hard
    computations involved and it runs much slower on Windows than on Linux even
    when run on the same (physical) machine, to the extent that it's unusable as
    it need to run in real time. Does anyone have any idea what might be going
    on here?

    Thanks in advance

    cheers,
    Arnold


    [I'm posting this on three groups at the same time that seem relevant.]
    hshdude, Oct 24, 2004
    #1
    1. Advertising

  2. Re: Java application developped under Linux running ridiculouslyslow under Windows

    hshdude wrote:
    > The application has so far only been used under Linux but now the need arose
    > for it to be runnable under Windows. Running it isn't really the problem,
    > the problem is the speed with which it runs. There aren't any hard
    > computations involved and it runs much slower on Windows than on Linux even
    > when run on the same (physical) machine, to the extent that it's unusable as
    > it need to run in real time. Does anyone have any idea what might be going
    > on here?


    There are programs called profilers that tell you exactly where an application
    spends its time. Get one of these and use it.

    Guesswork is a very bad basis for performance tuning.
    Michael Borgwardt, Oct 25, 2004
    #2
    1. Advertising

  3. hshdude

    Ann Guest

    "hshdude" <> wrote in message
    news:clha9q$itk$...
    > Hi,
    >
    > I have been working with a time-criticial application written in Java by

    my
    > predecessors in the lab. It's a server that keeps track of objects

    running
    > around in real time, with clients connecting via TCP/IP to get information
    > about those objects. The clients can then display that information in
    > various (mostly graphical) ways and send requests to the server for a
    > particular object to change its behavior (e.g. speed). Clients and server
    > initially ran in separate processes, but now run as separate threads

    within
    > the same process (in a largely unsuccessful attempt to speed things up).
    >
    > The application has so far only been used under Linux but now the need

    arose
    > for it to be runnable under Windows. Running it isn't really the problem,
    > the problem is the speed with which it runs. There aren't any hard
    > computations involved and it runs much slower on Windows than on Linux

    even
    > when run on the same (physical) machine, to the extent that it's unusable

    as
    > it need to run in real time. Does anyone have any idea what might be

    going
    > on here?
    >
    > Thanks in advance
    >
    > cheers,
    > Arnold
    >
    >
    > [I'm posting this on three groups at the same time that seem relevant.]
    >


    Does it use threads? The implementation of threads is different I believe.
    Ann, Oct 25, 2004
    #3
  4. hshdude

    hshdude Guest

    "Ann" <> wrote in message
    news:tvXed.242580$wV.75588@attbi_s54...
    >
    > "hshdude" <> wrote in message
    > news:clha9q$itk$...
    > > Hi,
    > >
    > > I have been working with a time-criticial application written in Java by

    > my
    > > predecessors in the lab. It's a server that keeps track of objects

    > running
    > > around in real time, with clients connecting via TCP/IP to get

    information
    > > about those objects. The clients can then display that information in
    > > various (mostly graphical) ways and send requests to the server for a
    > > particular object to change its behavior (e.g. speed). Clients and

    server
    > > initially ran in separate processes, but now run as separate threads

    > within
    > > the same process (in a largely unsuccessful attempt to speed things up).
    > >
    > > The application has so far only been used under Linux but now the need

    > arose
    > > for it to be runnable under Windows. Running it isn't really the

    problem,
    > > the problem is the speed with which it runs. There aren't any hard
    > > computations involved and it runs much slower on Windows than on Linux

    > even
    > > when run on the same (physical) machine, to the extent that it's

    unusable
    > as
    > > it need to run in real time. Does anyone have any idea what might be

    > going
    > > on here?
    > >
    > > Thanks in advance
    > >
    > > cheers,
    > > Arnold
    > >
    > >
    > > [I'm posting this on three groups at the same time that seem relevant.]
    > >

    >
    > Does it use threads? The implementation of threads is different I believe.


    Yes, it does use threads. Originally I had a separate process run for each
    client. Due to the slow performance I changed it so that there is one
    single process with several threads for the server and all the clients.
    That didn't seem to speed things up much though.
    hshdude, Oct 25, 2004
    #4
  5. hshdude

    hshdude Guest

    "Michael Borgwardt" <> wrote in message
    news:...
    > hshdude wrote:
    > > The application has so far only been used under Linux but now the need

    arose
    > > for it to be runnable under Windows. Running it isn't really the

    problem,
    > > the problem is the speed with which it runs. There aren't any hard
    > > computations involved and it runs much slower on Windows than on Linux

    even
    > > when run on the same (physical) machine, to the extent that it's

    unusable as
    > > it need to run in real time. Does anyone have any idea what might be

    going
    > > on here?

    >
    > There are programs called profilers that tell you exactly where an

    application
    > spends its time. Get one of these and use it.
    >
    > Guesswork is a very bad basis for performance tuning.


    Thanks, I'll look into that!
    hshdude, Oct 25, 2004
    #5
  6. In article <>,
    Michael Borgwardt <> wrote:

    > hshdude wrote:
    > > The application has so far only been used under Linux but now the need arose
    > > for it to be runnable under Windows. Running it isn't really the problem,
    > > the problem is the speed with which it runs. There aren't any hard
    > > computations involved and it runs much slower on Windows than on Linux even
    > > when run on the same (physical) machine, to the extent that it's unusable as
    > > it need to run in real time. Does anyone have any idea what might be going
    > > on here?

    >
    > There are programs called profilers that tell you exactly where an application
    > spends its time. Get one of these and use it.
    >
    > Guesswork is a very bad basis for performance tuning.


    Indeed. You should also examine your Windows system when the Java
    program _isn't_ running. Check specifically for visues, adware and
    similar resource draining malware.

    --
    John
    ----
    jmatthews at wright dot edu
    www dot wright dot edu/~john.matthews/
    John B. Matthews, Oct 25, 2004
    #6
  7. "hshdude" <> wrote in
    news:clhoq5$16v$:

    >
    > "Ann" <> wrote in message
    > news:tvXed.242580$wV.75588@attbi_s54...
    >>
    >> "hshdude" <> wrote in message
    >> news:clha9q$itk$...
    >> > Hi,
    >> >
    >> > I have been working with a time-criticial application written in
    >> > Java by

    >> my
    >> > predecessors in the lab. It's a server that keeps track of objects

    >> running
    >> > around in real time, with clients connecting via TCP/IP to get

    > information
    >> > about those objects. The clients can then display that information
    >> > in various (mostly graphical) ways and send requests to the server
    >> > for a particular object to change its behavior (e.g. speed).
    >> > Clients and

    > server
    >> > initially ran in separate processes, but now run as separate
    >> > threads

    >> within
    >> > the same process (in a largely unsuccessful attempt to speed things
    >> > up).
    >> >
    >> > The application has so far only been used under Linux but now the
    >> > need

    >> arose
    >> > for it to be runnable under Windows. Running it isn't really the

    > problem,
    >> > the problem is the speed with which it runs. There aren't any hard
    >> > computations involved and it runs much slower on Windows than on
    >> > Linux

    >> even
    >> > when run on the same (physical) machine, to the extent that it's

    > unusable
    >> as
    >> > it need to run in real time. Does anyone have any idea what might
    >> > be

    >> going
    >> > on here?
    >> >
    >> > Thanks in advance
    >> >
    >> > cheers,
    >> > Arnold
    >> >
    >> >
    >> > [I'm posting this on three groups at the same time that seem
    >> > relevant.]
    >> >

    >>
    >> Does it use threads? The implementation of threads is different I
    >> believe.

    >
    > Yes, it does use threads. Originally I had a separate process run for
    > each client. Due to the slow performance I changed it so that there
    > is one single process with several threads for the server and all the
    > clients. That didn't seem to speed things up much though.
    >
    >


    Which is a prime example of "premature optimization".

    Such a refactor could be expected to improve performance IF the problem
    POSSIBLY might have had to do with insufficient memory (SOME
    implementations of threads will use less memory than separate processes)
    or MAYBE communication (SOME implementations of thread/thread
    communcations are faster than SOME implementations of process/process),
    or process start time versus thread start time, or whatever.

    Take this is a lesson that shooting in the dark rarely hits the target.
    Get some illumination on the problem before trying again to solve it.

    Sorry to rag on you -- I've been beat up so many times to optimize before
    we know where the problem is, so I get a little heated.

    Chas Douglass
    Chas Douglass, Oct 25, 2004
    #7
  8. "hshdude" <> wrote in message news:<clhor1$175$>...
    > "Michael Borgwardt" <> wrote in message
    > news:...


    > > There are programs called profilers that tell you exactly where an

    > application
    > > spends its time. Get one of these and use it.

    >
    > Thanks, I'll look into that!


    While in the end the output may be very nice, I always find profilers
    a little difficult to set up. I mostly use poor man's sampling: hit
    CTRL-break (Windows) / CTRL-Backslash (UNIX) repeatedly to get some
    thread dumps (with many threads, these will be long). Often it's easy
    to tell where the bottleneck is. If you still have no idea after a
    minute, then go get a profiler ...

    Matthias
    Matthias Ernst, Oct 26, 2004
    #8
  9. hshdude

    Ed Elud Guest

    You might also want to take a good look at your application startup
    memory settings (heap size) - if you're not using any, then, it is
    possible that a default is being applied - which maybe causing garbage
    collection issues, etc. Also, by default, Windoze generally splits
    memory allocation around 40/60 to 60/40 in RAM and the other in
    Virtual Memory - often without much regard to total available memory.
    Thats often why you can increase memory on an Windoze system and not
    notice exponential application speed.

    Mind you, these are generalizations which I have found to be mostly
    true.

    Hope this helps.


    Chas Douglass <> wrote in message news:<Xns958D87759A6F9cdouglasoznet@216.168.3.30>...
    > "hshdude" <> wrote in
    > news:clhoq5$16v$:
    >
    > >
    > > "Ann" <> wrote in message
    > > news:tvXed.242580$wV.75588@attbi_s54...
    > >>
    > >> "hshdude" <> wrote in message
    > >> news:clha9q$itk$...
    > >> > Hi,
    > >> >
    > >> > I have been working with a time-criticial application written in
    > >> > Java by

    > my
    > >> > predecessors in the lab. It's a server that keeps track of objects

    > running
    > >> > around in real time, with clients connecting via TCP/IP to get

    > information
    > >> > about those objects. The clients can then display that information
    > >> > in various (mostly graphical) ways and send requests to the server
    > >> > for a particular object to change its behavior (e.g. speed).
    > >> > Clients and

    > server
    > >> > initially ran in separate processes, but now run as separate
    > >> > threads

    > within
    > >> > the same process (in a largely unsuccessful attempt to speed things
    > >> > up).
    > >> >
    > >> > The application has so far only been used under Linux but now the
    > >> > need

    > arose
    > >> > for it to be runnable under Windows. Running it isn't really the

    > problem,
    > >> > the problem is the speed with which it runs. There aren't any hard
    > >> > computations involved and it runs much slower on Windows than on
    > >> > Linux

    > even
    > >> > when run on the same (physical) machine, to the extent that it's

    > unusable
    > as
    > >> > it need to run in real time. Does anyone have any idea what might
    > >> > be

    > going
    > >> > on here?
    > >> >
    > >> > Thanks in advance
    > >> >
    > >> > cheers,
    > >> > Arnold
    > >> >
    > >> >
    > >> > [I'm posting this on three groups at the same time that seem
    > >> > relevant.]
    > >> >
    > >>
    > >> Does it use threads? The implementation of threads is different I
    > >> believe.

    > >
    > > Yes, it does use threads. Originally I had a separate process run for
    > > each client. Due to the slow performance I changed it so that there
    > > is one single process with several threads for the server and all the
    > > clients. That didn't seem to speed things up much though.
    > >
    > >

    >
    > Which is a prime example of "premature optimization".
    >
    > Such a refactor could be expected to improve performance IF the problem
    > POSSIBLY might have had to do with insufficient memory (SOME
    > implementations of threads will use less memory than separate processes)
    > or MAYBE communication (SOME implementations of thread/thread
    > communcations are faster than SOME implementations of process/process),
    > or process start time versus thread start time, or whatever.
    >
    > Take this is a lesson that shooting in the dark rarely hits the target.
    > Get some illumination on the problem before trying again to solve it.
    >
    > Sorry to rag on you -- I've been beat up so many times to optimize before
    > we know where the problem is, so I get a little heated.
    >
    > Chas Douglass
    Ed Elud, Oct 26, 2004
    #9
  10. hshdude

    Tim Jowers Guest

    (Matthias Ernst) wrote in message news:<>...
    > "hshdude" <> wrote in message news:<clhor1$175$>...
    > > "Michael Borgwardt" <> wrote in message
    > > news:...

    >
    > > > There are programs called profilers that tell you exactly where an

    > application
    > > > spends its time. Get one of these and use it.

    > >
    > > Thanks, I'll look into that!

    >
    > While in the end the output may be very nice, I always find profilers
    > a little difficult to set up. I mostly use poor man's sampling: hit
    > CTRL-break (Windows) / CTRL-Backslash (UNIX) repeatedly to get some
    > thread dumps (with many threads, these will be long). Often it's easy
    > to tell where the bottleneck is. If you still have no idea after a
    > minute, then go get a profiler ...
    >
    > Matthias


    bongo, please let us know what you find out. The Java app I use at
    work on Windows runs unacceptably slow. Pretty sure it is Windows as
    the CPU sits pegged (dual 2.8GHz Dell). Windows seems to have become
    slower and slower over the last several years.
    Tim Jowers, Oct 26, 2004
    #10
  11. hshdude

    hshdude Guest

    "Tim Jowers" <> wrote in message
    news:...
    > (Matthias Ernst) wrote in message

    news:<>...
    > > "hshdude" <> wrote in message

    news:<clhor1$175$>...
    > > > "Michael Borgwardt" <> wrote in message
    > > > news:...

    > >
    > > > > There are programs called profilers that tell you exactly where an

    > > application
    > > > > spends its time. Get one of these and use it.
    > > >
    > > > Thanks, I'll look into that!

    > >
    > > While in the end the output may be very nice, I always find profilers
    > > a little difficult to set up. I mostly use poor man's sampling: hit
    > > CTRL-break (Windows) / CTRL-Backslash (UNIX) repeatedly to get some
    > > thread dumps (with many threads, these will be long). Often it's easy
    > > to tell where the bottleneck is. If you still have no idea after a
    > > minute, then go get a profiler ...
    > >
    > > Matthias

    >
    > bongo, please let us know what you find out. The Java app I use at
    > work on Windows runs unacceptably slow. Pretty sure it is Windows as
    > the CPU sits pegged (dual 2.8GHz Dell). Windows seems to have become
    > slower and slower over the last several years.


    Thanks for everyone's input! I'll let you know when I do find out what the
    problem is, though it might take a while. It's "only" for my side job and I
    have busy times at school ahead. So far I too have the impression that
    either Windows or the JVM is just ridiculously slow as our application is
    really neither memory- nor computationally intensive.
    hshdude, Oct 27, 2004
    #11
  12. hshdude

    hshdude Guest

    I owe this thread a message about the outcome.

    After printing out GC messages and giving the process more heap space than
    it could possibly need, and not seeing any change in speed, I traced down
    the bottleneck by hand (still hoping I could avoid having to get a
    profiler).
    As it turns out, for each simulated object (the application I'm talking
    about is a generic simulation of of whatever things you want simulated), a
    message-passing routine was called once per update cycle, sending a message
    to an optional software agent. When not running the agent simultaneously,
    an exception is thrown and ignored. So to make a long story short, throwing
    that exception (or realizing that the recipient agent is not alive) takes
    neglicable time under Linux, but an entire second under Windows... I simply
    threw out the message-passing code as we don't need the agent for our
    Windows version of the application.

    Sorry the solution wasn't more general so that other people could have
    profited from it as well.

    Thanks to everyone for their input!!
    Arnold

    "Tim Jowers" <> wrote in message
    news:...
    > (Matthias Ernst) wrote in message

    news:<>...
    > > "hshdude" <> wrote in message

    news:<clhor1$175$>...
    > > > "Michael Borgwardt" <> wrote in message
    > > > news:...

    > >
    > > > > There are programs called profilers that tell you exactly where an

    > > application
    > > > > spends its time. Get one of these and use it.
    > > >
    > > > Thanks, I'll look into that!

    > >
    > > While in the end the output may be very nice, I always find profilers
    > > a little difficult to set up. I mostly use poor man's sampling: hit
    > > CTRL-break (Windows) / CTRL-Backslash (UNIX) repeatedly to get some
    > > thread dumps (with many threads, these will be long). Often it's easy
    > > to tell where the bottleneck is. If you still have no idea after a
    > > minute, then go get a profiler ...
    > >
    > > Matthias

    >
    > bongo, please let us know what you find out. The Java app I use at
    > work on Windows runs unacceptably slow. Pretty sure it is Windows as
    > the CPU sits pegged (dual 2.8GHz Dell). Windows seems to have become
    > slower and slower over the last several years.
    hshdude, Nov 4, 2004
    #12
  13. hshdude sez:
    > I owe this thread a message about the outcome.

    [ exceptions ]

    This is a known problem with exceptions.
    Feed, say, 10,000 valid floats to the following:
    try { float f = Float.parseFloat( str ); }
    catch( NumberFormatException e ) {}
    and time it. Then feed 10,000 invalid floats through and time
    that (FVO "invalid float" including numbers in scientific format).
    Then compare the times and weep.

    IOW "exception" is called that because it's thrown in exceptional
    circumstances. If it's a recoverable error that you expect to see
    during normal program execution, you want to have a subroutine
    return an error value that you can check in a plain if() instead.

    Dima
    --
    Sufficiently advanced incompetence is indistinguishable from malice.
    Dimitri Maziuk, Nov 4, 2004
    #13
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Mark Olbert

    Ridiculously Slow SqlServer2005 Sorting?

    Mark Olbert, Dec 23, 2005, in forum: ASP .Net
    Replies:
    2
    Views:
    399
    Mark Olbert
    Dec 24, 2005
  2. Roy
    Replies:
    2
    Views:
    309
    vMike
    Jul 24, 2006
  3. B. Chernick
    Replies:
    4
    Views:
    673
    B. Chernick
    Dec 18, 2007
  4. BOB AISS
    Replies:
    0
    Views:
    130
    BOB AISS
    Jan 5, 2005
  5. Stedwick
    Replies:
    5
    Views:
    238
    Kyle Schmitt
    Apr 23, 2008
Loading...

Share This Page