Return-Path: Delivered-To: apmail-jackrabbit-users-archive@minotaur.apache.org Received: (qmail 59996 invoked from network); 19 Dec 2009 09:06:32 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 19 Dec 2009 09:06:32 -0000 Received: (qmail 615 invoked by uid 500); 19 Dec 2009 09:06:31 -0000 Delivered-To: apmail-jackrabbit-users-archive@jackrabbit.apache.org Received: (qmail 567 invoked by uid 500); 19 Dec 2009 09:06:30 -0000 Mailing-List: contact users-help@jackrabbit.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: users@jackrabbit.apache.org Delivered-To: mailing list users@jackrabbit.apache.org Received: (qmail 556 invoked by uid 99); 19 Dec 2009 09:06:30 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 19 Dec 2009 09:06:30 +0000 X-ASF-Spam-Status: No, hits=-0.0 required=10.0 tests=SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of ianboston@googlemail.com designates 209.85.219.217 as permitted sender) Received: from [209.85.219.217] (HELO mail-ew0-f217.google.com) (209.85.219.217) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 19 Dec 2009 09:06:20 +0000 Received: by ewy9 with SMTP id 9so90462ewy.11 for ; Sat, 19 Dec 2009 01:06:00 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlemail.com; s=gamma; h=domainkey-signature:received:received:sender:content-type :mime-version:subject:from:in-reply-to:date :content-transfer-encoding:message-id:references:to:x-mailer; bh=9xPYD5v/XVT2imwjVgMCOhizAUviCp8VjaEsRXgqQvs=; b=nvcOucy2RNxxgL579AY+hrh/oEzDxyWcdnLFJ29YAeHEwXAkrLZZ5yiVKtRFxJHi4u FRtgoIHY6kGpVf5EV/0gxZewwaGqL9UkOcf7sNoSgJD0XqDx56x4SXboUp8ZiLouo8Km dK7JtshR4/WViZpxLjTsAR4VPZJYlfqrR+Umk= DomainKey-Signature: a=rsa-sha1; c=nofws; d=googlemail.com; s=gamma; h=sender:content-type:mime-version:subject:from:in-reply-to:date :content-transfer-encoding:message-id:references:to:x-mailer; b=pLY5f5WoPxSjg/hCiueoNhrQvfz54H7xbuRlyRCwfMsW2tdDNhlEOSa4IlzVllwQDu 0qPwEllxpt5Orcs979Z8lGajfMLgx161pB9+s0JccsRyjO1WNbXLD+LNJJK9CfUgDbN6 JBPJgidiEMLix29Oo4uOBPAaYVWR/qYGFbKU4= Received: by 10.213.110.17 with SMTP id l17mr11718808ebp.18.1261213560041; Sat, 19 Dec 2009 01:06:00 -0800 (PST) Received: from x43543.lan (78-105-202-108.zone3.bethere.co.uk [78.105.202.108]) by mx.google.com with ESMTPS id 16sm2443840ewy.10.2009.12.19.01.05.58 (version=TLSv1/SSLv3 cipher=RC4-MD5); Sat, 19 Dec 2009 01:05:58 -0800 (PST) Sender: Ian Boston Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Apple Message framework v1077) Subject: Re: Multiple Concurrent Users updating a Single Node From: Ian Boston In-Reply-To: Date: Sat, 19 Dec 2009 09:05:57 +0000 Content-Transfer-Encoding: quoted-printable Message-Id: <4320895C-247C-4DD3-A683-A934C93B3406@tfd.co.uk> References: To: users@jackrabbit.apache.org X-Mailer: Apple Mail (2.1077) X-Virus-Checked: Checked by ClamAV on apache.org On 19 Dec 2009, at 06:35, Vibhu Sharma wrote: > Hi, > This may be slightly off topic from the current mailing list. >=20 > I have a Content node(nt:file) which stores the content and other = metadata > data as properties. On a high traffic site there may be a case in = which a > Single Content property (other than the jcr:data) is updated by many = users( > eg. cumulative likes and dislikes or total views). What should be the > strategy to handle this use case? >=20 > 1. A Standard Lock and update strategy will lock out another user = updating > the same node at the same time. > 2. A Queue system where all the updates are queued up and synced later Depends if you ever intend to run in a cluster.=20 If not you might consider a in memory locking mechanism to serialize = that area of the request cycle, however that *will* eventually become a = bottleneck. At which point a queue will make much more sense, something = like posting the likes dislikes to JMS and then having a single listener = processing the results. If you need it to scale, dedicate a listener to = the processing, or beyond that shard the listeners based on the path to = the object. A JCR lock creates traffic in the JCR as the node is locked and = unlocked, its really more suitable for long lived user bound actions = rather than ensuring transactional concurrency. One alternative option is to build a subtree of nodes under the content = node and avoid contention all together, if you date stamp the = like/dislike then you can use a JCR query to order the results. Ian >=20 >=20 > regards > Vibhu