Welcome to WebmasterWorld Guest from 54.166.191.112

Forum Moderators: coopster & jatar k

Message Too Old, No Replies

Question on memory PHP5 - XML simplexml load file

     
1:10 am on Nov 11, 2007 (gmt 0)

Full Member

10+ Year Member

joined:June 24, 2004
posts: 202
votes: 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!

6:50 pm on Nov 19, 2007 (gmt 0)

Senior Member

WebmasterWorld Senior Member eelixduppy is a WebmasterWorld Top Contributor of All Time 10+ Year Member

joined:Nov 12, 2005
posts:5966
votes: 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.

7:31 pm on Nov 19, 2007 (gmt 0)

Full Member

10+ Year Member

joined:June 24, 2004
posts: 202
votes: 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.

 

Join The Conversation

Moderators and Top Contributors

Hot Threads This Week

Featured Threads

Free SEO Tools

Hire Expert Members