Return-Path: Delivered-To: apmail-axis-java-dev-archive@www.apache.org Received: (qmail 66999 invoked from network); 10 Nov 2010 08:30:15 -0000 Received: from unknown (HELO mail.apache.org) (140.211.11.3) by 140.211.11.9 with SMTP; 10 Nov 2010 08:30:15 -0000 Received: (qmail 64944 invoked by uid 500); 10 Nov 2010 08:30:46 -0000 Delivered-To: apmail-axis-java-dev-archive@axis.apache.org Received: (qmail 64382 invoked by uid 500); 10 Nov 2010 08:30:43 -0000 Mailing-List: contact java-dev-help@axis.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: java-dev@axis.apache.org Delivered-To: mailing list java-dev@axis.apache.org Received: (qmail 64363 invoked by uid 99); 10 Nov 2010 08:30:42 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 10 Nov 2010 08:30:42 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.22] (HELO thor.apache.org) (140.211.11.22) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 10 Nov 2010 08:30:40 +0000 Received: from thor (localhost [127.0.0.1]) by thor.apache.org (8.13.8+Sun/8.13.8) with ESMTP id oAA8UIME027297 for ; Wed, 10 Nov 2010 08:30:18 GMT Message-ID: <27598519.3881289377818461.JavaMail.jira@thor> Date: Wed, 10 Nov 2010 03:30:18 -0500 (EST) From: "Dan Armstrong (JIRA)" To: java-dev@axis.apache.org Subject: [jira] Updated: (AXIS2-4878) Simple BeanInfo cache in BeanUtil.java helped us go from 48 second to 8 second request In-Reply-To: <9336147.3461289375533707.JavaMail.jira@thor> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 X-Virus-Checked: Checked by ClamAV on apache.org [ https://issues.apache.org/jira/browse/AXIS2-4878?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Dan Armstrong updated AXIS2-4878: --------------------------------- Summary: Simple BeanInfo cache in BeanUtil.java helped us go from 48 second to 8 second request (was: Simple BeanInfo cache in BeanUtil.java helped as go from 48 second to 8 second request) > Simple BeanInfo cache in BeanUtil.java helped us go from 48 second to 8 second request > -------------------------------------------------------------------------------------- > > Key: AXIS2-4878 > URL: https://issues.apache.org/jira/browse/AXIS2-4878 > Project: Axis2 > Issue Type: Improvement > Components: adb > Affects Versions: 1.5.2 > Environment: Linux (Debian Lenny x86_64), JDK 1.6.0, Tomcat 6 (in NetBeans 6.5.1). Deployed POJO service as .aar file. > Reporter: Dan Armstrong > Original Estimate: 0.25h > Remaining Estimate: 0.25h > > We return arrays of complex objects - all of the same type for any particular web services call. Axis2 was unusably slow. Upon closer inspection, it was spending much of its time in BeanUtil. The #1 problem is that it is performing introspection repeatedly for each and every object. Introspection is very expensive - calling the methods once you find them is cheap. > The solution is to perform the introspection and cache the results. I added a few lines of code to BeanUtil.java and brought our request from 48 seconds down to 8. This solution may not be exactly how you would implement it, but the idea is sound and the results are very impressive: > import java.util.concurrent.*; > private static final ConcurrentMap,BeanInfo> beanInfoCache = new ConcurrentHashMap,BeanInfo>(); > // About line 140, where calls Introspector.getBeanInfo: > BeanInfo beanInfo = beanInfoCache.get(beanClass); > if(beanInfo==null) beanInfoCache.put(beanClass, beanInfo = Introspector.getBeanInfo(beanClass, beanClass.getSuperclass())); > The map would probably need to use weak references to not prevent class unloading. And you may not want to depend on the Java 5 generics and concurrent collections. But the point remains - without this POJO is too slow (rhyme intended). > Please add this to the Axis2 to benefit others. > Thank you, > Dan Armstrong > AO Industries, Inc. -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online. --------------------------------------------------------------------- To unsubscribe, e-mail: java-dev-unsubscribe@axis.apache.org For additional commands, e-mail: java-dev-help@axis.apache.org