At 1/26/2007 12:25 PM, Otto Wyss wrote:
Paul Novitski wrote:
In both cases I store the text in database tables that contain a
language field I can select on to match the user's request.
I wonder if retrieving static texts from the database draws too much
performance. I know from somebody who stores texts in large data
arrays an uses shared memory, yet I haven't figured it out how.
I consider storing static texts as defines and just load a different
definition file when the user switches language. Is this practical?
If you store your text in a data table and retrieve it with a query,
you're leaning your weight on SQL (or your database engine of choice).
If you store your text in individual text files, you're leaning on
the operating system's own database system to locate, open, and read the file.
If you store all your text in a single text file, you're leaning on
server memory to store everything when you may only want a few chunks.
Unless your site is insanely popular or huge, does the method really
matter so much? The idea of storing all the text for an entire
website in a single text file sounds scary but feasible if the site
size is modest. Servers and database engines are built to perform
file I/O quickly & efficiently, and I find it unlikely that you'll
strain the system unless your traffic is enormous, your content huge,
and your queries inefficient.
Is your "static text" really static? How often is it modified? If
you're really concerned about streamlining, consider building your
pages dynamically from a database but then caching them on the server
as plain html, refreshing individual files in the cache when your
SQL-based content changes.
Regards,
Paul
__________________________
Juniper Webcraft Ltd.
http://juniperwebcraft.com
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php