Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id 2BABD200C84 for ; Mon, 29 May 2017 16:19:20 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id 2A4B5160BCE; Mon, 29 May 2017 14:19:20 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id 4AFE3160BC2 for ; Mon, 29 May 2017 16:19:19 +0200 (CEST) Received: (qmail 49899 invoked by uid 500); 29 May 2017 14:19:18 -0000 Mailing-List: contact dev-help@camel.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@camel.apache.org Delivered-To: mailing list dev@camel.apache.org Received: (qmail 49887 invoked by uid 99); 29 May 2017 14:19:18 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd2-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 29 May 2017 14:19:18 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd2-us-west.apache.org (ASF Mail Server at spamd2-us-west.apache.org) with ESMTP id B22B91A061E for ; Mon, 29 May 2017 14:19:17 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd2-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_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, SPF_PASS=-0.001] autolearn=disabled Authentication-Results: spamd2-us-west.apache.org (amavisd-new); dkim=pass (2048-bit key) header.d=gmail.com Received: from mx1-lw-us.apache.org ([10.40.0.8]) by localhost (spamd2-us-west.apache.org [10.40.0.9]) (amavisd-new, port 10024) with ESMTP id hLfKzJMk0res for ; Mon, 29 May 2017 14:19:16 +0000 (UTC) Received: from mail-qk0-f179.google.com (mail-qk0-f179.google.com [209.85.220.179]) by mx1-lw-us.apache.org (ASF Mail Server at mx1-lw-us.apache.org) with ESMTPS id 04B445F523 for ; Mon, 29 May 2017 14:19:16 +0000 (UTC) Received: by mail-qk0-f179.google.com with SMTP id y201so49038780qka.0 for ; Mon, 29 May 2017 07:19:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to; bh=gX2J190a59tyzhW2RvTYCl1ltqeAmU0f7H6QF6lfcmA=; b=R8K7VHMujxlyPCZMEh0LNKyo4VqqI1VKPZHAUVSzge/TBDwW9lcIxI46KTmi70936B f4dvvLX8gq6YoTvpJfX8/nqkAhUBCdEU2eRHYZYS0V6191lhpRdTx+YItiNe7WOnH03W OpdCw5d+w78Yz5VFzQNH2X3VOVRS4h5qq3nXS/K0kLtjQnTvdpsOx6XAoVH/9MWzL9dQ R67NvPnHdM0w5LEQ8HH+8XIjJn+p7kJDg5hzeUjmfUvjWgIruIr3vhEDkP7P3zbATMTQ DJ6oOlsPR+NBllUl6ykICoYLG/1wTbmKeiImx+6Us5Tt0kGKTwtB2ElGsYAJGwqsUiG6 iZZA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to; bh=gX2J190a59tyzhW2RvTYCl1ltqeAmU0f7H6QF6lfcmA=; b=JTFmMqG+IuceLN/d/NMi9Ov4/eNPYmW+z8Jn1WkRxWcuCXFIqJSuq2NAZ4IED48KUZ zOeJIQBkrVPHk7cMbkAlLAauNEiktJfN+a9byAOtNOxw+pGRz4pa2gI7MwEyu+5kEON6 E7SYeWVeevuSiDuCyOxFIF2o+SsBFYT91E9diWLKm8ApK6gj0kxFQBJ52GKmqjTcWeKx 3hToGcn+R3b77ahXiC8XWOK5AQYwMBENCzuvt3kpe8qoGZXTPPR3OJS3ccRfyiu0qdmC 4T1dYvyfgMupJJjK/6KQNmEHxkxeVINCJATyBvPE+/Sfaks6KzS85cbV/w5LIVpb8CsL ziWw== X-Gm-Message-State: AODbwcBNi3uxCEyNQsIjSJOyWyWYAZ7PkOS3J2Eo3jaAwitv0JaIYU4c PRMmYoMMJcoO/fFLA1//8U4VTzhztZq0 X-Received: by 10.55.132.196 with SMTP id g187mr17339936qkd.12.1496067555402; Mon, 29 May 2017 07:19:15 -0700 (PDT) MIME-Version: 1.0 Received: by 10.200.50.58 with HTTP; Mon, 29 May 2017 07:18:55 -0700 (PDT) In-Reply-To: References: From: Claus Ibsen Date: Mon, 29 May 2017 16:18:55 +0200 Message-ID: Subject: Re: [HELP] - Profile camel-core for optimization and faster startup To: dev Content-Type: text/plain; charset="UTF-8" archived-at: Mon, 29 May 2017 14:19:20 -0000 On Mon, May 29, 2017 at 7:30 AM, Luca Burgazzoli wrote: > It may be worth adding a small number of JMH micro benchmarks - not to > be used as performances metrics - on camel core so we can spot > potential regressions. > Yeah we can try that. > --- > Luca Burgazzoli > > > On Sun, May 28, 2017 at 11:31 AM, Claus Ibsen wrote: >> Hi >> >> I have found some more spots for optimisations which I have committed >> over the last couple of days. >> >> Its been several years since we last did such things last, and I have >> to admit we have introduced some code that add more object allocation >> and a few performance drawbacks since then. >> >> So with the help of profilers we should be able to improve the >> situation for the Camel 2.20 release. >> >> I have to give credit to Luca for bring this idea up about making >> Camel startup faster and look into the number of objects allocated >> etc. Usually Camel has negligible performance overhead in the grand >> scheme of things. But we have more fine grained performance statistics >> today which records the time taken in every step messages are routed. >> This uses the StopWatch object which we frankly create too many new >> instances. So by reducing those we can reduce the object allocations >> and therefore the JVM GC characteristics. >> >> In the stuff I have optimised you can find the JIRA tickets with >> Optimise as prefix. I usually have attached some screenshots from the >> profiler so you can see before vs after situations). >> >> >> We have two areas that can be improved >> >> 1) startup Camel faster (jndi registry, caffine lru cache, and the >> uuid generator is a bit slow in their constructors) >> 2) faster routing per message at runtime (potential optimise by >> reducing object allocations, turn off some features less/seldom in >> use, optimise code logic in hot-spot areas, reduce size of internal >> state objects, avoid thread contention from synchronized methods, >> etc.) >> >> >> >> On Fri, May 26, 2017 at 3:59 PM, Claus Ibsen wrote: >>> Hi >>> >>> We have found a few spots to optimize the camel-core source code for >>> thread contention and something else. >>> >>> You can use a profile tool such as YourKit which is excellent at >>> identifying spots and visualizing what goes on in the JVM. >>> >>> We have used it in the past to optimise stuff. However recently Luca >>> asked about making Camel startup faster: >>> https://issues.apache.org/jira/browse/CAMEL-11321 >>> >>> And although fast startup is not excatly the same as runtime >>> performance then they are still related. A profile can help identify >>> places for improvements. >>> >>> I have pushed a sample project at >>> https://github.com/davsclaus/camel-profile-sample >>> >>> You can then run this via >>> >>> mvn spring-boot:run >>> >>> And then attach YourKit profiler. >>> >>> However if you use IDEA then you can start YourKit, then from YourKit >>> you can choose Integrate with IDE ... and then chose IDEA and then say >>> ok even if IDEA is also running. >>> >>> In IDEA you should see a YourKit icon if you right-click on the >>> SampleCamelApplication to run this application, then you can chose >>> that to profile, and it run the app with profiler. >>> >>> You then switch to YourKit and you should start see data. >>> To check for thread contention, then select the "Monitor Usage" tab, >>> and then click the gear button with the play icon "Start Monitor >>> Profile" which then starts capture data. >>> >>> For YourKit you can request a trial license that works for 2 weeks. >>> >>> >>> -- >>> Claus Ibsen >>> ----------------- >>> http://davsclaus.com @davsclaus >>> Camel in Action 2: https://www.manning.com/ibsen2 >> >> >> >> -- >> Claus Ibsen >> ----------------- >> http://davsclaus.com @davsclaus >> Camel in Action 2: https://www.manning.com/ibsen2 -- Claus Ibsen ----------------- http://davsclaus.com @davsclaus Camel in Action 2: https://www.manning.com/ibsen2