X-Original-To: pgsql-general-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 2471F5406A for ; Tue, 3 May 2005 12:16:39 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 48585-04 for ; Tue, 3 May 2005 15:16:34 +0000 (GMT) Received: from web52405.mail.yahoo.com (web52405.mail.yahoo.com [206.190.39.113]) by svr1.postgresql.org (Postfix) with SMTP id BE9AB54066 for ; Tue, 3 May 2005 12:16:27 -0300 (ADT) Received: (qmail 37633 invoked by uid 60001); 3 May 2005 15:16:26 -0000 Comment: DomainKeys? See http://antispam.yahoo.com/domainkeys DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=s1024; d=yahoo.com; b=rzur/R1ieQs391v6tQ29Ahcv4XH0U1CN7rTbZbd1avhHaUolwuE1U45X3lcQy4aC7qNIhFem0Tu1HSB5WdaNFs5NtR+7yWSsoqCqk+BB0vV809zRjPvifOlnPd4nlSjvOHIkFyMx467ZQuML7MDKI0IfX/bflYA1ya3oKCO2k6I= ; Message-ID: <20050503151626.37630.qmail@web52405.mail.yahoo.com> Received: from [80.186.151.80] by web52405.mail.yahoo.com via HTTP; Tue, 03 May 2005 08:16:26 PDT Date: Tue, 3 May 2005 08:16:26 -0700 (PDT) From: Robin Boerdijk Subject: Re: Deep integration of PostgreSQL with Apache To: pgsql-general@postgresql.org In-Reply-To: 6667 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.616 tagged_above=0 required=5 tests=AWL, DNS_FROM_RFC_ABUSE X-Spam-Level: X-Archive-Number: 200505/107 X-Sequence-Number: 77455 --- Thomas Hallgren wrote: > Robin Boerdijk wrote: > > Hi, > > > > Apologies if this has been discussed before, but I was wondering if > > there have been any efforts in the past to provide a deep > integration > > of PostgreSQL with Apache. What I mean by deep integration is that > the > > PostgreSQL server logic runs inside the Apache server processes, > rather > > than separate processes. In particular, the postmaster server logic > > would run inside the Apache master process and the postgres server > > logic would run inside Apache child processes. > > > > The main advantage of this approach would be that it avoids the > > Apache/PostgreSQL context switch when executing SQL requests from > the > > web server. It looks like the Apache server and PostgreSQL server > > architectures are quite similar to make this feasible. Any > thoughts? > > > The PostgreSQL backend is inherently single-threaded and a new > process > is forked each time you establish a new connection (session) so the > integration you ask for is not in anyway possible unless you are > content > with one single database connection. I agree that it is not trivial, but is it feasible? Specifically, I'm thinking about the following approach: 1. Strip all networking logic and the logic that manages the postgres child servers from the postmaster server. The logic that remains is code that manages the auxiliary processes such as the bgwriter and statistics collector. Integrate this remaining logic in the the Apache master server. 2. Strip all networking logic from the postgres server. The logic that remains is logic for executing queries against the database. Integrate this remaining logic in the Apache child server. The result of this is an integrated web/database server where all networking is handled by Apache instead of postmaster/postgres. Other than that, I see no difference with the way PostgreSQL works out of the box. The Apache master server functions as the postmaster (i.e. managing the child server processes) and the Apache child servers function as the postgres servers (i.e. access the database). Why would this web/database server be limited to using only one connection? __________________________________________________ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com