| re: Big array, a big problem?
Try serializing the array and saving it into a text file. Deserialization
should be faster than PHP code parsing.
Uzytkownik "Steve" <stephenmcnabb@yahoo.co.uk> napisal w wiadomosci
news:9b1a4bb8.0401200836.cea86ba@posting.google.co m...[color=blue]
> I've a question regarding a bit of code I have. On my site I have a
> set of semi-static data (changes once a month or so) that needs to be
> displayed in various places around the site and integrated with
> dynamic data being fed in from a MySQL database.
>
> At the time of development I chose to put this semi-static data in to
> an array and include() it where required. However, the array is now
> getting quite big. It has 1200 entries of the form:
>
> $myArray["item1"]["Property 1"] = "Value 1";
> $myArray["item1"]["Property 2"] = "Value 2";
> $myArray["item1"]["Property 3"] = "Value 3";
> $myArray["item1"]["Property 4"] = "Value 4";
> $myArray["item1"]["Property 5"] = "Value 5";
> $myArray["item1"]["ArrayProperty"][] = "Other Value 1";
> $myArray["item1"]["ArrayProperty"][] = "Other Value 2";
> $myArray["item1"]["ArrayProperty"][] = "Other Value 3";
> $myArray["item1"]["ArrayProperty"][] = "Other Value 4";
>
> The PHP file it is in weighs in at 550KB and is used in most of the
> custom data driven pages I have.
>
> My question is how much of an effect will this design choice have on
> the performance of my Linux/Apache/PHP/MySQL server that is running on
> a Celeron 1.7Mhz/512MB machine?
>
> My site is fairly busy with over 300 concurrent users at peak times
> and I am currently experiencing high loads during these peak times. I
> disabled the sections of the site that use this file during a peak
> time and found the load to be a lot better. However, there are other
> things within these sections that could be causing high loads - I
> would just like to rule this out as a possibility.
>
> Thanks for any advice you can give,
>
> Steve[/color] |