Return-Path: X-Original-To: apmail-incubator-directmemory-dev-archive@minotaur.apache.org Delivered-To: apmail-incubator-directmemory-dev-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 656EF9F7F for ; Sun, 1 Jan 2012 20:55:06 +0000 (UTC) Received: (qmail 35838 invoked by uid 500); 1 Jan 2012 20:55:06 -0000 Delivered-To: apmail-incubator-directmemory-dev-archive@incubator.apache.org Received: (qmail 35807 invoked by uid 500); 1 Jan 2012 20:55:06 -0000 Mailing-List: contact directmemory-dev-help@incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: directmemory-dev@incubator.apache.org Delivered-To: mailing list directmemory-dev@incubator.apache.org Received: (qmail 35799 invoked by uid 99); 1 Jan 2012 20:55:06 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 01 Jan 2012 20:55:06 +0000 X-ASF-Spam-Status: No, hits=-0.7 required=5.0 tests=RCVD_IN_DNSWL_LOW,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of benoit@noisette.ch designates 209.85.214.175 as permitted sender) Received: from [209.85.214.175] (HELO mail-tul01m020-f175.google.com) (209.85.214.175) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 01 Jan 2012 20:55:01 +0000 Received: by obcwn6 with SMTP id wn6so11985853obc.6 for ; Sun, 01 Jan 2012 12:54:39 -0800 (PST) MIME-Version: 1.0 Received: by 10.182.76.134 with SMTP id k6mr31633120obw.10.1325451279746; Sun, 01 Jan 2012 12:54:39 -0800 (PST) Received: by 10.182.220.66 with HTTP; Sun, 1 Jan 2012 12:54:39 -0800 (PST) In-Reply-To: References: <728511866.56709.1325430570605.JavaMail.tomcat@hel.zones.apache.org> Date: Sun, 1 Jan 2012 21:54:39 +0100 Message-ID: Subject: Re: [jira] [Created] (DIRECTMEMORY-53) MemoryMamagerService buffers allocation policy From: Benoit Perroud To: directmemory-dev@incubator.apache.org Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable The eviction only runs when "inShortage" returns true, which means too many failures happened. But this needs to be run manually, there is no automatic way for MemoryManagerService to come back to the first buffer is there is more than 1 buffer. My view is more a cyclic list of buffers, where you can try to the first one after the last if failing. So instead of if ( activeBuffer.bufferNumber + 1 =3D=3D buffers.size() ){=C2=A0 =C2=A0 = =C2=A0return null;} having something like activeBuffer =3D buffers.get( (activeBuffer.bufferNumber + 1) % buffers.size() ); 2012/1/1 Raffaele P. Guidi : > Uhm, I'm almost sure I put some mechanism to avoid sticking without any > free buffer... maybe it was into the eviction section, probably clearing > one buffer when too many nulls are returned > > On Sun, Jan 1, 2012 at 4:09 PM, Benoit Perroud (Created) (JIRA) < > jira@apache.org> wrote: > >> MemoryMamagerService buffers allocation policy >> ---------------------------------------------- >> >> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 Key: DIRECTMEMOR= Y-53 >> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 URL: https://iss= ues.apache.org/jira/browse/DIRECTMEMORY-53 >> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 Project: Apache DirectMemory >> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0Issue Type: Improvement >> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0Reporter: Benoit Perroud >> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0Priority: Minor >> >> >> MemoryMamagerService with multiple buffers has a really simple, even bug= gy >> allocation policy : once a allocation fail (return null), we try the nex= t >> buffer. If the allocation fails a second time, we return a failure (a nu= ll >> Pointer) to the caller. >> If all the previous buffer were full at one point, we stick to the last >> buffer, without any chance to try to allocate into a previous different >> buffer (which could have again free space due to expiration or pointer >> freeing). >> >> My idea here is to first correct this behavior, but then enhance the >> fonctionality by providing configurable buffer allocation policy. For >> example : >> - round robin allocation, with a certain amount of retries (this would >> also relax some concurrency contention) >> - allocate into the buffer with the more free space >> - allocate into the less fragmented buffer >> - random >> - ... >> >> -- >> This message is automatically generated by JIRA. >> If you think it was sent incorrectly, please contact your JIRA >> administrators: >> https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa >> For more information on JIRA, see: http://www.atlassian.com/software/jir= a >> >> >> --=20 sent from my Nokia 3210