Return-Path: X-Original-To: apmail-activemq-users-archive@www.apache.org Delivered-To: apmail-activemq-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 08FA77D8A for ; Sat, 19 Nov 2011 15:35:48 +0000 (UTC) Received: (qmail 4048 invoked by uid 500); 19 Nov 2011 15:35:47 -0000 Delivered-To: apmail-activemq-users-archive@activemq.apache.org Received: (qmail 4013 invoked by uid 500); 19 Nov 2011 15:35:47 -0000 Mailing-List: contact users-help@activemq.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: users@activemq.apache.org Delivered-To: mailing list users@activemq.apache.org Received: (qmail 4005 invoked by uid 99); 19 Nov 2011 15:35:47 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 19 Nov 2011 15:35:47 +0000 X-ASF-Spam-Status: No, hits=2.2 required=5.0 tests=HTML_MESSAGE,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of suonayi2006@163.com designates 220.181.13.34 as permitted sender) Received: from [220.181.13.34] (HELO m13-34.163.com) (220.181.13.34) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 19 Nov 2011 15:35:40 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=163.com; s=s110527; h=Received:Date:From:To:Message-ID:In-Reply-To: References:Subject:MIME-Version:Content-Type; bh=TDrVHvWS5glWK6y FlBvCnkLkIgHYLY1EwSBgsBWy7Vw=; b=DLMwOYnjk57JDdrrnkA4aK8KGCIrVcR iXHIut2C1PGSkQvfCKwOnFCAZd6NtW5XagQmSMEbeMO5CdUyaFTK8dQv9P+vK3Q4 LSgkgY6Aie8Wz5BHrcnYknnT/SYkvi0bOQ5JfgNO7FCeDHzdCa0Q/tFOY/rA8Qhd JmsE72/PxYg0= Received: from suonayi2006 ( [111.196.56.170] ) by ajax-webmail-wmsvr34 (Coremail) ; Sat, 19 Nov 2011 23:35:10 +0800 (CST) Date: Sat, 19 Nov 2011 23:35:10 +0800 (CST) From: SuoNayi To: users@activemq.apache.org Message-ID: <213c894b.6401.133bc77892e.Coremail.suonayi2006@163.com> In-Reply-To: References: <3D423F21-3240-42A5-B883-A433A6C7D1C7@planet57.com> Subject: Reply:Re: Overhead of component creation to send message MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_Part_170968_603112941.1321716910382" X-Originating-IP: [111.196.56.170] X-Priority: 3 X-Mailer: Coremail Webmail Server Version SP_ntes V3.5 build 111110(15680.4167.4075) Copyright (c) 2002-2011 www.mailtech.cn 163com X-CM-CTRLDATA: In/6JWZvb3Rlcl9odG09NDc0MDo4MQ== X-CM-TRANSID: IsGowGBZA0WuzMdO9JYkAA--.20074W X-CM-SenderInfo: xvxr0td1lsiiqw6rljoofrz/xtbBEhX8GkZf9WmqkwADse X-Coremail-Antispam: 1U5529EdanIXcx71UUUUU7vcSsGvfC2KfnxnUU== X-Virus-Checked: Checked by ClamAV on apache.org ------=_Part_170968_603112941.1321716910382 Content-Type: text/plain; charset=GBK Content-Transfer-Encoding: 7bit With JmsTemplate, it's suffering to create and destory the underlying resource with any call on it, so from Spring 2.5.3,CachingConnectionFactory is introduced with new features such as caching connection,session,consumer and producer resouce.So donot be afraid of JmsTemplate anymore. At 2011-11-18 18:27:40,"Dejan Bosanac" wrote: >Hi Jason, > >those operations are costly and if your component must open/close it for >every message it will affect performances. In those cases it is recommended >to use pool connection factory which caches those object and improve >performances. > >See http://activemq.apache.org/jmstemplate-gotchas.html for some more info >on this topic (in case of Spring) > >Regards >-- >Dejan Bosanac - http://twitter.com/dejanb >----------------- >The experts in open source integration and messaging - http://fusesource.com >ActiveMQ in Action - http://www.manning.com/snyder/ >Blog - http://www.nighttale.net > > >On Fri, Nov 18, 2011 at 1:30 AM, Jason Dillon wrote: > >> I'm wondering what sort of overhead there is to create and then close) the >> components needed to send a message, specifically after you have a started >> connection and using a vm:// transport. >> >> I'm working on implementing distributed eventing for a server which >> already has its own eventing built-in (so adapting its events to JMS >> messages published to topics). The events can come from any thread and be >> sent to different topics based source event details. That seems to mean >> that for each local event I have to: >> >> 1) reference destination >> 2) create session >> 3) create producer >> 4) build message for event and send >> 5 ) close producer and session (discard destination) >> >> #1 looks like its just object creation, but has some parsing of physical >> name (quite a few ops as it looks like)... so could potentially cache these >> (trade a bit of memory for a string lookup over always creating new >> instance)? >> >> Not sure what overhead there is for #2, #3 or #5. Is there any >> documentation on roughly what these operations cost? >> >> The destination + session could change so #3 would have to be done >> anyways, hopefully its cheap? If #2 is not super cheap, then perhaps its >> better to have the local event handler queue up the publish in a >> BlockingQueue (or similar) so that a single thread + session (or >> potentially small pool of thread+session) could be used to a actually >> perform the publish? >> >> Does anyone have any insight on to what would be best option for least >> overhead for this use-case? >> >> --jason ------=_Part_170968_603112941.1321716910382--