You are here: Re: [PHP] PHP Cache (was PHP load to high on server) « PHP « IT news, forums, messages
Re: [PHP] PHP Cache (was PHP load to high on server)

Posted by Jochem Maas on 01/18/06 19:30

on your *nix cmdline type this:

pear install apc

(if you don't have pear installed then you should fix that first ;-)
now read here about how to use it:

http://php.net/apc

I love it even though it crashes when caching the opcodes of certain
class files (php5 files that make use of __get()/__set() to retrieve
[sub-]objects).

take note that APC does 2 things:

1. op code caching
2. manage some shared memory (a central place where you can stick stuff
that needs to be read again and again and again; but doesn't need updating
very often)

by all means come back if you get stuck or have specific issues ( I can't
garantee I will be able to help - I'm only a little further down the apc road
than you**)

rgds,
Jochem

** the internals mailing list archive can attest to the ammount of
times I have badgered Rasmus about APC ;-) (Rasmus cowrote APC btw)

Albert wrote:
> I wrote:
>
>>I am running SuSE 9.2 (Kernel 2.6.8-24-default) with Apache 2.0.50 and PHP
>>4.3.8 (as an Apache module) on a Celeron 900 with 304MB RAM. This machine
>>is used for testing. We have made some changes to our PHP application and
>>now the machine is having trouble serving the pages. Apache is occupying
>>almost 90% CPU usage.
>
>
> I have resolved this issue by removing a piece of code which reads a set of
> parameters from a database. It seems that the hard disk on the machine is
> quite slow, slowing down all database access with it...
>
> I now check if the parameters are set in the session, if it is I use them
> otherwise I read them from the database and save it as session variables.
> When it changes I simply remove it from the session so it forces an update.
> So far it is working quite well.
>
> I now want to go and take all the static stuff that the user will configure
> once in a life time and put it in the session and only update it when it
> changes instead of reading it from the database every five seconds or so.
>
> For this I don't want to use a disk based session handler. I want the
> session variables to remain in memory (about 20KB per user) as to speed up
> the whole process.
>
> I also want an opcode cache to cache the compiled pages on the server in an
> attempt to speed up the HTTP server.
>
> For this I wanted to use mmCache (actually I want to use Zend Performance
> Suite but first I need to prove that it is worth $ 1000 per CPU and from the
> stats on the mmCache site mmCache is faster...) but it seems that the
> mmCache project has been abandoned as there have been no work done on it
> since 2003.
>
> Can someone confirm this or recommend an alternate cache (doesn't have to be
> free but should break the bank) which will do what I want?
>
> Albert
>

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация