Return-Path: X-Original-To: apmail-tomcat-users-archive@www.apache.org Delivered-To: apmail-tomcat-users-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 64BAE18291 for ; Thu, 8 Oct 2015 13:24:19 +0000 (UTC) Received: (qmail 67892 invoked by uid 500); 8 Oct 2015 13:24:09 -0000 Delivered-To: apmail-tomcat-users-archive@tomcat.apache.org Received: (qmail 67840 invoked by uid 500); 8 Oct 2015 13:24:08 -0000 Mailing-List: contact users-help@tomcat.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: "Tomcat Users List" Delivered-To: mailing list users@tomcat.apache.org Received: (qmail 67829 invoked by uid 99); 8 Oct 2015 13:24:08 -0000 Received: from Unknown (HELO spamd3-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 08 Oct 2015 13:24:08 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd3-us-west.apache.org (ASF Mail Server at spamd3-us-west.apache.org) with ESMTP id 673C3180E1A for ; Thu, 8 Oct 2015 13:24:08 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd3-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: -0.121 X-Spam-Level: X-Spam-Status: No, score=-0.121 tagged_above=-999 required=6.31 tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, SPF_PASS=-0.001] autolearn=disabled Authentication-Results: spamd3-us-west.apache.org (amavisd-new); dkim=pass (2048-bit key) header.d=gmail.com Received: from mx1-eu-west.apache.org ([10.40.0.8]) by localhost (spamd3-us-west.apache.org [10.40.0.10]) (amavisd-new, port 10024) with ESMTP id hvDPMnRXDIKQ for ; Thu, 8 Oct 2015 13:24:07 +0000 (UTC) Received: from mail-lb0-f180.google.com (mail-lb0-f180.google.com [209.85.217.180]) by mx1-eu-west.apache.org (ASF Mail Server at mx1-eu-west.apache.org) with ESMTPS id EC239201F9 for ; Thu, 8 Oct 2015 13:24:06 +0000 (UTC) Received: by lbcao8 with SMTP id ao8so47273055lbc.3 for ; Thu, 08 Oct 2015 06:24:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; bh=hmiDAOhS3xrvwA44pHws/JXqotsw1sQLChsQ2uZ/n5k=; b=g8FTitPcz+Vg0cuFed/XS5k9bHGVegUEFgwtVjN8/XOCz21Y+OG2EWzFr1VQvZGVRh HqTe9FOTpXshCKG7kgS5BKlh35RkJM8xK0S7pE+AMExqIJx9KTZfKRkWHivE1ZhBMYD9 OiwdrIkAN5icydQoAUnA16ukC6cIn6wursBMSDnPwiWunAXS6iiOoOtI+rlBXIJZeQzH pjWkqITS1X0h7XLlBiDJxlUmVSQzYe75fGT8wyb1/+0FRS0Yj05vnjmt+1ymTZWa8RlK 264gTOd2Z2R5NXezd/lu5EpWFPQW8OVW7WGgB4t1W0MtOe8iAFC92jum5uu5QKOXBPPw AzBA== MIME-Version: 1.0 X-Received: by 10.25.167.84 with SMTP id q81mr2446365lfe.124.1444310646437; Thu, 08 Oct 2015 06:24:06 -0700 (PDT) Received: by 10.114.65.3 with HTTP; Thu, 8 Oct 2015 06:24:06 -0700 (PDT) In-Reply-To: <56165846.8060407@apache.org> References: <56165846.8060407@apache.org> Date: Thu, 8 Oct 2015 15:24:06 +0200 Message-ID: Subject: Re: Another attempt at discussing the major performance issue in Tomcat 8 JSP From: sebdotv To: Tomcat Users List Content-Type: text/plain; charset=UTF-8 Mark, thanks for your quick and detailed answer. > Hmm. With 9.0.x trunk there are 4 calls, not 12 to loadClass. One (not > three) for each package. I can't immediately think of any reason why > 8.0.x would make additional calls. Having checked, it doesn't. 8.0.x > makes 4 calls just like 9.0.x. I don't see anything that would have > changed this since 8.0.27. You're right, I was counting recursive calls in the classloader. 1 call is indeed made per package, so here 4 calls per undefined attribute. > Regardless of whether there are 4 or 12 calls, I agree the performance > impact is going to be significant. The time is mostly spent constructing > the ClassNotFoundException. Annoyingly, this is then thrown away. As set > out in [1], there is a work-around but that comes with its own > performance impact and it is currently the view that we don't want to > slow down valid lookups to make invalid lookups faster. Not that it matters much at this point, but I am not seeing so much of the time constructing the exception. A good part of the time is spent blocking on WebappClassLoader, unless ParallelWebappClassLoader is used. Then the loading of a class means searching for it everywhere on the classpath, which takes time (IO). Of course classloaders should not be used in vain, especially not repeatedly. > > - if everything is conform with the spec, a more aggressive cache should > > probably be implemented and used by ImportHandler > > That is a lot easier said than done. > - A new ImportHandler instance is required for every page request > - Each page can have a different set of imports > - ImportHandler is spec class used by multiple web applications each of > which will have a different set of classes available > - The cache needs to be thread safe > - The cache needs to be self-limiting in size Not knowing anything about the internals of Tomcat, but what about something like a concurrent hashmap with weak keys (classloader + name) and values (class), used in ImportHandler.findClass? Do you foresee issues with something along these lines? Sebastien --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org For additional commands, e-mail: users-help@tomcat.apache.org