Justtechjobs.com Find a programming school near you






Online Campus Both


php3-list | 199908

[PHP3] Re: performance of very large sites From: Jacob Stetser (lists <email protected>)
Date: 08/10/99

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Try using _conditional includes_ and only include what you need for
any particular page. I did this and speeded up a script of mine that
was running into about 2-3,000 lines of code.. it was usually running
between 1-4 seconds per page, and now it runs between .1-.9 sec per
page. I instituted a caching system and pages that are cached take
about 2-3 THOUSANDTHS of a second per page PHP execution time! (I
still use PHP to determine whether to serve a cached page or a real
page, but the script is only about 150 lines total before I call an
exit(); if it serves a cached page.

I don't have any real world testing of how this affects server load,
but I have a feeling that PHP does better the less code you give it
at a time, and that caching pages, if it can be done, can make
a script incredibly light when it comes to server load.

Example of conditional include

if($action=="buystock") {
        include("./includes/buystock.inc");
} elseif(....) {
        include("....");
} etc...

>Phil Glatz wrote:
>>
>> Using Apache 1.3.7, PHP 3.0.11 on a Solaris 2.7 Sun/SPARC AXMP
>> system (2 cpu, 2 GB memory).
>>
>> I'm working on a fairly large site that includes lots of PHP code
>> on every page. I've divided the code by areas of function, into
>> 22 include files. I understand from other list postings that a
>> series of nested smaller include files performs better than on
>> large file.
>>
>> I'm reading in a total of around 11000 lines. The site performs
>> very well under test, but is not scaling well. Running the
>> Socrates test program (similar to ab) and simulating 32 concurrent
>> users, the load average of my computer is well up into the teens.
>> It is not going into swapping. I started removing all code,
>> except for an ech "hello" and the include files. I then reduced
>> my include files to a series of simple assignment statements
>> ($k=12; kind of stuff). It is still taking what seems to be a
>> large amount of time (6 seconds) just to parse the code, so I'm
>> guessing the time is in parsing the PHP.
>>
>> The Solaris side seems to be set up correctly, and Apache tuning
>> is in order. Am I running against some limitations of how fast
>> PHP can parse code?
>
>
>I hope you don't mind me asking, but what the HECK are you doing
>with 11,000 lines of code per page?
>
>jason

At 4:53 PM -0700 8/9/99, Phil Glatz wrote:
>Using Apache 1.3.7, PHP 3.0.11 on a Solaris 2.7 Sun/SPARC AXMP
>system (2 cpu, 2 GB memory).
>
>I'm working on a fairly large site that includes lots of PHP code on
>every page. I've divided the code by areas of function, into 22
>include files. I understand from other list postings that a series
>of nested smaller include files performs better than on large file.
>
>I'm reading in a total of around 11000 lines. The site performs
>very well under test, but is not scaling well. Running the Socrates
>test program (similar to ab) and simulating 32 concurrent users, the
>load average of my computer is well up into the teens. It is not
>going into swapping. I started removing all code, except for an ech
>"hello" and the include files. I then reduced my include files to a
>series of simple assignment statements ($k=12; kind of stuff). It
>is still taking what seems to be a large amount of time (6 seconds)
>just to parse the code, so I'm guessing the time is in parsing the
>PHP.
>
>The Solaris side seems to be set up correctly, and Apache tuning is
>in order. Am I running against some limitations of how fast PHP can
>parse code?

-----BEGIN PGP SIGNATURE-----
Version: PGPfreeware 6.5.1 for non-commercial use <http://www.pgp.com>
Comment: Get my PGP key by sending email to: pgp <email protected>

iQA/AwUBN7BKTl/os7z/c4yVEQKLYgCg6zzdEMDY7Qddu8xGkQXicXiDR3MAmwZK
+dY/O+w5YbsAwrFHMj5C5Tcq
=uP65
-----END PGP SIGNATURE-----
Jacob Stetser

--
icongarden: Making good ideas grow.
http://icongarden.com/

Get our PGP public key by emailing pgp <email protected>

-- PHP 3 Mailing List <http://www.php.net/> To unsubscribe, send an empty message to php3-unsubscribe <email protected> To subscribe to the digest, e-mail: php3-digest-subscribe <email protected> To search the mailing list archive, go to: http://www.php.net/mailsearch.php3 To contact the list administrators, e-mail: php-list-admin <email protected>