473,405 Members | 2,185 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,405 software developers and data experts.

Big array, a big problem?

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
Jul 17 '05 #1
2 5154
Steve wrote:
(snip)
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,


I think that the worse for performance your current setup causes is due
to opening (and closing) of the include file. Perhaps you can put that
file in a ramdisk (at system startup?); and then include it from there.
<?php include '/ramdisk/php/static_data.inc.php'; ?>

I don't think there should be any problem for PHP to handle that amount
of data (as long as you have RAM; 300 * 550K ~= 165M).
--
--= my mail box only accepts =--
--= Content-Type: text/plain =--
--= Size below 10001 bytes =--
Jul 17 '05 #2
Try serializing the array and saving it into a text file. Deserialization
should be faster than PHP code parsing.

Uzytkownik "Steve" <st***********@yahoo.co.uk> napisal w wiadomosci
news:9b*************************@posting.google.co m...
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

Jul 17 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Robert | last post by:
Im having a problem with an array that is put into a session. I want to be able to remove any element, but when I loop through to display them, it doesnt work right. I believe its because of the...
2
by: Zenobia | last post by:
I have a problem. I need to look up several values stored in arrays. Each value is stored as a pair. The first (number) represents the probability of this item occurring. For instance, in the...
3
by: engartte | last post by:
Hi all, I did the solution with consultation of some experts on the following problem: Declare an array of length of 10 and read integers into the elements of the array from keyboard.Then...
2
by: farmer | last post by:
I need to populate a listbox of other listview with selected listview items.although the following code works perfecty I want to use an Array (for various reasons) for Each ListItem In...
0
by: helldiversafe-news | last post by:
Hi all, I will use a apache soap service with an .net c# client and have a problem with an complex array: <?xml version='1.0' encoding='UTF-8'?> <SOAP-ENV:Envelope...
2
by: julian_m | last post by:
let's say that I've an array like this: $AL_array = Array ( => Array ( => 1 ) , => Array ( => 2 ) , => Array ( => 3 ) , => Array ( => 4 ) , => Array ( => 1 ) , => Array ( => 2 )...
8
by: SpreadTooThin | last post by:
Basically I think the problem is in converting from a 32 bit integer to a 16 bit integer. I have two arrays: import array a = array.array('L', ) b = array.array('H', ) b = a
2
by: arda | last post by:
how i can put 2d array to a pointer? In the below program i am giving a first value to output_bit and then start to a loop and putting the new values to an another array as called newdata. But as i...
2
by: Toni | last post by:
I have ImageButton array. I have defined onClick event and it works. But in this function I can not use control propetries. I want to use index of ImageButton which is clicked and ImageURL...
3
by: Robert Bevington | last post by:
Hi all, I ran into memory problems while tying to search and replace a very large text file. To solve this I break the file up into chunks and run the search and replace on each chunk. This...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.