Return-Path: X-Original-To: apmail-river-dev-archive@www.apache.org Delivered-To: apmail-river-dev-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id A3480182E0 for ; Fri, 4 Dec 2015 14:19:39 +0000 (UTC) Received: (qmail 34043 invoked by uid 500); 4 Dec 2015 14:19:39 -0000 Delivered-To: apmail-river-dev-archive@river.apache.org Received: (qmail 34010 invoked by uid 500); 4 Dec 2015 14:19:39 -0000 Mailing-List: contact dev-help@river.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@river.apache.org Delivered-To: mailing list dev@river.apache.org Received: (qmail 33997 invoked by uid 99); 4 Dec 2015 14:19:39 -0000 Received: from Unknown (HELO spamd1-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 04 Dec 2015 14:19:39 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd1-us-west.apache.org (ASF Mail Server at spamd1-us-west.apache.org) with ESMTP id B7A5BCCD5F for ; Fri, 4 Dec 2015 14:19:38 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd1-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: -0.01 X-Spam-Level: X-Spam-Status: No, score=-0.01 tagged_above=-999 required=6.31 tests=[SPF_PASS=-0.001, T_RP_MATCHES_RCVD=-0.01, URIBL_BLOCKED=0.001] autolearn=disabled Received: from mx1-us-west.apache.org ([10.40.0.8]) by localhost (spamd1-us-west.apache.org [10.40.0.7]) (amavisd-new, port 10024) with ESMTP id FeNf8G89uA44 for ; Fri, 4 Dec 2015 14:19:29 +0000 (UTC) Received: from eastrmfepo202.cox.net (eastrmfepo202.cox.net [68.230.241.217]) by mx1-us-west.apache.org (ASF Mail Server at mx1-us-west.apache.org) with ESMTP id A0A6420CF5 for ; Fri, 4 Dec 2015 14:19:28 +0000 (UTC) Received: from eastrmimpo210 ([68.230.241.225]) by eastrmfepo202.cox.net (InterMail vM.8.01.05.15 201-2260-151-145-20131218) with ESMTP id <20151204141921.NOQZ21150.eastrmfepo202.cox.net@eastrmimpo210> for ; Fri, 4 Dec 2015 09:19:21 -0500 Received: from [172.22.3.8] ([91.140.235.158]) by eastrmimpo210 with cox id pSKH1r00D3RjhPf01SKLDF; Fri, 04 Dec 2015 09:19:21 -0500 X-CT-Class: Clean X-CT-Score: 0.00 X-CT-RefID: str=0001.0A020206.5661A0E9.01DC,ss=1,re=0.000,fgs=0 X-CT-Spam: 0 X-Authority-Analysis: v=2.0 cv=UdOPvtuN c=1 sm=1 a=gaabasfxUCjC5o7HHt4rcg==:17 a=kviXuzpPAAAA:8 a=XczjXgE3AAAA:8 a=0LiwH3idAAAA:8 a=H1f19xh_enmx4KBGs18A:9 a=QEXdDO2ut3YA:10 a=gaabasfxUCjC5o7HHt4rcg==:117 X-CM-Score: 0.00 Authentication-Results: cox.net; auth=pass (PLAIN) smtp.auth=gergg@cox.net From: Gregg Wonderly Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Mime-Version: 1.0 (1.0) Subject: Re: Trunk merge and thread pools Message-Id: <99AD94A3-A291-4578-910C-46A4347FAA7C@cox.net> Date: Fri, 4 Dec 2015 17:19:16 +0300 References: <2047eea34872978cb38898ac3c19ebe2@org.tizen.email> In-Reply-To: To: dev@river.apache.org X-Mailer: iPhone Mail (13B143) With a handful of clients, you can ignore contention. My applications have 2= 0s of threads per client making very frequent calls through the service and t= his means that 10ms delays evolve into seconds of delay fairly quickly. =20 I believe that if you can measure the contention with tooling, on your deskt= op, it is a viable goal to reduce it or eliminate it. =20 It's like system time vs user time optimizations of old. Now we are contend= ing for processor cores instead of the processor, locked in the kernel, unab= le to dispatch more network traffic where it is always convenient to bury la= tency. Gregg Sent from my iPhone On Dec 4, 2015, at 9:57 AM, Greg Trasuk wrote: >> On Dec 4, 2015, at 1:16 AM, Peter wrote: >>=20 >> Since ObjectInputStream is a big hotspot, for testing purposes, I merged= these changes into my local version of River, my validating ObjectInputStr= eam outperforms the standard java ois >>=20 >> Then TaskManager, used by the test became a problem, with tasks in conten= tion up to 30% of the time. >>=20 >> Next I replaced TaskManager with an ExecutorService (River 3, only uses T= askManager in tests now, it's no longer used by release code), but there was= still contention although not quite as bad. >>=20 >> Then I notice that tasks in the test call Thread.yield(), which tends to t= hrash, so I replaced it with a short sleep of 100ms. >>=20 >> Now monitor state was a maximum of 5%, much better. >>=20 >> After these changes, the hotspot consuming 27% cpu was JERI's ConnectionM= anager.connect, followed by Class.getDeclaredMethod at 15.5%, Socket.accept= 14.4% and Class.newInstance at 10.8%. >=20 >=20 > First - performance optimization: Unless you=E2=80=99re testing with real= -life workloads, in real-ife-like network environments, you=E2=80=99re wasti= ng your time. In the real world, clients discover services pretty rarely, a= nd real-world architects always make sure that communications time is small c= ompared to processing time. In the real world, remote call latency is contr= olled by network bandwidth and the speed of light. Running in the integrati= on test environment, you=E2=80=99re seeing processor loads, not network load= s. There isn=E2=80=99t any need for this kind of micro-optimization. All y= ou=E2=80=99re doing is delaying shipping, no matter how wonderful you keep t= elling us it is. >=20 >=20 >> My validating ois, originating from apache harmony, was modified to use e= xplicit constructors during deserialization. This addressed finalizer attac= ks, final field immutability and input stream validation and the ois itself p= laces a limit on downloaded bytes by controlling