Scott Marlowe wrote:
First point, is that PHP will not "release" memory it is using for buffers unless the machine gets low on memory, and why should it? It's faster to hold the last few pages in memory than to just flush them and hope nobody else wants to see it again.
-> Do you mean that there is no memory management, that if you have lots of scripts running, with lots of users, that the memory usgae will just grow and grow?
Second point is that PHP memory usage is still tiny compared to say cold fusion or some of the big servers like websphere, where each child thread can weigh in at 25+ Megs at idle, with no cache or buffer memory used.
-> My point is that the child processes are in the 25MB to 50MB ranges, which I feel is excessive, and I am wondering is there something that can be done to prevent this. Try generating a simple script with 10,000 lines of code, and watch the memory used, even if this code is never executed!
Third point is that until you test the machine under some kind of realistic mode, you won't see how it really behaves. My experience is that as simultaneous users increases, apache/php allocates less and less memory per process for buffer memory, so that total memory usage does NOT go up by simple factors for the number of users. i.e. the shared memory used does not grow at a linear rate with an increase in the number of users.
-> I have, I've ran my application with the ab, and with 5 to 10 real people as testers. Bothe show memory growing on every process used (we would often configure a server with 50 to 100 apache processes, and over 1GB of ram. But even this 1 GB ram gets used very quickly, the machine swaps, ... performance dies off.