Return-Path: Delivered-To: apmail-apr-dev-archive@www.apache.org Received: (qmail 7445 invoked from network); 25 Dec 2004 22:55:32 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur-2.apache.org with SMTP; 25 Dec 2004 22:55:32 -0000 Received: (qmail 30591 invoked by uid 500); 25 Dec 2004 22:55:32 -0000 Delivered-To: apmail-apr-dev-archive@apr.apache.org Received: (qmail 30314 invoked by uid 500); 25 Dec 2004 22:55:31 -0000 Mailing-List: contact dev-help@apr.apache.org; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: Delivered-To: mailing list dev@apr.apache.org Received: (qmail 30299 invoked by uid 99); 25 Dec 2004 22:55:31 -0000 X-ASF-Spam-Status: No, hits=0.0 required=10.0 tests= X-Spam-Check-By: apache.org Received-SPF: pass (hermes.apache.org: local policy) X-AuthUser: chip@force-elite.com Message-ID: <41CDEFDE.9060608@force-elite.com> Date: Sat, 25 Dec 2004 16:55:26 -0600 From: Paul Querna User-Agent: Mozilla Thunderbird 1.0 (Macintosh/20041206) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Ivan Ristic CC: dev@apr.apache.org Subject: Re: Are shared memory memory pools possible? References: <41CD88EF.6030902@webkreator.com> <41CDA5C1.9060807@force-elite.com> <41CDED83.80900@webkreator.com> In-Reply-To: <41CDED83.80900@webkreator.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Checked: Checked X-Spam-Rating: minotaur-2.apache.org 1.6.2 0/1000/N Ivan Ristic wrote: > Paul Querna wrote: > >> Ivan Ristic wrote: >> >>> >>> I have a need to share a hash table among several processes. It's for >>> an Apache 2 module. Is there a way to get an APR memory pool to use a >>> pre-allocated shared memory segment? Or to initialize a pool with a >>> custom allocator, one that only allocates data from shared memory? >>> >> >> An alternative might be using memcached via apr_memcache: >> >> http://www.outoforder.cc/projects/libs/apr_memcache/ >> >> I plan on trying to get apr_memcache into APR-Util sooner or later. I >> wanted to write up a patch for mod_ssl to use it as a SSL Session >> storage backend first. I am already using it in my mod_gnutls to >> store SSL sessions. > > > It does sound like something I could use. I can definitely see the > benefit of a cluster of web servers sharing the data. But I don't see > a way to inspect the cache or persist the data stored in memcached in > some other way. Is that possible? > That is dependent on the memcached server... and the short answer is there is zero persistence guarantee. Memcached is really designed as a pure cache -- it is assumed any resource in it could be re-created, and that it is just too expensive to create it for every request. Its not the solution for every problem, but for the problems that it does fit, it is blazing fast. Answering the original question again, the only code that does something like this for shared memory is in mod_ssl w/ its Shared Memory Cache for SSL Sessions. It is pretty specialized code, but it might be possible to adapt it to your needs: http://svn.apache.org/repos/asf/httpd/httpd/trunk/modules/ssl/ssl_scache_shmcb.c -Paul