From users-return-49891-archive-asf-public=cust-asf.ponee.io@activemq.apache.org Tue Apr 24 07:48:34 2018 Return-Path: X-Original-To: archive-asf-public@cust-asf.ponee.io Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by mx-eu-01.ponee.io (Postfix) with SMTP id 76633180671 for ; Tue, 24 Apr 2018 07:48:33 +0200 (CEST) Received: (qmail 12403 invoked by uid 500); 24 Apr 2018 05:48:31 -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 12382 invoked by uid 99); 24 Apr 2018 05:48:30 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd4-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 24 Apr 2018 05:48:30 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd4-us-west.apache.org (ASF Mail Server at spamd4-us-west.apache.org) with ESMTP id 5459AC012D for ; Tue, 24 Apr 2018 05:48:30 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd4-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: 4.567 X-Spam-Level: **** X-Spam-Status: No, score=4.567 tagged_above=-999 required=6.31 tests=[DKIM_ADSP_CUSTOM_MED=0.001, FREEMAIL_ENVFROM_END_DIGIT=0.25, NML_ADSP_CUSTOM_MED=1.2, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_PASS=-0.001, SPF_SOFTFAIL=0.972, URI_HEX=1.313, URI_TRY_3LD=0.832] autolearn=disabled Received: from mx1-lw-eu.apache.org ([10.40.0.8]) by localhost (spamd4-us-west.apache.org [10.40.0.11]) (amavisd-new, port 10024) with ESMTP id CQj2T1ODqJbD for ; Tue, 24 Apr 2018 05:48:29 +0000 (UTC) Received: from n4.nabble.com (n4.nabble.com [162.253.133.72]) by mx1-lw-eu.apache.org (ASF Mail Server at mx1-lw-eu.apache.org) with ESMTP id C76515F2FE for ; Tue, 24 Apr 2018 05:48:28 +0000 (UTC) Received: from mben.nabble.com (localhost [127.0.0.1]) by n4.nabble.com (Postfix) with ESMTP id 7B3031A502F51 for ; Mon, 23 Apr 2018 22:48:26 -0700 (MST) Date: Mon, 23 Apr 2018 22:48:26 -0700 (MST) From: pragmaticjdev To: users@activemq.apache.org Message-ID: <1524548906501-0.post@n4.nabble.com> In-Reply-To: References: <1523448563003-0.post@n4.nabble.com> <1524146450628-0.post@n4.nabble.com> Subject: Re: Using ActiveMQ For Distributed Replicated Cache MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Highly appreciate the detailed replies and the clarifications on distribute= d cache vs database. We are trying to build a distributed cache. I agree to all the inputs you shared for such a cache implementation. In summary it would mean =091. Subscriber should clear the cache when it cannot connect to the broke= r =092. Publisher should not rollback the database transaction on failures as step #1 would be sufficient & the cache is loaded as and when queried A couple of follow up questions 1.=20 > Typically you would call it in a tight loop, so you're only as stale as > the=C2=A0amount of time it takes you to publish the messages received the= last > time.=C2=A0 =09 How can one control the polling time of the consumer? My jms consumer code from our spring application looks like this @Component public class Consumer { @JmsListener(destination =3D "java-topic", containerFactory =3D "topicListenerFactory") =09public void receiveTopicMessage(@Payload Person person) throws JMSExcept= ion { =09 //update the local cache entry } } How do I change the above code to call it in a tight loop? Also would that mean one or more threads would be constantly busy leading to constant usage of CPU cycles?=20 2. For my question on overloaded subscriber I didn't completely follow your suggestion for not being worried about this scenario. You mentioned > If you're going with a distributed cache, then don't worry about > this,=C2=A0because you'll handle it with queries to the truth store when = you > have=C2=A0cache misses (at the cost of slower performance).=C2=A0 Assume there are two app servers with an object loaded in the local cache. An update to this object occurs on app server 1 which publishes that object on the jms queue. Here if app server 2 is overloaded (busy CPU), the jms consumer thread might not get a chance to execute at that instance in time. What happens in such cases, does activemq retry after some time? Can the number of such retries be configured? It could so happen that the app serve= r 2 could remain in an overloaded state for a longer duration (may be 30 mins). -- Sent from: http://activemq.2283324.n4.nabble.com/ActiveMQ-User-f2341805.htm= l