• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Test Service Locator, Session Facade,...

 
Ranch Hand
Posts: 53
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello,
i've build a J2EE-app which has some patterns in it.
I would like to test the application with and without for instance the service locator. The gaol of this test is to know the difference in time, memory,...
Are there any good tools(free, easy to use) which can help me?
Thanks,
Roul
 
author
Posts: 11962
5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
For a free, simple (lacking "advanced" features such as CPU and memory profiling) performance testing tool, I guess Jakarta JMeter is the first choice.
However, I have to say I have a gut feeling that your two implementations won't differ too much in terms of performance...
 
roul ravashimka
Ranch Hand
Posts: 53
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Javaranchers,

thanks Lasse,
I've got the same feeling that the two implementations won't be too different in terms of performance, but i have to measure it...
The idea was the following: by using patterns, we often add layers of indirection. Or we add code.
This must have some influence, in some way: good or bad.
How can i measure these differences, althought they might be little ?
Could JUnit or Cactus be of any help?(I'm new to these tools...)
maybe optimizeit?
thanks,
Roul
 
author
Posts: 14112
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Roul Ravashimka:
I've got the same feeling that the two implementations won't be too different in terms of performance, but i have to measure it...


Why? Do you have a performance problem? What would you do with the data?
 
roul ravashimka
Ranch Hand
Posts: 53
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
No, i don't got a performance problem, but i have to convince some people about the use of patterns.
One of the questions their are going to ask is:"You add all these layers, what about that?".
So, I thought to do some test.
It is not for me, it is for them
i'm already convinced of the use of patterns...
 
Lasse Koskela
author
Posts: 11962
5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You might also want to try JUnitPerf for measuring the execution time of individual JUnit test methods.
 
Ilja Preuss
author
Posts: 14112
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Roul Ravashimka:
One of the questions their are going to ask is:"You add all these layers, what about that?".


A very important point is that those layers *improve* your ability to optimize the system. The decoupling provides injection points for things like more intelligent lookup strategies, using a faster thirdparty product (without having to change hundreds of classes), caching, distributed computing etc. pp.
A stronger coupled system with less layers would make optimizing the system much harder.
Of course there is some point where adding another layer doesn't give you enough benefit to make up for the costs. Most often it's much easier to remove a layer once it is identified as a bottleneck than to add it later when you need the flexibility, though.
 
roul ravashimka
Ranch Hand
Posts: 53
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thank you Ilja and Lasse,
When I perform the first method in my application, it takes a while. I've wrote out some times, and most of the time went to the service locator. But the second time you perform a method, the service locator didn't need so much time. Because of the caching.
It are thing like this, that i would like to measure.
But i'm wondering: could any of the tools, mentioned above, give me more information then when i simply write out some times.
The use of patterns is not always a time-question. It's like Ilja says.
 
Ilja Preuss
author
Posts: 14112
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Roul Ravashimka:
When I perform the first method in my application, it takes a while. I've wrote out some times, and most of the time went to the service locator. But the second time you perform a method, the service locator didn't need so much time. Because of the caching.


You need also to take into account that the HotSpot enginge needs some time to become effective - espially if you run it using the -server option. HotSpot will spend the first period analyzing the runtime behaviour of the system, and only after some while will it begin to apply optimizations, such as inlining method calls etc.
 
roul ravashimka
Ranch Hand
Posts: 53
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
could a profiler be used for this problem?
Thanks
By mistake, i clicked on new post instead of post reply. Sorry.
Maybe a moderator could delete that post.
Roul
 
Lasse Koskela
author
Posts: 11962
5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

could a profiler be used for this problem?


Sure.

By mistake, i clicked on new post instead of post reply. Sorry.
Maybe a moderator could delete that post.


Done.
 
roul ravashimka
Ranch Hand
Posts: 53
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Sure.


thanks lasse
i can see there are about 50.000 instances created on startup, this number falls back to 17.000 and goes further down until it levels out.
also which instance creates another and the used memory.
Can it also see when the instances create each other?
 
Lasse Koskela
author
Posts: 11962
5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by roul ravashimka:
Can it also see when the instances create each other?

I can't say. You should probably check the features from your selected profiler product's documentation.
 
roul ravashimka
Ranch Hand
Posts: 53
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks Lasse,
suppose you're in a certain project where patterns are used.

Would you think it's reasonable of doing tests of the patterns?
Such as memory, time, ...
I would rather look at the components around the patterns. By adding patterns, layers are added. Does this have a negative influence? I'ld say no.
Suppose you've got a compex system of EJB's, you could use some facades to loose the view to the complex subsystem and you add a layer.
What is more important, the nagetive side of adding a facade(adding a layer, code,...), or something possitive which hide a complex subsystem?
I'ld say the possitive: get lost of the complex subsystem.
What do you think?
Roul
 
Lasse Koskela
author
Posts: 11962
5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Would you think it's reasonable of doing tests of the patterns?
Such as memory, time, ...

Generally speaking, most patterns don't have a noticeable effect on performance. Some do, but most don't.
I probably wouldn't test the performance of a component unless there's a stringent requirement for some operation completing within X milliseconds, for example, or unless the component was implemented with a structure that is known to trade readability for performance (i.e. "it's a lot nicer this way, but since I'm now making a separate SQL query for each blah blah blah, I'd better test whether this degrades performance too much").

I would rather look at the components around the patterns. By adding patterns, layers are added. Does this have a negative influence? I'ld say no.

As long as you add those layers as plain old Java objects (instead of, say, network calls), there shouldn't be much influence.

Suppose you've got a compex system of EJB's, you could use some facades to loose the view to the complex subsystem and you add a layer.
What is more important, the nagetive side of adding a facade(adding a layer, code,...), or something possitive which hide a complex subsystem?
I'ld say the possitive: get lost of the complex subsystem.


In majority of cases, I would probably say that the less complex alternative is better. Then again, your example of a Facade is actually doing both -- simplifying the interface to your component and improving performance (less network calls as the interface's granularity increases).
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic