Return-Path: Delivered-To: apmail-activemq-users-archive@www.apache.org Received: (qmail 34696 invoked from network); 8 Apr 2010 04:15:45 -0000 Received: from unknown (HELO mail.apache.org) (140.211.11.3) by 140.211.11.9 with SMTP; 8 Apr 2010 04:15:45 -0000 Received: (qmail 47121 invoked by uid 500); 8 Apr 2010 04:15:45 -0000 Delivered-To: apmail-activemq-users-archive@activemq.apache.org Received: (qmail 47017 invoked by uid 500); 8 Apr 2010 04:15:44 -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 47009 invoked by uid 99); 8 Apr 2010 04:15:44 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 08 Apr 2010 04:15:44 +0000 X-ASF-Spam-Status: No, hits=0.0 required=10.0 tests=FREEMAIL_FROM,SPF_HELO_PASS,SPF_PASS,T_TO_NO_BRKTS_FREEMAIL X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of lists@nabble.com designates 216.139.236.158 as permitted sender) Received: from [216.139.236.158] (HELO kuber.nabble.com) (216.139.236.158) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 08 Apr 2010 04:15:38 +0000 Received: from isper.nabble.com ([192.168.236.156]) by kuber.nabble.com with esmtp (Exim 4.63) (envelope-from ) id 1Nzj9A-0005Gx-Vq for users@activemq.apache.org; Wed, 07 Apr 2010 21:15:16 -0700 Message-ID: <28173978.post@talk.nabble.com> Date: Wed, 7 Apr 2010 21:15:16 -0700 (PDT) From: mattcodes To: users@activemq.apache.org Subject: Re: Relationship between Producer, Session and Connection. In-Reply-To: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Nabble-From: matt@mattfreeman.co.uk References: <28163471.post@talk.nabble.com> X-Virus-Checked: Checked by ClamAV on apache.org When you say overhead are you talking about ongoing on startup, I was thinking of initializing the pool on startup, so bring up minsize of pools say 30 producer(1:1)session(1:1)connection, so when requested its all ready to go, use it, and release it back to the pool for the next incoming web request that has to send a message to the backend queue. If I go the route of having 1 connection, how many session would you have per connection? I guess start with the connection as singelton, then a pool of sessions? Eventually scale it to connection per 20 sessions? Or somethin= g like that? There could be quite a few concurrent users that will push the demand on th= e activemq parts up bsnyder wrote: >=20 > On Wed, Apr 7, 2010 at 5:12 AM, mattcodes wrote: >> >> In a (ASP.Net/c#) web-app I want to pump messages to an ActiveMQ queue >> (nothing complicated - no native transactions etc..). Reading various >> FAQs >> etc.. I figure I should create a pool of say 50 message producers, each >> with >> their own session and own connection for the best performance. i.e. a 1 >> to 1 >> relation between producer --> session and session --> connection. Is thi= s >> the optimal setup? When would this be problematic? =C2=A0Obviously Id ha= ve to >> implement the pooling myself since there's no ActiveMQ pool lib for .Net= ? >> >> Alternatively I thought about pooling Session (with 1to1 with connection= ) >> and then creating the producer on each request? The overhead of this is >> about 9ms I tested, which isnt that far off pulling from a pool, >=20 > The problem with what you are proposing is that it won't scale very > well. Creating connections, sessions and producers in a 1:1 ratio is > inappropriate because the overhead of both is rather high. It's > actually better to use one connection to create many sessions and only > increasing the number of connections if it is deemed necessary. This > is the model used by most JMS pooling connection factories and most > messaging middleware works very well with this model. >=20 > Here is an example of what I recommend to folks for sending messages: >=20 > http://bsnyderblog.blogspot.com/2010/02/using-spring-jmstemplate-to-send-= jms.html >=20 > This example uses the Spring Framework to send JMS messages. Let me > know if you have any questions. >=20 > Bruce > --=20 > perl -e 'print > unpack("u30","D0G)U8V4\@4VYY9&5R\"F)R=3D6-E+G-N>61E );' >=20 > ActiveMQ in Action: http://bit.ly/2je6cQ > Blog: http://bruceblog.org/ > Twitter: http://twitter.com/brucesnyder >=20 >=20 --=20 View this message in context: http://old.nabble.com/Relationship-between-Pr= oducer%2C-Session-and-Connection.-tp28163471p28173978.html Sent from the ActiveMQ - User mailing list archive at Nabble.com.