homepage Welcome to WebmasterWorld Guest from
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Pubcon Gold Sponsor 2015!
Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
Forum Library, Charter, Moderators: coopster & jatar k

PHP Server Side Scripting Forum

Question on memory PHP5 - XML simplexml load file

10+ Year Member

Msg#: 3501876 posted 1:10 am on Nov 11, 2007 (gmt 0)

Quick question when it comes to PHP5's simplexml_load_file function.

Lets assume an xml file is close to 1mb, when the function is used, is the entire file loaded into memory? Meaning 1mb of storage is taken while this function is running?

Now assume 30 users all request the same page which uses the simplexml_load_file function to load the 1mb xml file, are 30 mb on the server then set aside and locked?

Guess I am asking if this is a worthy cause to investigate storing alot of data in these xml files and writing the program around reading from these files rather than a database.

Thanks for the overview response!



WebmasterWorld Senior Member eelixduppy us a WebmasterWorld Top Contributor of All Time 5+ Year Member

Msg#: 3501876 posted 6:50 pm on Nov 19, 2007 (gmt 0)

It depends on where you are getting this data. Are you just creating an XML file just for the sake of creating an XML file? Is there an actual reason that you need it to be XML? If not, you are probably better off with a database, anyway. Also, you should be using cache to your advantage all the time.

As for your initial question, I am not exactly sure what it would do in that case; you should run a quick test to find out.


10+ Year Member

Msg#: 3501876 posted 7:31 pm on Nov 19, 2007 (gmt 0)

Thanks for the response!
My situation is that nearly 90% of the time a script is "Selecting" data from the database to display for the user. During this data's lifetime it may be selected close to 200 times a day, times this by numerous amounts of other data sets and you can see my DB being taxed.

I figured a good way to proceed might be to store this information in XML, have the script parse and use data from the XML. When a change occurs with the data a python script could re-write the XML.

The large XML files occur when a summary of all the data sets are compiled.

Global Options:
 top home search open messages active posts  

Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved