Skip to main content

Interface performance

3 replies [Last post]
largowinch
Offline
Joined: 2008-09-12
Points: 0

Hello,

I'm new in the world of java and I have a question to try to understand my observations.

A few years ago, I wrote a Transaction Monitor for Unix based on XATMI specifications. This is working fine. Recently we wanted to access the services deployed in the legacy system from an application server. So, I developed a JCA connector. This connector is now very stable and quite fast :-)

Last month we went to a benchmark center to stress our new architecture. We had some performance issues in the java part but nothing very hard to solve. We used the jProfiler tool to profile the application.

Looking into the JCA connector statistics, I found something strange I didn't understand: jProfile shows where the application spends time and it's possible to drill down to see the cause. Here is a small fragment of jProfile report:

|-1,6% - 22.111ms - 4.902.679 inv. - javax.resource.cci.MappedRecord.put
| |- 1,0% - 13.833 ms - 4.902.679 inv. - eu.tsdjca.TSDRecord.put
| | |- 0,4% - 5.530 ms - 4.902.679 inv. - java.util.Map.put

My JCA connector uses a MappedRecord to pass argument to the execute method. This MappedRecord (http://java.sun.com/javaee/5/docs/api/javax/resource/cci/MappedRecord.html) is just an interface. The implementation of the interface is TSDRecord which does inly a "HashMap.put()":

public class TSDRecord implements MappedRecord
{
...
public Object put(Object key, Object value)
{
return hash.put((String) key, (String) value);
}
...
}

So my question is: "Why is it so much time wasted in "javax.resource.cci.MappedRecord.put" and in "eu.tsdjca.TSDRecord.put". Those methods do nothing !! All the work is done in HashMap.put() which is quite fast...

Thanks for your replies.
Pierre

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
linuxhippy
Offline
Joined: 2004-01-07
Points: 0

My guess is that your results come from the fact that the profiler itself imposes some overhead and maybe disabled some features like inlining of de-virtualization of methods.
In my opinion the profiler can just give indications where things don't work as expected, but its never very accurat.

So I would not care about about that trace ;)

lg Clemens

largowinch
Offline
Joined: 2008-09-12
Points: 0

Thanks for your reply.

I made the same assumption but I'm still surprise to see so much time spent in the interface. I can understand that the profile is consuming time itself and this must be accounted somewhere.
For your information, I tried to use directly a HashMap without the interface, and I won 2% in performance! Quite strange...

Regards,
Pierre

linuxhippy
Offline
Joined: 2004-01-07
Points: 0

> For your information, I tried to use directly a
> HashMap without the interface, and I won 2% in
> performance! Quite strange...

Quite interesting! With the profiler attached, or also in production?

lg Clemens