Results 1 to 3 of 3
  1. #1
    couling is offline Member
    Join Date
    Nov 2010
    Posts
    54
    Rep Power
    0

    Default How to tune java performance on low end machines?

    Hi All

    I'm looking for hints as to how I can speed up a java program I'm writing.

    I'm doing a little personal project to put on my NAS for which I was hoping to use java. The box is a 500MHz ARM based box running Debian and using openjdk-6-jre-headless for the JVM.

    I'm having difficulties with performance which seem to be atributed to the fact that I'm using Java (perhapse it's the specific JVM but the SUN JVM doesnt appear to be available for ARM).

    The stub that I've built so far compares a table of known files (stored in a PostgreSQL database) with actual files on the box comparing timestamps and filesizes as well as checking for new and removed files. It then batch updates the database as apropriate. For ~6000 files this takes ~2 minutes.

    The same task done in C takes ~5 seconds.

    I'm aware that Java can often be slower but this is serveral orders of magnitude slower.

    The algorythm is simple enough:
    • Select everything from the database which should be found in the directory we're scanning. (Using JDBC).
    • Add the result set to a Map (Hash or Tree makes little difference)
    • Recurse the directory tree removing from the map
      • If a file is not found in the map then insert a new row
      • If a file is found but with different stats then update the row
    • Delete the row for anything left in the map at the end.
    ----Signature ----
    Please use [CODE] tags and indent correctly. It really helps when reading your code.

  2. #2
    JosAH's Avatar
    JosAH is offline Moderator
    Join Date
    Sep 2008
    Location
    Voorschoten, the Netherlands
    Posts
    13,778
    Blog Entries
    7
    Rep Power
    21

    Default

    Quote Originally Posted by couling View Post
    I'm doing a little personal project to put on my NAS for which I was hoping to use java. The box is a 500MHz ARM based box running Debian and using openjdk-6-jre-headless for the JVM.

    [ ... ]

    The same task done in C takes ~5 seconds.
    How much RAM is installed on that box? Do you see any swapping happening (it's killing the performance). The openjdk implementation is fine but I don't know how good/fast the port to an ARM processor is.

    kind regards,

    Jos
    cenosillicaphobia: the fear for an empty beer glass

  3. #3
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    12,224
    Rep Power
    20

    Default

    Quote Originally Posted by couling View Post
    • Select everything from the database which should be found in the directory we're scanning. (Using JDBC).
    • Add the result set to a Map (Hash or Tree makes little difference)
    • Recurse the directory tree removing from the map
      • If a file is not found in the map then insert a new row
      • If a file is found but with different stats then update the row
    • Delete the row for anything left in the map at the end.
    Have you profiled each of those steps?
    What does your JDBC look like for the batch?

Similar Threads

  1. JMF needed on target machines
    By fatblacktone in forum New To Java
    Replies: 1
    Last Post: 04-06-2010, 08:57 AM
  2. [SOLVED] Client/Server between two machines
    By nwboy74 in forum Networking
    Replies: 1
    Last Post: 11-15-2008, 12:49 AM
  3. JDK versions on web server and client machines
    By sunjavaboy in forum New To Java
    Replies: 1
    Last Post: 03-21-2008, 05:59 AM
  4. Replies: 3
    Last Post: 01-19-2008, 07:05 AM
  5. Cluster using 2 machines
    By Albert in forum Advanced Java
    Replies: 2
    Last Post: 07-04-2007, 07:31 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •