|
Posted by Erwin Moller on 07/20/05 11:43
Stephen Oakes wrote:
> I am developing a site which will be very dynamic. Most of the displayed
> content will come from a database (MySql) via PHP.
>
> Some types of pages will change frequently (something like a forum page
> which is always having new content added to it) and others will only
> change once a day (a new news item gets added, etc.).
>
> Although I can optimise my queries and my PHP scripts, there is still the
> potential for the site to get congested, once a large number of people
> start accessing it.
>
> The question is how do I make sure it performs well? There are several
> options I might consider, such as:
> - don't do anything, but rely on server caching. Is PHP / Apache caching
> any good?
> - Periodically "publish" my PHP-generated pages to flat HTML pages and
> serve them up instead of the PHP.
> - Other things?
>
> Any thoughts?
>
> --
> Stephen Oakes
Hi Stephen,
I am unsure what you expect from the first solution.
Is there any way Apache/PHP can cache requests that depend on
databasecontent that changes all the time?
I don't think so, but maybe I am wrong. (Happens daily. :P)
You second approach is easy to implement, and easy to understand.
I did it before, and it works realy easy.
The approach I choosed was a little different from the one you describe, but
similar:
1) I identified a bunch of pieces in pages that seldom change but need a lot
of Database-querying.
2) All those pieces were made include-files. Nothing fancy, just a plain
include.
3) I programmed on relevant 'triggers' (Not database-triggers) on places
where the includefiles were modified (mostly by an admin that changed
something in the database). These triggers simply called a routine that
rebuilded the included files.
In this way you:
- do not need a cronjob or anything like that.
- And all your includefiles are always up to date. Immediately.
Of course, it is up to you to decide which pieces on your site are suitable
for this approach.
Just my 2 cents.
Regards,
Erwin Moller
Navigation:
[Reply to this message]
|