Marshaller performance - loadDefaultProperties

View: New views
4 Messages — Rating Filter:   Alert me  

Marshaller performance - loadDefaultProperties

by mmcmaster :: Rate this Message:

| View Threaded | Show Only this Message

Greetings-

I'm looking at some performance issues with our product that's using Castor 1.2.  In profiling the code, I'm seeing a majority of the CPU time being spent constructing Marshaller instances.  Following the call path, it appears that each new Marshaller is loading and parsing the castor.properties file:

java.net.URL.openStream 12,450 ms (7 %) 1,138 µs 10,940
  7.6% - 12,450 ms - 10,940 hot spot inv. org.castor.core.util.Configuration.loadFromClassPath (line: 136)
    4.2% - 6,931 ms - 5,474 hot spot inv. org.castor.core.util.Configuration.loadDefaultProperties (line: 49)
      4.2% - 6,931 ms - 5,474 hot spot inv. org.castor.core.CoreConfiguration.<init> (line: 58)
      4.2% - 6,931 ms - 5,474 hot spot inv. org.castor.xml.XMLConfiguration.newInstance (line: 121)
      4.2% - 6,931 ms - 5,474 hot spot inv. org.castor.xml.AbstractInternalContext.<init> (line: 45)
      2.9% - 4,769 ms - 3,650 hot spot inv. org.castor.xml.BackwardCompatibilityContext.<init> (line: 185)
      1.6% - 2,650 ms - 1,830 hot spot inv. org.exolab.castor.xml.MarshalFramework.<init> (line: 298)
      1.3% - 2,119 ms - 1,820 hot spot inv. org.exolab.castor.xml.MarshalFramework.<init> (line: 310)
      1.3% - 2,162 ms - 1,824 hot spot inv. org.castor.xml.BackwardCompatibilityContext.<init> (line: 381)
    3.4% - 5,519 ms - 5,466 hot spot inv. org.castor.core.util.Configuration.loadDefaultProperties (line: 96)
      3.4% - 5,519 ms - 5,466 hot spot inv. org.castor.xml.XMLConfiguration.<init> (line: 59)
      3.4% - 5,519 ms - 5,466 hot spot inv. org.castor.xml.XMLConfiguration.newInstance (line: 121)
      3.4% - 5,519 ms - 5,466 hot spot inv. org.castor.xml.AbstractInternalContext.<init> (line: 45)
      2.1% - 3,447 ms - 3,638 hot spot inv. org.castor.xml.BackwardCompatibilityContext.<init> (line: 185)
      1.3% - 2,072 ms - 1,828 hot spot inv. org.castor.xml.BackwardCompatibilityContext.<init> (line: 381)

java.util.Properties.load 11,802 ms (7 %) 1,079 µs 10,931
  7.2% - 11,802 ms - 10,931 hot spot inv. org.castor.core.util.Configuration.loadFromClassPath (line: 136)
    4.0% - 6,477 ms - 5,460 hot spot inv. org.castor.core.util.Configuration.loadDefaultProperties (line: 96)
      4.0% - 6,477 ms - 5,460 hot spot inv. org.castor.xml.XMLConfiguration.<init> (line: 59)
      4.0% - 6,477 ms - 5,460 hot spot inv. org.castor.xml.XMLConfiguration.newInstance (line: 121)
      4.0% - 6,477 ms - 5,460 hot spot inv. org.castor.xml.AbstractInternalContext.<init> (line: 45)
      2.5% - 4,115 ms - 3,633 hot spot inv. org.castor.xml.BackwardCompatibilityContext.<init> (line: 185)
      1.4% - 2,238 ms - 1,823 hot spot inv. org.exolab.castor.xml.MarshalFramework.<init> (line: 298)
      1.2% - 1,877 ms - 1,810 hot spot inv. org.exolab.castor.xml.MarshalFramework.<init> (line: 310)
      1.4% - 2,361 ms - 1,827 hot spot inv. org.castor.xml.BackwardCompatibilityContext.<init> (line: 381)
      1.4% - 2,361 ms - 1,827 hot spot inv. org.exolab.castor.xml.Marshaller.initialize (line: 305)
      1.4% - 2,361 ms - 1,827 hot spot inv. org.exolab.castor.xml.Marshaller.<init> (line: 315)
    3.3% - 5,324 ms - 5,471 hot spot inv. org.castor.core.util.Configuration.loadDefaultProperties (line: 49)
      3.3% - 5,324 ms - 5,471 hot spot inv. org.castor.core.CoreConfiguration.<init> (line: 58)
      3.3% - 5,324 ms - 5,471 hot spot inv. org.castor.xml.XMLConfiguration.newInstance (line: 121)
      3.3% - 5,324 ms - 5,471 hot spot inv. org.castor.xml.AbstractInternalContext.<init> (line: 45)
      2.1% - 3,448 ms - 3,643 hot spot inv. org.castor.xml.BackwardCompatibilityContext.<init> (line: 185)
      1.1% - 1,876 ms - 1,828 hot spot inv. org.castor.xml.BackwardCompatibilityContext.<init> (line: 381)

Is there some reason why the properties files are not read once and cached?  My application is spending slightly over 50 percent of its time loading and parsing these files, but I don't see any way to create a Marshaller instance without going through the BackwardCompatibilityContext initialization.  What am I missing?

Thanks
-Michael

Re: Marshaller performance - loadDefaultProperties

by Ralf Joachim-2 :: Rate this Message:

| View Threaded | Show Only this Message

Hi Michael,

could you please open a new issue in jira about this.

Having said that I don't see a solution to fix this if you use
constructors of Marshaller yourself. The prefered way to construct a
marshaller instance is through XMLContext.createMarshaller(). But using
XMLContext  wouldn't help you either at the moment as there seams to be
a bug that always reloads properies even if it gets reassigned to the
ones loaded at construction of XMLContext directly thereafter.

Regards
Ralf


mmcmaster schrieb:

> Greetings-
>
> I'm looking at some performance issues with our product that's using Castor
> 1.2.  In profiling the code, I'm seeing a majority of the CPU time being
> spent constructing Marshaller instances.  Following the call path, it
> appears that each new Marshaller is loading and parsing the
> castor.properties file:
>
> java.net.URL.openStream 12,450 ms (7 %) 1,138 µs 10,940
>   7.6% - 12,450 ms - 10,940 hot spot inv.
> org.castor.core.util.Configuration.loadFromClassPath (line: 136)
>     4.2% - 6,931 ms - 5,474 hot spot inv.
> org.castor.core.util.Configuration.loadDefaultProperties (line: 49)
>       4.2% - 6,931 ms - 5,474 hot spot inv.
> org.castor.core.CoreConfiguration.<init> (line: 58)
>       4.2% - 6,931 ms - 5,474 hot spot inv.
> org.castor.xml.XMLConfiguration.newInstance (line: 121)
>       4.2% - 6,931 ms - 5,474 hot spot inv.
> org.castor.xml.AbstractInternalContext.<init> (line: 45)
>       2.9% - 4,769 ms - 3,650 hot spot inv.
> org.castor.xml.BackwardCompatibilityContext.<init> (line: 185)
>       1.6% - 2,650 ms - 1,830 hot spot inv.
> org.exolab.castor.xml.MarshalFramework.<init> (line: 298)
>       1.3% - 2,119 ms - 1,820 hot spot inv.
> org.exolab.castor.xml.MarshalFramework.<init> (line: 310)
>       1.3% - 2,162 ms - 1,824 hot spot inv.
> org.castor.xml.BackwardCompatibilityContext.<init> (line: 381)
>     3.4% - 5,519 ms - 5,466 hot spot inv.
> org.castor.core.util.Configuration.loadDefaultProperties (line: 96)
>       3.4% - 5,519 ms - 5,466 hot spot inv.
> org.castor.xml.XMLConfiguration.<init> (line: 59)
>       3.4% - 5,519 ms - 5,466 hot spot inv.
> org.castor.xml.XMLConfiguration.newInstance (line: 121)
>       3.4% - 5,519 ms - 5,466 hot spot inv.
> org.castor.xml.AbstractInternalContext.<init> (line: 45)
>       2.1% - 3,447 ms - 3,638 hot spot inv.
> org.castor.xml.BackwardCompatibilityContext.<init> (line: 185)
>       1.3% - 2,072 ms - 1,828 hot spot inv.
> org.castor.xml.BackwardCompatibilityContext.<init> (line: 381)
>
> java.util.Properties.load 11,802 ms (7 %) 1,079 µs 10,931
>   7.2% - 11,802 ms - 10,931 hot spot inv.
> org.castor.core.util.Configuration.loadFromClassPath (line: 136)
>     4.0% - 6,477 ms - 5,460 hot spot inv.
> org.castor.core.util.Configuration.loadDefaultProperties (line: 96)
>       4.0% - 6,477 ms - 5,460 hot spot inv.
> org.castor.xml.XMLConfiguration.<init> (line: 59)
>       4.0% - 6,477 ms - 5,460 hot spot inv.
> org.castor.xml.XMLConfiguration.newInstance (line: 121)
>       4.0% - 6,477 ms - 5,460 hot spot inv.
> org.castor.xml.AbstractInternalContext.<init> (line: 45)
>       2.5% - 4,115 ms - 3,633 hot spot inv.
> org.castor.xml.BackwardCompatibilityContext.<init> (line: 185)
>       1.4% - 2,238 ms - 1,823 hot spot inv.
> org.exolab.castor.xml.MarshalFramework.<init> (line: 298)
>       1.2% - 1,877 ms - 1,810 hot spot inv.
> org.exolab.castor.xml.MarshalFramework.<init> (line: 310)
>       1.4% - 2,361 ms - 1,827 hot spot inv.
> org.castor.xml.BackwardCompatibilityContext.<init> (line: 381)
>       1.4% - 2,361 ms - 1,827 hot spot inv.
> org.exolab.castor.xml.Marshaller.initialize (line: 305)
>       1.4% - 2,361 ms - 1,827 hot spot inv.
> org.exolab.castor.xml.Marshaller.<init> (line: 315)
>     3.3% - 5,324 ms - 5,471 hot spot inv.
> org.castor.core.util.Configuration.loadDefaultProperties (line: 49)
>       3.3% - 5,324 ms - 5,471 hot spot inv.
> org.castor.core.CoreConfiguration.<init> (line: 58)
>       3.3% - 5,324 ms - 5,471 hot spot inv.
> org.castor.xml.XMLConfiguration.newInstance (line: 121)
>       3.3% - 5,324 ms - 5,471 hot spot inv.
> org.castor.xml.AbstractInternalContext.<init> (line: 45)
>       2.1% - 3,448 ms - 3,643 hot spot inv.
> org.castor.xml.BackwardCompatibilityContext.<init> (line: 185)
>       1.1% - 1,876 ms - 1,828 hot spot inv.
> org.castor.xml.BackwardCompatibilityContext.<init> (line: 381)
>
> Is there some reason why the properties files are not read once and cached?
> My application is spending slightly over 50 percent of its time loading and
> parsing these files, but I don't see any way to create a Marshaller instance
> without going through the BackwardCompatibilityContext initialization.  What
> am I missing?
>
> Thanks
> -Michael
>  


--

Syscon Ingenieurbüro für Meß- und Datentechnik GmbH
Ralf Joachim
Raiffeisenstraße 11
72127 Kusterdingen
Germany

Tel.   +49 7071 3690 52
Mobil: +49 173 9630135
Fax    +49 7071 3690 98

Internet: www.syscon.eu
E-Mail: ralf.joachim@...

Sitz der Gesellschaft: D-72127 Kusterdingen
Registereintrag: Amtsgericht Stuttgart, HRB 382295
Geschäftsleitung: Jens Joachim, Ralf Joachim




---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email



Re: Marshaller performance - loadDefaultProperties

by Werner Guttmann :: Rate this Message:

| View Threaded | Show Only this Message

Hi Ralf,

maybe Joachim is in a position to comment on this, as I think he's the
one who knows most about this code.

Werner

Ralf Joachim wrote:

> Hi Michael,
>
> could you please open a new issue in jira about this.
>
> Having said that I don't see a solution to fix this if you use
> constructors of Marshaller yourself. The prefered way to construct a
> marshaller instance is through XMLContext.createMarshaller(). But using
> XMLContext  wouldn't help you either at the moment as there seams to be
> a bug that always reloads properies even if it gets reassigned to the
> ones loaded at construction of XMLContext directly thereafter.
>
> Regards
> Ralf
>
>
> mmcmaster schrieb:
>> Greetings-
>>
>> I'm looking at some performance issues with our product that's using Castor
>> 1.2.  In profiling the code, I'm seeing a majority of the CPU time being
>> spent constructing Marshaller instances.  Following the call path, it
>> appears that each new Marshaller is loading and parsing the
>> castor.properties file:
>>
>> java.net.URL.openStream 12,450 ms (7 %) 1,138 µs 10,940
>>   7.6% - 12,450 ms - 10,940 hot spot inv.
>> org.castor.core.util.Configuration.loadFromClassPath (line: 136)
>>     4.2% - 6,931 ms - 5,474 hot spot inv.
>> org.castor.core.util.Configuration.loadDefaultProperties (line: 49)
>>       4.2% - 6,931 ms - 5,474 hot spot inv.
>> org.castor.core.CoreConfiguration.<init> (line: 58)
>>       4.2% - 6,931 ms - 5,474 hot spot inv.
>> org.castor.xml.XMLConfiguration.newInstance (line: 121)
>>       4.2% - 6,931 ms - 5,474 hot spot inv.
>> org.castor.xml.AbstractInternalContext.<init> (line: 45)
>>       2.9% - 4,769 ms - 3,650 hot spot inv.
>> org.castor.xml.BackwardCompatibilityContext.<init> (line: 185)
>>       1.6% - 2,650 ms - 1,830 hot spot inv.
>> org.exolab.castor.xml.MarshalFramework.<init> (line: 298)
>>       1.3% - 2,119 ms - 1,820 hot spot inv.
>> org.exolab.castor.xml.MarshalFramework.<init> (line: 310)
>>       1.3% - 2,162 ms - 1,824 hot spot inv.
>> org.castor.xml.BackwardCompatibilityContext.<init> (line: 381)
>>     3.4% - 5,519 ms - 5,466 hot spot inv.
>> org.castor.core.util.Configuration.loadDefaultProperties (line: 96)
>>       3.4% - 5,519 ms - 5,466 hot spot inv.
>> org.castor.xml.XMLConfiguration.<init> (line: 59)
>>       3.4% - 5,519 ms - 5,466 hot spot inv.
>> org.castor.xml.XMLConfiguration.newInstance (line: 121)
>>       3.4% - 5,519 ms - 5,466 hot spot inv.
>> org.castor.xml.AbstractInternalContext.<init> (line: 45)
>>       2.1% - 3,447 ms - 3,638 hot spot inv.
>> org.castor.xml.BackwardCompatibilityContext.<init> (line: 185)
>>       1.3% - 2,072 ms - 1,828 hot spot inv.
>> org.castor.xml.BackwardCompatibilityContext.<init> (line: 381)
>>
>> java.util.Properties.load 11,802 ms (7 %) 1,079 µs 10,931
>>   7.2% - 11,802 ms - 10,931 hot spot inv.
>> org.castor.core.util.Configuration.loadFromClassPath (line: 136)
>>     4.0% - 6,477 ms - 5,460 hot spot inv.
>> org.castor.core.util.Configuration.loadDefaultProperties (line: 96)
>>       4.0% - 6,477 ms - 5,460 hot spot inv.
>> org.castor.xml.XMLConfiguration.<init> (line: 59)
>>       4.0% - 6,477 ms - 5,460 hot spot inv.
>> org.castor.xml.XMLConfiguration.newInstance (line: 121)
>>       4.0% - 6,477 ms - 5,460 hot spot inv.
>> org.castor.xml.AbstractInternalContext.<init> (line: 45)
>>       2.5% - 4,115 ms - 3,633 hot spot inv.
>> org.castor.xml.BackwardCompatibilityContext.<init> (line: 185)
>>       1.4% - 2,238 ms - 1,823 hot spot inv.
>> org.exolab.castor.xml.MarshalFramework.<init> (line: 298)
>>       1.2% - 1,877 ms - 1,810 hot spot inv.
>> org.exolab.castor.xml.MarshalFramework.<init> (line: 310)
>>       1.4% - 2,361 ms - 1,827 hot spot inv.
>> org.castor.xml.BackwardCompatibilityContext.<init> (line: 381)
>>       1.4% - 2,361 ms - 1,827 hot spot inv.
>> org.exolab.castor.xml.Marshaller.initialize (line: 305)
>>       1.4% - 2,361 ms - 1,827 hot spot inv.
>> org.exolab.castor.xml.Marshaller.<init> (line: 315)
>>     3.3% - 5,324 ms - 5,471 hot spot inv.
>> org.castor.core.util.Configuration.loadDefaultProperties (line: 49)
>>       3.3% - 5,324 ms - 5,471 hot spot inv.
>> org.castor.core.CoreConfiguration.<init> (line: 58)
>>       3.3% - 5,324 ms - 5,471 hot spot inv.
>> org.castor.xml.XMLConfiguration.newInstance (line: 121)
>>       3.3% - 5,324 ms - 5,471 hot spot inv.
>> org.castor.xml.AbstractInternalContext.<init> (line: 45)
>>       2.1% - 3,448 ms - 3,643 hot spot inv.
>> org.castor.xml.BackwardCompatibilityContext.<init> (line: 185)
>>       1.1% - 1,876 ms - 1,828 hot spot inv.
>> org.castor.xml.BackwardCompatibilityContext.<init> (line: 381)
>>
>> Is there some reason why the properties files are not read once and cached?
>> My application is spending slightly over 50 percent of its time loading and
>> parsing these files, but I don't see any way to create a Marshaller instance
>> without going through the BackwardCompatibilityContext initialization.  What
>> am I missing?
>>
>> Thanks
>> -Michael
>>  
>
>

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email



Re: Marshaller performance - loadDefaultProperties

by mmcmaster :: Rate this Message:

| View Threaded | Show Only this Message

Done: http://jira.codehaus.org/browse/CASTOR-2630

-Michael

Ralf Joachim-2 wrote:
Hi Michael,

could you please open a new issue in jira about this.
<SNIP>

Regards
Ralf