Return-Path: X-Original-To: apmail-curator-user-archive@minotaur.apache.org Delivered-To: apmail-curator-user-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id F0B8718AA0 for ; Sun, 13 Sep 2015 16:41:45 +0000 (UTC) Received: (qmail 29008 invoked by uid 500); 13 Sep 2015 16:41:40 -0000 Delivered-To: apmail-curator-user-archive@curator.apache.org Received: (qmail 28957 invoked by uid 500); 13 Sep 2015 16:41:40 -0000 Mailing-List: contact user-help@curator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: user@curator.apache.org Delivered-To: mailing list user@curator.apache.org Received: (qmail 28947 invoked by uid 99); 13 Sep 2015 16:41:40 -0000 Received: from Unknown (HELO spamd2-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 13 Sep 2015 16:41:40 +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 5F22A1A189D for ; Sun, 13 Sep 2015 16:41:40 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd2-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: 2.9 X-Spam-Level: ** X-Spam-Status: No, score=2.9 tagged_above=-999 required=6.31 tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, HTML_MESSAGE=3, SPF_PASS=-0.001, URIBL_BLOCKED=0.001] autolearn=disabled Authentication-Results: spamd2-us-west.apache.org (amavisd-new); dkim=pass (1024-bit key) header.d=tink.se Received: from mx1-us-west.apache.org ([10.40.0.8]) by localhost (spamd2-us-west.apache.org [10.40.0.9]) (amavisd-new, port 10024) with ESMTP id ddL8iopsEKeZ for ; Sun, 13 Sep 2015 16:41:30 +0000 (UTC) Received: from mail-yk0-f176.google.com (mail-yk0-f176.google.com [209.85.160.176]) by mx1-us-west.apache.org (ASF Mail Server at mx1-us-west.apache.org) with ESMTPS id 763EA206E8 for ; Sun, 13 Sep 2015 16:41:30 +0000 (UTC) Received: by ykdg206 with SMTP id g206so133173910ykd.1 for ; Sun, 13 Sep 2015 09:41:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tink.se; s=tink; h=mime-version:from:date:message-id:subject:to:content-type; bh=2jy2hksiIIeiuqMr/gzKCVfWc/3YRgFVJUWsVUB8C9M=; b=UgxOku79s5XqaZ+C6Yzxwi53h7oLysiLRv1PP6M5xrbHN39T2eAmnF0jmT4iPp5mQL 9eisf392AfHLyouopEvd0S5Ca9J67o56o2qg7S8ewiMFXciZwMSjsBJMT+G/cY/sSOR6 3GC1luVZWSgRrlUbBgahfOs0nJfh4n1uPB608= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:from:date:message-id:subject:to :content-type; bh=2jy2hksiIIeiuqMr/gzKCVfWc/3YRgFVJUWsVUB8C9M=; b=L7y1EBXr5X4lZy/s/O95QG5Q5V8HSjUQBrYV3vRuJz9z3/keYpm08I41vSpgwdsvBI jR5ttqS1CvP/Tu61cOa/uDDMa02ycGEeMrfDRknMKz0FJCglSG+osnWzOK6k8OeRS4ml Lbxr58r++0vCt7X27g4QzHo5jMnFLqZ8Q+Mm1mkVG6jnGyVukofcvE+gLJbsmxaii9p1 sZV8L1WeetWcgPNK3JYIRn8qxltZLhrc3Sd5bEwRu95ZqDentutv0e/i7LFMzeW/WCMa KowN2ZF71EXm93Oruyx/B7W0CiI0eBpZjI8U5PVajt4lGY4Pq3itRO0otsZsY1aIy2Vk qgbQ== X-Gm-Message-State: ALoCoQlT5bheZfk7L68ReX+AtcmRXbnV4amyaOr2XkhJTFC0NIgSoOOa6CpJtulLJKmPGblGWyfU X-Received: by 10.129.155.147 with SMTP id s141mr9779177ywg.17.1442162483457; Sun, 13 Sep 2015 09:41:23 -0700 (PDT) MIME-Version: 1.0 Received: by 10.129.107.67 with HTTP; Sun, 13 Sep 2015 09:41:04 -0700 (PDT) From: Jens Rantil Date: Sun, 13 Sep 2015 18:41:04 +0200 Message-ID: Subject: InterProcessSemaphoreMutex not cleaning up old znodes To: user@curator.apache.org Content-Type: multipart/alternative; boundary=94eb2c05509a8925ed051fa39e06 --94eb2c05509a8925ed051fa39e06 Content-Type: text/plain; charset=UTF-8 Hi again, I have a distributed application which has InterProcessSemaphoreMutexes which occasionally are taken per user. To do this, the mutex path is appended with a user's unique ID (example: /mylock/{userid}). All is fine and dandy and this generally works. However, I've noticed that the paths given to the InterProcessSemaphoreMutexes aren't cleaned up after I'm done with the locks. This means, my Zookeeper ensemble has every single one of my previous mutexes held in memory. When I list my znodes I see: /mylock/1 /mylock/2 ... /mylock/XXX Given that I generally only take ~20 locks at a time it feels unnecessary to keep all these in memory. We have had to increase initLimit in Zookeeper configuration, most certainly due to all of these znodes. Two questions: - Is there a reason for keeping these znodes hanging around? - Given that I need to use mutexes, what are the best practise for taking locks per user like this? Hash the user IDs and bucket them into a limitted number of mutexes (enough to avoid contention)? Have a separate cleaning thread that cleans up old znodes? How are you guys handling this? Thanks, Jens -- Jens Rantil Backend engineer Tink AB Email: jens.rantil@tink.se Phone: +46 708 84 18 32 Web: www.tink.se Facebook Linkedin Twitter --94eb2c05509a8925ed051fa39e06 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
Hi again,

I have a distributed applicat= ion which has=C2=A0InterProcessSemaphor= eMutexes=C2=A0whi= ch occasionally are taken per user. To do this, the mutex path is appended = with a user's unique ID (example:=C2=A0/mylock/{userid}). All is fine and dandy and this generally work= s. However, I've noticed that the paths given to the=C2=A0InterProcessSemaphoreMutexes aren't cleaned up after I'= ;m done with the locks.

This means, my Zookeeper ensemble has every single one of my previous mute= xes held in memory. When I list my znodes I see:
/mylock/1
/mylock/2
...
/mylock/XXX=

Given that I generally only take ~20 locks a= t a time it feels unnecessary to keep all these in memory. We have had to i= ncrease=C2=A0initLimit in Zookeeper configuration, most certainly due to all= of these znodes.

Two questions:=
  • Is there a reason for keeping these znodes hanging aroun= d?
  • Given that I need to use mutexes, what are the best practise for= taking locks per user like this? Hash the user IDs and bucket them into a = limitted number of mutexes (enough to avoid contention)? Have a separate cl= eaning thread that cleans up old znodes? How are you guys handling this?
Thanks,
Jens

--
Jens Rantil
Bac= kend engineer
Tink AB

Phone: +46 708 84 18 32
= Web:=C2=A0www.tink.se

--94eb2c05509a8925ed051fa39e06--