Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 26 Apr 2006 18:08:26 +0100
From:      Miguel Ramos <freebsd@anjos.strangled.net>
To:        Pgold <pgoldone@gmail.com>
Cc:        freebsd-questions@freebsd.org
Subject:   Re: CGI "service".
Message-ID:  <1146071306.4088.15.camel@compaq.anjos.strangled.net>
In-Reply-To: <96341e070604260807p5996d2f0n2b7d9ce818e8bf3d@mail.gmail.com>
References:  <96341e070604260807p5996d2f0n2b7d9ce818e8bf3d@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
Qua, 2006-04-26 =E0s 12:07 -0300, Pgold escreveu:
> Hi, I=B4m developing a web app in C++. But it loads a huge amount of
> from a Database to memory, and I can=B4t afford doing this everytime
> someone asks for the page. Is there a way to make the program to keep
> running, and reading requests made via CGI?
> If it helps, i=B4m running FreeBSD 6.0 with Apache 2.2.
>=20
> Greets,
> Pedro.

If the problem is keeping the data in memory, I don't think even
mod_perl or mod_python will help you.

Sugestion #1
- write an apache module; that will be always in memory. I'm not sure if
it will be hard to compile.

Sugestion #2
- forget about C++ and use mod_mysql or whatever is available for your
DBMS.

Sugestion #3
- split your web app in two parts: cgi scripts (or apache module) and a
server app that keeps data in memory and responds to requests made by
cgi scripts. Communication between the two can be made with pipes,
sockets, shared memory or whatever you like.

Sugestion #4
- load less data from the database; only that which you need to generate
output. (For example, for an SQL database, use WITH, HAVING, OFFSET and
LIMIT wisely).

Any more sugestions?

--
Miguel




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?1146071306.4088.15.camel>