pg.ddx.io  pgsql-interfaces@postgresql.org mailing list archive  
help / color / mirror / Atom feed
Re: Deep integration of PostgreSQL with Apache
4+ messages / 4 participants
[nested] [flat]

* Re: Deep integration of PostgreSQL with Apache
@ 2005-05-03 15:16  Robin Boerdijk <robin_boerdijk@yahoo.com>
  0 siblings, 3 replies; 4+ messages in thread

From: Robin Boerdijk @ 2005-05-03 15:16 UTC (permalink / raw)
  To: pgsql-general@postgresql.org

--- Thomas Hallgren <thhal@mailblocks.com> 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 



^ permalink  raw  reply  [nested|flat] 4+ messages in thread

* Re: Deep integration of PostgreSQL with Apache
@ 2005-05-03 16:48  Alex Turner <armtuk@gmail.com>
  parent: Robin Boerdijk <robin_boerdijk@yahoo.com>
  2 siblings, 0 replies; 4+ messages in thread

From: Alex Turner @ 2005-05-03 16:48 UTC (permalink / raw)
  To: Robin Boerdijk <robin_boerdijk@yahoo.com>; +Cc: pgsql-general@postgresql.org

Wouldn't it just be cheaper to buy a second machine than do all of that?

Alex Turner
netEconomist

On 5/3/05, Robin Boerdijk <robin_boerdijk@yahoo.com> wrote:
> --- Thomas Hallgren <thhal@mailblocks.com> 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
> 
> ---------------------------(end of broadcast)---------------------------
> TIP 3: if posting/reading through Usenet, please send an appropriate
>       subscribe-nomail command to majordomo@postgresql.org so that your
>       message can get through to the mailing list cleanly
>



^ permalink  raw  reply  [nested|flat] 4+ messages in thread

* Re: Deep integration of PostgreSQL with Apache
@ 2005-05-03 17:10  Joshua D. Drake <jd@commandprompt.com>
  parent: Robin Boerdijk <robin_boerdijk@yahoo.com>
  2 siblings, 0 replies; 4+ messages in thread

From: Joshua D. Drake @ 2005-05-03 17:10 UTC (permalink / raw)
  To: Robin Boerdijk <robin_boerdijk@yahoo.com>; +Cc: pgsql-general@postgresql.org

> 
> I agree that it is not trivial, but is it feasible? Specifically, I'm
> thinking about the following approach:

Everything is feasible but that doesn't mean it is sane to do so :). If 
you were going to do that you would probably be better served looking at 
something like sqllite.

Sincerely,

Joshua D. Drake
Command Prompt, Inc.

-- 
Your PostgreSQL solutions company - Command Prompt, Inc. 1.800.492.2240
PostgreSQL Replication, Consulting, Custom Programming, 24x7 support
Managed Services, Shared and Dedication Hosting
Co-Authors: plPHP, plPerlNG - http://www.commandprompt.com/



^ permalink  raw  reply  [nested|flat] 4+ messages in thread

* Re: Deep integration of PostgreSQL with Apache
@ 2005-05-03 21:19  Thomas Hallgren <thhal@mailblocks.com>
  parent: Robin Boerdijk <robin_boerdijk@yahoo.com>
  2 siblings, 0 replies; 4+ messages in thread

From: Thomas Hallgren @ 2005-05-03 21:19 UTC (permalink / raw)
  To: pgsql-general@postgresql.org

Robin Boerdijk wrote:
> Why would
> this web/database server be limited to using only one connection?
> 
No it wouldn't. I misunderstood your question. It's one process/one 
connection. If you don't use Apache as a multi-threaded server, then 
your question makes more sense. Still, it's a lot of work to make it 
happen and I'm not sure you'd gain anything. My advice would be to 
consider a multi-threaded server that uses a connection pool and perhaps 
include some shared caching of data that is more static in nature in the 
middle tier. That could really save some context switches.

Regards,
Thomas Hallgren




^ permalink  raw  reply  [nested|flat] 4+ messages in thread


end of thread, other threads:[~2005-05-03 21:19 UTC | newest]

Thread overview: 4+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2005-05-03 15:16 Re: Deep integration of PostgreSQL with Apache Robin Boerdijk <robin_boerdijk@yahoo.com>
2005-05-03 16:48 ` Alex Turner <armtuk@gmail.com>
2005-05-03 17:10 ` Joshua D. Drake <jd@commandprompt.com>
2005-05-03 21:19 ` Thomas Hallgren <thhal@mailblocks.com>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox