Hi Guillaume; Thanks for reviewing;
But if I should only use three component types, then when creating each component instance, is there a way to configure a given component instance service dependency filter ? May I provide such filter in the dictionary that I pass to the ComponentType.createInstance(Dictionary conf) method ? (like passing a target filter with declarative service ComponentFactory ?). Should I use another iPOJO api (like an iPojo Factory ?) In my scenario, I have for example a first "Artist" instance depending on an "Album" instance with the filter "id=1". then another "Artist" instance depending on another "Album" instance, but with service filter "id=2", etc ... cheers; /Pierre On Wed, Jun 25, 2014 at 3:42 PM, Guillaume Sauthier (OW2) < [email protected]> wrote: > Maybe I don't fully understand Java 8 style code, but it looks like you're > creating too many PrimitiveComponentType instances, right ? > > In iPOJO, a component type is really like a class, you define its contract > (the provided specification, aka interface), it's properties (with > potential default values), … And then, you create instances out of 1 > component type (that is a de-facto factory): an instance being a simple > configuration (a dictionnary). > > So, in your benchmark, you should create only 3 PrimitiveComponentType: 1 > for artist, 1 for album and 1 for track. > Then, you'll have to create instances by providing a configuration with > instance specific values (like identifier, ...): > > http://felix.apache.org/ipojo/api/1.11.0/org/apache/felix/ipojo/api/ComponentType.html#createInstance(java.util.Dictionary) > > Thanks > —G > Le 25 juin 2014 à 12:05:29, Pierre De Rop ([email protected]) a > écrit: > > Hi Clement, > > I finally committed a stress test for dependency manager 4 in > > https://svn.apache.org/repos/asf/felix/sandbox/pderop/dependencymanager-prototype/ > > So, I included in it a scenario using iPojo, and it seems that registering > around 300 services seems to take an important amount of time, so you might > want to look into the scenario test. > > I hope I used the iPojo API correctly, I followed the documentation from > here: > > http://felix.apache.org/documentation/subprojects/apache-felix-ipojo/apache-felix-ipojo-userguide/apache-felix-ipojo-api.html#a-simple-example > ; > so if you have time to take a look, let me know if there is something wrong > with the test and I will correct it. > > The stress test is a subproject of dm and is located in > > http://svn.apache.org/viewvc/felix/sandbox/pderop/dependencymanager-prototype/org.apache.felix.dm.benchmark/ > > I haved added a README here: > > http://svn.apache.org/viewvc/felix/sandbox/pderop/dependencymanager-prototype/org.apache.felix.dm.benchmark/README?view=co > > And the code used to declare iPojo components (using the iPojo API) is > located here: > > > http://svn.apache.org/viewvc/felix/sandbox/pderop/dependencymanager-prototype/org.apache.felix.dm.benchmark/src/org/apache/felix/dm/benchmark/ipojo/IpojoScenario.java?revision=1605212&view=co > > hope this helps (and also that I used correctly the iPojo APi) > > cheers; > /Pierre > > > On Sun, Jun 22, 2014 at 10:36 AM, Clement Escoffier < > [email protected]> wrote: > > > Hi, > > > > > > On 22 juin 2014 at 00:14:26, Pierre De Rop ([email protected]) > wrote: > > > > Hello Clement, > > > > I'm also working on some benchmark related to dependency manager, > > declarative service, and after reading this post, I tried to incorporate > a > > scenario using iPojo in my benchmark. > > And it seems that I'm also observing a performance problem. > > > > I will try to commit somewhere my benchmark program soon in my sandbox, > > however, I just made a quick jvisualvm, and it looks like I'm spending 95 > > % > > of the time in the > > org.apache.felix.ipojo.IPojoFactory$RetryNameGenerator.generate method. > > > > > > That would make sense. This class is ensuring uniqueness, which is > > particularly expensive. It's something quite new, and for sure there are > > room for optimizations. > > > > Clement > > > > > > > > > > > > Here is a stacktrace, if this may help: > > > > "Thread-2" #30 prio=5 os_prio=0 tid=0x635f7c00 nid=0x47c1 runnable > > [0x62cfd000] > > java.lang.Thread.State: RUNNABLE > > at > > > > > org.apache.felix.ipojo.IPojoFactory$RetryNameGenerator.generate(IPojoFactory.java:1149) > > at > > > > > org.apache.felix.ipojo.IPojoFactory.createComponentInstance(IPojoFactory.java:302) > > - locked <0x67652198> (a > > java.util.Collections$SynchronizedRandomAccessList) > > - locked <0x95055f50> (a org.apache.felix.ipojo.ComponentFactory) > > at > > > > > org.apache.felix.ipojo.IPojoFactory.createComponentInstance(IPojoFactory.java:240) > > at > > > > > org.apache.felix.ipojo.api.ComponentType.createInstance(ComponentType.java:79) > > at > > > > > org.apache.felix.dm.benchmark.ipojo.IPojoActivator$$Lambda$108/3740909.apply(Unknown > > Source) > > at > > org.apache.felix.dm.benchmark.controller.Helper.lambda$1(Helper.java:85) > > at > > > > > org.apache.felix.dm.benchmark.controller.Helper$$Lambda$36/6147827.apply(Unknown > > Source) > > at > > java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:193) > > at > > > > > java.util.ArrayList$ArrayListSpliterator.forEachRemaining(ArrayList.java:1359) > > at > > java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:512) > > at > > > > > java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:502) > > at > > > java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:708) > > at > > java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234) > > at > > java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:499) > > at > > > > > org.apache.felix.dm.benchmark.ipojo.IPojoActivator.__M_start(IPojoActivator.java:96) > > at > > > > > org.apache.felix.dm.benchmark.ipojo.IPojoActivator.start(IPojoActivator.java) > > at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) > > at > > > > > sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) > > at > > > > > sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) > > at java.lang.reflect.Method.invoke(Method.java:483) > > at org.apache.felix.ipojo.util.Callback.call(Callback.java:237) > > at org.apache.felix.ipojo.util.Callback.call(Callback.java:193) > > at > > > > > org.apache.felix.ipojo.handlers.lifecycle.callback.LifecycleCallback.call(LifecycleCallback.java:86) > > at > > > > > org.apache.felix.ipojo.handlers.lifecycle.callback.LifecycleCallbackHandler.__M_stateChanged(LifecycleCallbackHandler.java:162) > > at > > > > > org.apache.felix.ipojo.handlers.lifecycle.callback.LifecycleCallbackHandler.stateChanged(LifecycleCallbackHandler.java) > > at > > org.apache.felix.ipojo.InstanceManager.setState(InstanceManager.java:560) > > at > > org.apache.felix.ipojo.InstanceManager.start(InstanceManager.java:440) > > at > > > > > org.apache.felix.ipojo.ComponentFactory.createInstance(ComponentFactory.java:179) > > at > > > > > org.apache.felix.ipojo.IPojoFactory.createComponentInstance(IPojoFactory.java:319) > > - locked <0x6e5340d0> (a org.apache.felix.ipojo.ComponentFactory) > > at > > > > > org.apache.felix.ipojo.IPojoFactory.createComponentInstance(IPojoFactory.java:240) > > at > > > > > org.apache.felix.ipojo.api.ComponentType.createInstance(ComponentType.java:79) > > at > > org.apache.felix.dm.benchmark.ipojo.Activator.start(Activator.java:31) > > at > > > > > org.apache.felix.framework.util.SecureAction.startActivator(SecureAction.java:645) > > at org.apache.felix.framework.Felix.activateBundle(Felix.java:2152) > > at org.apache.felix.framework.Felix.startBundle(Felix.java:2070) > > at org.apache.felix.framework.BundleImpl.start(BundleImpl.java:976) > > at org.apache.felix.framework.BundleImpl.start(BundleImpl.java:963) > > at > > > > > org.apache.felix.dm.benchmark.controller.impl.BenchmarkControllerImpl.startAndStop(BenchmarkControllerImpl.java:190) > > at > > > > > org.apache.felix.dm.benchmark.controller.impl.BenchmarkControllerImpl.lambda$17(BenchmarkControllerImpl.java:104) > > at > > > > > org.apache.felix.dm.benchmark.controller.impl.BenchmarkControllerImpl$$Lambda$17/24713481.run(Unknown > > Source) > > at > > > > > org.apache.felix.dm.benchmark.controller.impl.BenchmarkControllerImpl.durationOf(BenchmarkControllerImpl.java:229) > > at > > > > > org.apache.felix.dm.benchmark.controller.impl.BenchmarkControllerImpl.lambda$11(BenchmarkControllerImpl.java:104) > > at > > > > > org.apache.felix.dm.benchmark.controller.impl.BenchmarkControllerImpl$$Lambda$15/17116744.applyAsLong(Unknown > > Source) > > at java.util.stream.LongPipeline$2$1.accept(LongPipeline.java:214) > > at > > > > > java.util.stream.Streams$RangeLongSpliterator.forEachRemaining(Streams.java:235) > > at > > java.util.Spliterator$OfLong.forEachRemaining(Spliterator.java:757) > > at > > java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:512) > > at > > > > > java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:502) > > at > > java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:576) > > at > > > > > java.util.stream.AbstractPipeline.evaluateToArrayNode(AbstractPipeline.java:255) > > at java.util.stream.LongPipeline.toArray(LongPipeline.java:484) > > at > > > > > org.apache.felix.dm.benchmark.controller.impl.BenchmarkControllerImpl.lambda$2(BenchmarkControllerImpl.java:104) > > at > > > > > org.apache.felix.dm.benchmark.controller.impl.BenchmarkControllerImpl$$Lambda$14/9086622.accept(Unknown > > Source) > > at > > > > > org.apache.felix.dm.benchmark.controller.impl.BenchmarkControllerImpl.lambda$16(BenchmarkControllerImpl.java:169) > > at > > > > > org.apache.felix.dm.benchmark.controller.impl.BenchmarkControllerImpl$$Lambda$11/14120199.accept(Unknown > > Source) > > at java.util.Optional.ifPresent(Optional.java:159) > > at > > > > > org.apache.felix.dm.benchmark.controller.impl.BenchmarkControllerImpl.lambda$4(BenchmarkControllerImpl.java:168) > > at > > > > > org.apache.felix.dm.benchmark.controller.impl.BenchmarkControllerImpl$$Lambda$7/32522449.accept(Unknown > > Source) > > at > > > > > java.util.Spliterators$ArraySpliterator.forEachRemaining(Spliterators.java:948) > > at > > > > > java.util.stream.ReferencePipeline$Head.forEach(ReferencePipeline.java:580) > > at > > > > > org.apache.felix.dm.benchmark.controller.impl.BenchmarkControllerImpl.forEachScenarioBundle(BenchmarkControllerImpl.java:166) > > at > > > > > org.apache.felix.dm.benchmark.controller.impl.BenchmarkControllerImpl.run(BenchmarkControllerImpl.java:100) > > at java.lang.Thread.run(Thread.java:745) > > > > I'm using latest released ipojo + java8. > > > > > > (will do my best to commit the benchmark so you can take a look and check > > if my test is wrong or if there is really something to be verified > > somewhere in IPojo). > > > > > > > > cheers; > > /Pierre > > > > > > On Sat, Jun 21, 2014 at 9:49 AM, Clement Escoffier < > > [email protected]> wrote: > > > > > Hi, > > > > > > Thanks, > > > > > > I will have a look at it, and come back to you. > > > > > > Clement > > > On 21 juin 2014 at 09:21:46, Xander Uiterlinden ([email protected]) > > > wrote: > > > > > > Hi, > > > > > > A colleague of mine just pointed me at this discussion. I'm one of the > > two > > > persons that did the presentation on DM performance on the OSGi devcon. > > > > > > Regarding iPojo, we included it using the documentation on the site but > > are > > > not iPojo experts. I'd be happy to help in figuring out whether the > > results > > > are due to the tests or to the iPojo implementation itself. > > > > > > The code is at: > > > https://github.com/sandermak/osgi-dm-shootout/tree/master/benchmark > > > > > > Cheers, > > > > > > Xander > > > > > >

