Return-Path: X-Original-To: apmail-perl-modperl-archive@www.apache.org Delivered-To: apmail-perl-modperl-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id DF76A10626 for ; Fri, 25 Oct 2013 15:31:08 +0000 (UTC) Received: (qmail 58687 invoked by uid 500); 25 Oct 2013 15:31:07 -0000 Delivered-To: apmail-perl-modperl-archive@perl.apache.org Received: (qmail 58424 invoked by uid 500); 25 Oct 2013 15:31:05 -0000 Mailing-List: contact modperl-help@perl.apache.org; run by ezmlm Precedence: bulk list-help: list-unsubscribe: List-Post: List-Id: Delivered-To: mailing list modperl@perl.apache.org Received: (qmail 58409 invoked by uid 99); 25 Oct 2013 15:31:03 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 25 Oct 2013 15:31:03 +0000 X-ASF-Spam-Status: No, hits=1.5 required=5.0 tests=HTML_MESSAGE,RCVD_IN_DNSWL_LOW,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of pharkins@gmail.com designates 209.85.219.41 as permitted sender) Received: from [209.85.219.41] (HELO mail-oa0-f41.google.com) (209.85.219.41) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 25 Oct 2013 15:30:58 +0000 Received: by mail-oa0-f41.google.com with SMTP id o9so1082428oag.28 for ; Fri, 25 Oct 2013 08:30:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=eSxoYI0zXp973B/i6zVNC8gdnytmH1GrAYkC8T3vP/s=; b=uo2eZI9F6h7ZGXJpYlVCwo+xRagMTCIt28XDlc9T0DB7SDKM2VZo1cZpn+Sl2TrpTM 1udVhT1BWo6gAFesLNqfPDblSRKtnOBZziBeX9FVa+nPEg4hCRQ9Xj91uzSnTjMjhuJf +YLc52+GVQFD7/MhVk9DDSwHSssBif0fjTNoQmIgS/qE7Rlddq2OzLFLQnuUTQ+p3Wki 8YZNoB+hUI5b8zgBoWSSiGVlzgZ+okZSizfkIJ+NBDE1BQb1MehfDPr9A8VJ9sVjFPhK bNHlMJ5jchAjbY9efJhtlboGa6p+Uc5czdv/j6p7jIJwi3SU5HisiHojdHgLBQHexPgV d+uQ== MIME-Version: 1.0 X-Received: by 10.182.66.82 with SMTP id d18mr276184obt.98.1382715037098; Fri, 25 Oct 2013 08:30:37 -0700 (PDT) Received: by 10.182.243.129 with HTTP; Fri, 25 Oct 2013 08:30:37 -0700 (PDT) In-Reply-To: References: Date: Fri, 25 Oct 2013 11:30:37 -0400 Message-ID: Subject: Re: mysql connection pooling From: Perrin Harkins To: Xinhuan Zheng Cc: xiaolan , "modperl@perl.apache.org" Content-Type: multipart/alternative; boundary=e89a8fb1ef649cafee04e9926e99 X-Virus-Checked: Checked by ClamAV on apache.org --e89a8fb1ef649cafee04e9926e99 Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: quoted-printable Hi, Are you already using a reverse proxy in front of mod_perl? That should be your first step, and solves this for most people. The next thing I'd recommend is looking at Oracle's connection pooling solutions. I haven't used Oracle recently, but I remember that they had multiple ways to do pooling. If they have something you can use, that's probably more efficient than doing it at the Perl level and wouldn't require code changes. Finally, you could use the DBD::Gofer approach described in those slides. If you read the DBD::Gofer documentation you'll see that the HTTP proxying is handled by a separate distribution here: http://search.cpan.org/dist/GoferTransport-http/ - Perrin On Thu, Oct 24, 2013 at 3:44 PM, Xinhuan Zheng wr= ote: > Hi Perrin, > > I am facing a similar issue with Oracle database. Tim's slides doesn=92t > explain details of implementation. I have Apache httpd with mod_perl and > DBI. Without many code changes, what does the proxy server look like to > achieve the database connection pooling? What is "Apache running DBI Gofe= r" > as shown in the slides page 26? > > Thanks, > - xinhuan > > From: Perrin Harkins > Date: Thursday, June 27, 2013 3:05 PM > To: xiaolan > Cc: "modperl@perl.apache.org" > Subject: Re: mysql connection pooling > > Hi, > > There is nothing exactly like the database pool in JDBC. However, there > are solutions for this problem. > > The first thing you should do is run a reverse proxy in front of your > mod_perl server. That typically reduces the number of mod_perl processes > by a factor of 10, i.e. 1000 mod_perl processes for 10,000 front-end prox= y > processes. See > http://perl.apache.org/docs/1.0/guide/strategy.html#Adding_a_Proxy_Server= _in_http_Accelerator_Mode > > Note that there are many lightweight proxy servers now that can act as a > front-end for mod_perl, not just Apache httpd. > > That's definitely what you should do first, but if you've done that and > it's still not enough, you can also use DBD::Gofer. There is an > explanation here: > http://search.cpan.org/~timb/DBI-1.627/lib/DBD/Gofer.pm#Connection_Poolin= g_and_Throttling > > Tim's slides explaining how this was used in a real-world scenario are > here: > http://www.slideshare.net/Tim.Bunce/dbdgofer-200809 > > - Perrin > > > On Thu, Jun 27, 2013 at 2:26 AM, xiaolan wrote: > >> Hi, >> >> Currently I have been using Apache::DBI for long connections to Mysql. >> But having the problem that, if the apache processes are 10000, they ope= n >> 10000 connections to mysql, this make the DB crashed. >> Is there any software for modperl working like Java's JDBC for connectio= n >> pooling? >> >> Thanks. >> > > --e89a8fb1ef649cafee04e9926e99 Content-Type: text/html; charset=windows-1252 Content-Transfer-Encoding: quoted-printable
Hi,

Are you already using a reverse pro= xy in front of mod_perl? =A0That should be your first step, and solves this= for most people.

The next thing I'd recommend= is looking at Oracle's connection pooling solutions. =A0I haven't = used Oracle recently, but I remember that they had multiple ways to do pool= ing. =A0If they have something you can use, that's probably more effici= ent than doing it at the Perl level and wouldn't require code changes.<= /div>

Finally, you could use the DBD::Gofer approach describe= d in those slides. =A0If you read the DBD::Gofer documentation you'll s= ee that the HTTP proxying is handled by a separate distribution here:=A0http://search.cpa= n.org/dist/GoferTransport-http/

- Perrin


=
On Thu, Oct 24, 2013 at 3:44 PM, Xinhuan Zheng <= span dir=3D"ltr"><xzheng@christianbook.com> wrote:
Hi Perrin,

I am facing a similar issue with Oracle database. Tim's slides doe= sn=92t explain details of implementation. I have Apache httpd with mod_perl= and DBI. Without many code changes, what does the proxy server look like t= o achieve the database connection pooling? What is "Apache running DBI Gofer" as shown in the slides page 2= 6?=A0

Thanks,
- xinhuan

From: Perrin Harkins <pharkins@gmail.com> Date: Thursday, June 27, 2013 3:05 = PM
To: xiaolan <practicalperl@gmail.com> Cc: "modperl@perl.apache.org" <<= a href=3D"mailto:modperl@perl.apache.org" target=3D"_blank">modperl@perl.ap= ache.org>
Subject: Re: mysql connection pooli= ng

Hi,

There is nothing exactly like the database pool in JDBC. =A0However, t= here are solutions for this problem.

The first thing you should do is run a reverse proxy in front of your = mod_perl server. =A0That typically reduces the number of mod_perl processes= by a factor of 10, i.e. 1000 mod_perl processes for 10,000 front-end proxy= processes. =A0See=A0= http://perl.apache.org/docs/1.0/guide/strategy.html#Adding_a_Proxy_Server_i= n_http_Accelerator_Mode

Note that there are many lightweight proxy servers now that can act as= a front-end for mod_perl, not just Apache httpd.

That's definitely what you should do first, but if you've done= that and it's still not enough, you can also use DBD::Gofer. =A0There = is an explanation here:=A0http= ://search.cpan.org/~timb/DBI-1.627/lib/DBD/Gofer.pm#Connection_Pooling_and_= Throttling

Tim's slides explaining how this was used in a real-world scenario= are here:

- Perrin


On Thu, Jun 27, 2013 at 2:26 AM, xiaolan <practicalp= erl@gmail.com> wrote:
Hi,

Currently I have been using Apache::DBI for long connections to Mysql.=
But having the problem that, if the apache processes are 10000, they o= pen 10000 connections to mysql, this make the DB crashed.
Is there any software for modperl working like Java's JDBC for con= nection pooling?

Thanks.


--e89a8fb1ef649cafee04e9926e99--