Skip site navigation (1) Skip section navigation (2)

RE: [INTERFACES] Sharing Database Connection Among Different CGI scripts writen in different languages

From: Nicolas Huillard <nhuillard(at)ghs(dot)fr>
To: "'Alexey V(dot) Meledin'" <avm(at)webclub(dot)ru>, "pgsql-interfaces(at)postgreSQL(dot)org" <pgsql-interfaces(at)postgreSQL(dot)org>
Subject: RE: [INTERFACES] Sharing Database Connection Among Different CGI scripts writen in different languages
Date: 2000-02-22 10:39:06
Message-ID: 01BF7D29.6DD3EE40@agen.int.ghs (view raw or flat)
Thread:
Lists: pgsql-interfaces
I use Mason for this kind of stuff (www.masonhq.com). Quoting the site :
"Mason is a powerful Perl-based web site development and delivery engine. With Mason you can embed Perl code in your HTML and construct pages from shared, reusable components. "
For your problem, there are many solutions using Mason. The one I use is persistent DB connections, tied to the Apache servers.
There are many benefit of this architecture : components (your scripts) are compiled only once and cached as long as the Apache process lives (no fork, exec, etc). The database connection are not only persistent in a whole page request, but also for all pages served by an Apache process.
I think you can have a x100 performance improvement between your independent CGI design and this one (not laughing).

Nicolas Huillard

-----Message d'origine-----
De:	Alexey V. Meledin [SMTP:avm(at)webclub(dot)ru]
Date:	mardi 22 février 2000 11:04
À:	pgsql-interfaces(at)postgreSQL(dot)org
Objet:	[INTERFACES] Sharing Database Connection Among Different CGI scripts writen in different languages

Hi!

I have 2 CGI scripts. Each script makes some queries to PostgreSQL and
returns html code as a result .
Simple example:
1-st CGI returns: "Hello, Anny!" (Anny is choosen from DataBase)
2-nd CGI returns: "There is 3 messages for you!" (number of messages
is choosen from Database)
Scripts can run separately each from other.

Suppose, that I want to call 2-nd script from the first via HTTP or
fork+execv+pipe.
I receive: "Hello, Anny! There is 3 messages for you!"

All OK, but I have two separated queries and two Backends started.
It's not good, because I don't need any concurrency :(

How can I optimize such situation?
I see:
1. Share Database conection among two scripts. Can I do it?
2. Write "proxy" daemon to execute queries. Is it possible?
3. Use Application Servers and so either (can't use them and any other
transaction mechanizm)


Thenks, Alexey V. Meledin
InterForge Developers Group, Saint-Petersburg
look_to: <www.etcompany.ru><www.businessweb.ru>
<www.inplan.spb.ru><www.pia.ru>>>>>>>>>>>>>>>>>
mail_to: <avm(at)webclub(dot)ru><nick_as: <cureman>>>>



************


Responses

pgsql-interfaces by date

Next:From: Alexey V. MeledinDate: 2000-02-22 11:27:57
Subject: Re[2]: [INTERFACES] Sharing Database Connection Among Different CGI scripts writen in different languages
Previous:From: Alexey V. MeledinDate: 2000-02-22 10:04:00
Subject: Sharing Database Connection Among Different CGI scripts writen in different languages

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group