axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Kasun Gajasinghe <kasu...@gmail.com>
Subject Re: Improving Axis2/Rampart performance.
Date Tue, 13 Jul 2010 08:59:56 GMT
Hello Devs,
One more iteration on Axis2 and CXF Profiles revealed an interesting point.
This is in the call tree, in the point which
"org.apache.xml.security.c14n.implementations.CanonicalizerBase"
class' canonicalizeSubTree() method calls to DOOM methods.
In that method, handleAttributesSubtree() calls DOOM's
ElementImpl.getAttributes() method. The Time spent on getAttributes()
has amounted to around 10% of total cpu time. When, I looked at the time
taken by the same method of CXF, it only used less than 1% of cpu time. So,
clearly there's something wrong in here.

I attached a screen shot to have a look at.
i went through the source of Axis2 and CXF. I pasted the method so, all of
you can have look. Please analyze them and suggest what we can do to remove
this overhead.

Thanks & Regards,
--KasunBG

=========================================================================
CXF:
/**
     * Retrieve all the Attributes as a set. Note that this API is inherited
     * from Node rather than specified on Element; in fact only Elements
will
     * ever have Attributes, but they want to allow folks to "blindly"
operate
     * on the tree as a set of Nodes.
     */
    public NamedNodeMap getAttributes() {

        if (needsSyncData()) {
            synchronizeData();
        }
        if (attributes == null) {
            attributes = new AttributeMap(this, null);
        }
        return attributes;

    } // getAttributes():NamedNodeMap


=========================================================================
Axis2:
 /** Returns the set of attributes of this node and the namespace
declarations available. */
    public NamedNodeMap getAttributes() {
        AttributeMap attributeMap = new AttributeMap(this);

        // Add the set of existing attrs
        for (int i = 0; i < this.attributes.getLength(); i++) {
            attributeMap.addItem((Attr) this.attributes.getItem(i));
        }

        // Add the NS declarations
        if (this.namespaces != null) {
            Iterator nsDecls = this.namespaces.keySet().iterator();
            while (nsDecls.hasNext()) {
                String prefix = (String) nsDecls.next();
                if (prefix != null && !"".equals(prefix)
                        && !prefix.equals(OMConstants.XMLNS_NS_PREFIX)) {
                    OMNamespace ns = (OMNamespace)
this.namespaces.get(prefix);
                    AttrImpl attr = new AttrImpl(this.ownerNode, prefix, ns
                            .getNamespaceURI(), this.factory);
                    attr.setOMNamespace(new NamespaceImpl(
                            OMConstants.XMLNS_NS_URI,
                            OMConstants.XMLNS_NS_PREFIX));
                    attributeMap.addItem(attr);
                }
            }

            // Set the default NS attr if any
            if (this.namespace != null
                    && (this.namespace.getPrefix() == null || ""
                    .equals(this.namespace.getPrefix()))
                    && this.namespace.getNamespaceURI() != null) {

                // check if the parent of this element has the same
namespace
                // as the default and if NOT add the attr
                boolean parentHasSameDefaultNS = this.parentNode != null &&
                        this.parentNode.getNamespaceURI() != null &&

 this.parentNode.getNamespaceURI().equals(this.getNamespaceURI()) &&
                        (this.parentNode.getPrefix() == null ||
                                this.parentNode.getPrefix().equals(""));

                if (!parentHasSameDefaultNS) {
                    AttrImpl attr = new AttrImpl(this.ownerNode, "xmlns",

this.namespace.getNamespaceURI(), this.factory);
                    attr.setOMNamespace(new NamespaceImpl(
                            OMConstants.XMLNS_NS_URI,
                            OMConstants.XMLNS_NS_PREFIX));
                    attributeMap.addItem(attr);
                }
            }
        }

        return attributeMap;
    }

=========================================================================

~~~*******'''''''''''''*******~~~
Kasun Gajasinghe,
University of Moratuwa,
Sri Lanka.
Blog: http://kasunbg.blogspot.com
Twitter: http://twitter.com/kasunbg


On Mon, Jul 12, 2010 at 9:25 PM, Kishanthan Thangarajah <
kshanth2101@gmail.com> wrote:

> On Mon, Jul 12, 2010 at 8:58 PM, Samisa Abeysinghe
> <samisa.abeysinghe@gmail.com> wrote:
> > Can you guys provide patches for these improvements?
>
> Ok, we will do.
>
> Thanks,
> Kishanthan.
> >
> > Thanks,
> > Samisa...
> >
> > On Mon, Jul 12, 2010 at 12:16 PM, Kishanthan Thangarajah
> > <kshanth2101@gmail.com> wrote:
> >>
> >> Hi All,
> >>
> >> We also did some changes in DOMUtil class. We combined the getName and
> >> getPrefix methods to one method. Because there were quite large calls
> >> to these methods which took quite large time. So by combining these
> >> methods to one and reducing the number of calls to the method, we were
> >> able to get some improvements in time values.
> >>
> >> Thanks,
> >> --
> >> Kishanthan.T
> >> University of Moratuwa.
> >> SriLanka.
> >>
> >> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: java-dev-unsubscribe@axis.apache.org
> >> For additional commands, e-mail: java-dev-help@axis.apache.org
> >>
> > Thanks,
> > Samisa...
> >
> > Samisa Abeysinghe
> > VP Engineering
> > WSO2 Inc.
> > http://wso2.com
> > http://wso2.org
> >
>
>
>
> --
> Kishanthan.T
> University of Moratuwa.
> SriLanka.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: java-dev-unsubscribe@axis.apache.org
> For additional commands, e-mail: java-dev-help@axis.apache.org
>
>

Mime
View raw message