[Bug 2040] New: Improve HarvesterHelper.collectAndSaveThreadData()

bugzilla-daemon at icedtea.classpath.org bugzilla-daemon at icedtea.classpath.org
Fri Oct 17 16:58:37 UTC 2014


            Bug ID: 2040
           Summary: Improve HarvesterHelper.collectAndSaveThreadData()
           Product: Thermostat
           Version: hg
          Hardware: x86_64
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P5
         Component: Thermostat
          Assignee: unassigned at icedtea.classpath.org
          Reporter: sgehwolf at redhat.com
                CC: thermostat at icedtea.classpath.org
            Blocks: 2038

HarvesterHelper.collectAndSaveThreadData() calls the following in a loop (n ==
number of threads of a JVM):
 - ThreadHeaderHelper.checkAndSaveThreadHeader(): performs 1 query + 1 add
 - ThreadStateHelper.saveThreadState(): performs 1 query + 1 add or update
 - ThreadContentionHelper.saveContentionSample(): performs 1 add.

Thus, 2 + 2 + 1 = O(5n) DB ops (reads and/or writes). This way the # of queries
depend on the # of threads.

A few avenues worth exploring are:
 1.) Remove query part. Agent doing querying is bad practice.
 2.) If 1 is not possible refactor the query to fetch all thread headers for
     threads in one query. This might need projection support.
 3.) Consider implementing API for bulk writes. It's worth saving a network
round-trip. I.e. send a list (cardinality n) of thread headers/contention
samples to get inserted.

You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.openjdk.java.net/pipermail/distro-pkg-dev/attachments/20141017/1fdfd8c0/attachment.html>

More information about the distro-pkg-dev mailing list