Blueprint OSGi proxy call overhead [message #660536] |
Fri, 18 March 2011 19:16  |
Eclipse User |
|
|
|
Hi I am wondering if there is a way to 'turn down' the overhead being imposed by imported OSGi services, ie using Spring DM 2.0.0.M1 I compared the overhead of calling an object defined in the local Spring containter versus one imported from another bundle via the service registry and found the following:
-Callstack from the imported bundle is 23 function calls deep
-Avg function call time from a direct Spring reference: 6.5ns
-Avg function call time from a Spring proxied service registry reference: 352.3ns
-Ratio: 54:1
I'd really like to break my application up into more pieces and be more dynamic, however I can't put anything that gets called with any kind of frequency across this divide given the current performance hit. Is there a fix for this, or any plans to address this issue? I realize I didn't test the Blueprint milestone release yet, but I figured someone here could weigh in on if anything has changed between DM2 and this release.
Thanks,
David
|
|
|
|
|
Re: Blueprint OSGi proxy call overhead [message #660545 is a reply to message #660542] |
Fri, 18 March 2011 23:40   |
Eclipse User |
|
|
|
Hi Dmitry-
The methodology is pretty simple, the test harness calls a function on an object that just increments its integer argument. This function is called via an instance created and wired inside the same container, and an instance that is created inside another bundle's container, published to the service registry, and consumed by a service reference from the test harness. The test harness starts the clock, calls the function 1000 times, then stops the clock. It then repeats the procedure 1000 times to get an average time it took to run the function 1000 times, then divides that average by 1000 to get an average execution time for the function.
The code is a bit messy, I threw it together just for the benchmark. You can increase the loops or initial calls, although it may overflow the long accumulator, and you'll have to use BigInteger/Decimal which I was lazy and didn't feel like doing. You can grab the code here: http://yuba.stanford.edu/~derickso/functionTest.tgz
Oh and to measure the call depth I just set a break point where the harness begins calling the osgi proxied object, then put a break point in the proxied object and hit play, when it broke I counted the stack between the two objects.
[Updated on: Fri, 18 March 2011 23:42] by Moderator
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.03779 seconds