
|
If you were logged in you would be able to see more operations.
|
|
|
Submitted per request: http://www.nabble.com/Marshaller-performance---loadDefaultProperties-td21633179.html
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.
-Michael
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
|
|
Description
|
Submitted per request: http://www.nabble.com/Marshaller-performance---loadDefaultProperties-td21633179.html
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.
-Michael
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 |
Show » |
Sort Order:
|
Idea to prevent loading of properties at every construction of Marshaller through XMLContext. Having said that I haven't tested anything.