Re: Curious profiler result - allocating connections is a long process for MySql

From: Andrus Adamchik (andru..bjectstyle.org)
Date: Tue Jan 27 2004 - 10:52:55 EST

  • Next message: Andrus Adamchik: "Anonymous CVS is back up"

    On Jan 26, 2004, at 7:29 PM, Scott Ellsworth wrote:
    > JVM time:
    > 01:25
    >     <image.tiff> 44.1% - 2201 ms - 1 inv.
    > org.objectstyle.cayenne.access.DataContext.performQuery
    >     <image.tiff> 38.6% - 1929 ms - 1 inv.
    > org.objectstyle.cayenne.conf.Configuration.getSharedConfiguration
    >     <image.tiff> 13.5% - 673 ms - 1 inv.
    > org.objectstyle.cayenne.conf.Configuration.bootstrapSharedConfiguration
    >     <image.tiff> 2.5% - 122 ms - 1 inv.
    > org.objectstyle.cayenne.access.DataDomain.createDataContext
    >     <image.tiff> 0.6% - 27 ms - 2 inv. java.lang.Class.forName
    >     <image.tiff> 0.4% - 19 ms - 1 inv.
    > com.alodar.starmap.GameSummary.getQueryResults
    >     <image.tiff> 0.2% - 12 ms - 1 inv.
    > com.alodar.starmap.GameSummary.main
    >
    > I am still experimenting with ways to reduce the time spent in
    > performQuery, but I found the amount of time spent in
    > getSharedConfiguration surprising - this is a standalone app, on a
    > pretty unloaded machine.
    >
    > Should I have expected this?

    Hi Scott,

    Yes, this is not all that surprising - configuration initialization
    includes:

    1. Fair amount of class loading
    2. Parsing all cayenne project XML files to load mapping
    3. Creation of DB connection(s)

    But all three items above happen only once - during application
    startup. So unless your target application is going to be similar to
    your profiling example (single function command line tool that runs a
    query and exits), I suggest changing your profiling approach to get the
    real performance data. You should "warm up" the app before measuring
    its performance - run a few queries, maybe commit some data. This will
    ensure that none of the one time operations will be included in the
    results.

    Thanks
    Andrus



    This archive was generated by hypermail 2.0.0 : Tue Jan 27 2004 - 10:53:03 EST