pg.ddx.io  pgsql-interfaces@postgresql.org mailing list archive  
help / color / mirror / Atom feed
Re[2]: [INTERFACES] Sharing Database Connection Among Different CGI scripts writen in different languages
2+ messages / 1 participants
[nested] [flat]

* Re[2]: [INTERFACES] Sharing Database Connection Among Different CGI scripts writen in different languages
@ 2000-02-22 11:27  Alexey V. Meledin <avm@webclub.ru>
  0 siblings, 0 replies; 2+ messages in thread

From: Alexey V. Meledin @ 2000-02-22 11:27 UTC (permalink / raw)
  To: Nicolas Huillard <nhuillard@ghs.fr>; pgsql-interfaces

Hi,
    Nicolas!

Tuesday, February 22, 2000, 1:39:06 PM, you wrote:

NH> I use Mason for this kind of stuff (www.masonhq.com). Quoting the site :
NH> "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. "
NH> For your problem, there are many solutions using Mason. The one I use is persistent DB connections, tied to the Apache servers.
NH> 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
NH> only persistent in a whole page request, but also for all pages served by an Apache process.
NH> I think you can have a x100 performance improvement between your independent CGI design and this one (not laughing).

NH> Nicolas Huillard

Thanks for answer, but we doesn't use Perl for this. We use C/C++,
PHP, JSP (in future). Many programs are writen in this languages. It's
hard to transfer all to Perl. It's simple to make minor changes in
each script, that uses PostgreSQL.

Idea of Mason is good. But there is a little problem: We haven't our
own Server at ISP. We have only virtual hosting and possibilities they
provide to us.

Some people say that some databases (ORACLE and InterBase) provide
special database connection handlers that I can pass through my
non-concurrent scripts.
Does PostgreSQL has anything like this?

Regards, 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@webclub.ru><nick_as: <cureman>>>>





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

* Re[2]: [INTERFACES] Sharing Database Connection...
@ 2000-02-23 09:30  Alexey V. Meledin <avm@webclub.ru>
  0 siblings, 0 replies; 2+ messages in thread

From: Alexey V. Meledin @ 2000-02-23 09:30 UTC (permalink / raw)
  To: pgsql-interfaces

Hi,
    Jim!

Wednesday, February 23, 2000, 12:00:37 AM, you wrote:

JL> Alexey,

JL> We're a bit short on details here, but I'll make some assumptions and
JL> have a go.  If you have something like this:

JL> User login (e.g. "blue_eyes")
JL>     \
JL>  CGI script 1 sends query, e.g.
JL>       \
JL> select first_name from users
JL>  where login='blue_eyes';
JL>          \
JL>         returns "Anny"
JL>            \
JL>   (now here is the important part, does CGI1 _exec_ CGI2?
JL>    If so, write "Hello, Anny" to CGI2 and do the HTML 
JL>    translation later.)
JL>               \
JL>  CGI script 2 sends query,
JL>                 \
JL> select nmsg from mail_list
JL>  where login='blue_eyes';
JL>                   \
JL>                 returns 3
JL>                     \
JL>  (now do the HTML translation)

JL> If you are trying to write something that will generate combinations of
JL> queries, that is, CGI1 + CGI3 might return:

JL>         Hello, Anny.  You have 134 minutes of free connect time left.

JL> It is not too hard if you generate sentences on the fly, pass them to
JL> successive scritps, then string them together at the end with an HTML
JL> generator.

JL> Then again, if this is completely off the track, feel free to disregard
JL> it.  Good luck.

JL> Jim
Thanks for answer.
But each CGI script (CGI1-CGI2-CGI3) will call the backend and during
HTML generation there will be 3 backend processes started and 3 connection to
backend established :( Its very slow because of hard drive use.
Each CGI calls another via TCP Socket to httpd 80.

My assumptions are:
1. Write DAEMON that will serve all connections to PostgreSQL Backend.
At each connection DAEMON forks and serve the WWW Database
"TRANSACTION". Transaction has UID.
Each CGI script must know how to communicate with DAEMON (send and
receive queries).
When CGI calls another CGI it pass CONNECTION params where current
child daemon process is sittuated.
In other words I need a POOL for SQL QUERIES.
PS: Will it work? :)
PS2: May be someone knows something like this exept application
servers, that realy do that via Request Broker (I thing).

2. The second way is to Share Database Connection at the Database
Library level and pass Handle from one CGI to another (this like PS2).

Regards, 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@webclub.ru><nick_as: <cureman>>>>





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


end of thread, other threads:[~2000-02-23 09:30 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2000-02-22 11:27 Re[2]: [INTERFACES] Sharing Database Connection Among Different CGI scripts writen in different languages Alexey V. Meledin <avm@webclub.ru>
2000-02-23 09:30 Re[2]: [INTERFACES] Sharing Database Connection... Alexey V. Meledin <avm@webclub.ru>

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