Return-Path: X-Original-To: apmail-httpd-modules-dev-archive@minotaur.apache.org Delivered-To: apmail-httpd-modules-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 1DB39982B for ; Sat, 18 Feb 2012 01:53:32 +0000 (UTC) Received: (qmail 65795 invoked by uid 500); 18 Feb 2012 01:53:31 -0000 Delivered-To: apmail-httpd-modules-dev-archive@httpd.apache.org Received: (qmail 65738 invoked by uid 500); 18 Feb 2012 01:53:31 -0000 Mailing-List: contact modules-dev-help@httpd.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: modules-dev@httpd.apache.org Delivered-To: mailing list modules-dev@httpd.apache.org Received: (qmail 65728 invoked by uid 99); 18 Feb 2012 01:53:30 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 18 Feb 2012 01:53:30 +0000 X-ASF-Spam-Status: No, hits=3.5 required=5.0 tests=FROM_12LTRDOM,HTML_MESSAGE,RCVD_IN_DNSWL_LOW,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of scarleton@gmail.com designates 209.85.210.173 as permitted sender) Received: from [209.85.210.173] (HELO mail-iy0-f173.google.com) (209.85.210.173) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 18 Feb 2012 01:53:23 +0000 Received: by iahk25 with SMTP id k25so6703666iah.18 for ; Fri, 17 Feb 2012 17:53:02 -0800 (PST) Received-SPF: pass (google.com: domain of scarleton@gmail.com designates 10.50.169.36 as permitted sender) client-ip=10.50.169.36; Authentication-Results: mr.google.com; spf=pass (google.com: domain of scarleton@gmail.com designates 10.50.169.36 as permitted sender) smtp.mail=scarleton@gmail.com; dkim=pass header.i=scarleton@gmail.com Received: from mr.google.com ([10.50.169.36]) by 10.50.169.36 with SMTP id ab4mr485052igc.3.1329529982134 (num_hops = 1); Fri, 17 Feb 2012 17:53:02 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:sender:date:x-google-sender-auth:message-id:subject :from:to:content-type; bh=c0KlFBuxmBjkS3iZHOj511x+1MSgi91wvbtvqp/ttc8=; b=D1z5fgl+/eIyquI8FMJtGUGww4b0ozCDlQ3fcwhGQfKHIjlqAIjvonI+BcwK88Xmux IiHyi/cyWndK5f6EAjsOLVriWjuJZWhJjlTv7+YcLMoWh4y1CnNAIC2pOAbX+7ESzvn5 xa9g1Aov1ZoLj9yTjO2YZFvyTmuqIcoteJujA= MIME-Version: 1.0 Received: by 10.50.169.36 with SMTP id ab4mr395073igc.3.1329529982048; Fri, 17 Feb 2012 17:53:02 -0800 (PST) Sender: scarleton@gmail.com Received: by 10.231.167.70 with HTTP; Fri, 17 Feb 2012 17:53:02 -0800 (PST) Date: Fri, 17 Feb 2012 20:53:02 -0500 X-Google-Sender-Auth: v2Ya8L0UiBGJ8pEuNcVQA9iyLCs Message-ID: Subject: how to best implement my own connection pool From: Sam Carleton To: modules-dev@httpd.apache.org Content-Type: multipart/alternative; boundary=e89a8f3bac3d4c57d504b9335250 X-Virus-Checked: Checked by ClamAV on apache.org --e89a8f3bac3d4c57d504b9335250 Content-Type: text/plain; charset=UTF-8 I am working on a short term solution to a bigger issue. The long term solution is switch databases, that is next on the list, after I patch the current DB. My background: I am the sole developer of this product that uses lots of technologies, one of them is Apache Modules. It has been a long while, likes a year+ since I have had to do anything really hard core, so I am not 100% up to speed with terms and exact techniques. My ultimate goal in this post is to get some definition/direction as to know were to start on this short term solution. I am currently using the DB, SQLite. It is a great and outstanding DB, except... It is File Locking database, when one thread/process writes to it, the whole DB is locked. This is all fine and dandy, except there is one query (not an update/insert/delete) that is pretty intensive and runs a LOT, could be as much as 10~20 times a second. The great part is... It is somewhat static, so I would like to create a system to pool the result in memory and refresh it when it needs to be changed. Here is the pseudo code: Process 1 (not Apache) that creates the static file: 1. Create a Lock file: query.results.lock 2. Dump results from query to a text file: query.results 3. Remove Lock file Right now a request comes in via Axis2/C module (a web service). The WS is what needs access to this new piece. I have already done a lot of hacking on the Axis2/C piece so within the WS code, I have access to the core of the Apache request, server, etc. So in the WS, I want to make a call into this "connection pooling" code to do the following: 1. Check to see if query.results is in memory, if not load it 2. Check to see there is a lock file, if so use the copy in memory for this 'connection' 3. Check to see if the last modified date/time is newer then in memory, if so, load it, else use what is memory Basically what I am looking for is the same basic connection pooling that is implemented in the mod_dbd. Is there an easy way to do this, or will I simple need to get into the internals of the mod_dbd to figure out what it is doing and do it myself. Sam --e89a8f3bac3d4c57d504b9335250--