AndyBG Posted June 24, 2009 Share Posted June 24, 2009 I have a performance query. My site needs to open a very large (serialized) data file every time a page is loaded. I use shared hosting so I don't have the option to use advanced caching, so I have a question that you people may be able to help me with. Is it faster to store the data as a single 3MB object in a MySQL database then get it from there when the page loads, or should I continue to load it from the serialized file every time. Thanks Link to comment https://forums.phpfreaks.com/topic/163456-solved-persistent-data/ Share on other sites More sharing options...
Adam Posted June 24, 2009 Share Posted June 24, 2009 Why don't you run some tests and find out? Does the user download the 3MB of data or is it just for the server's use? Link to comment https://forums.phpfreaks.com/topic/163456-solved-persistent-data/#findComment-862496 Share on other sites More sharing options...
AndyBG Posted June 24, 2009 Author Share Posted June 24, 2009 This might sound a bit lame, but I haven't had the time to learn to use MySQL yet. I come from a real-time software engineering background where you don't get to have much to do with databases. If I was able to set up a rig to test the performance difference myself, I would have done so, but alas... The data won't be going any further than the server, but it can be very large - maybe a lot more than 3 Megs. I was simply hoping that someone would already know the answer, thus saving me from having to reinvent wheels ;-) Link to comment https://forums.phpfreaks.com/topic/163456-solved-persistent-data/#findComment-862686 Share on other sites More sharing options...
aggrav8d Posted June 24, 2009 Share Posted June 24, 2009 You'd be better off to normalize the data and break it into smaller pieces. Then the database engine can use it's own optimizations to get you the bits you need ASAP. Loading >=3mb every time a page is accessed will crush your server when traffic rises. Link to comment https://forums.phpfreaks.com/topic/163456-solved-persistent-data/#findComment-862773 Share on other sites More sharing options...
PFMaBiSmAd Posted June 24, 2009 Share Posted June 24, 2009 Without knowing the details of what the data is, how much of it is used on each page, and what size it could grow to, there is no way to answer your question about what method would be best. In general, just based on the size, you should have migrated it to a database, with a separate row for each separate item, after it was a few 100k in size. Storing it as one serialized entity in a database is a problem due to the packet size restriction of how much data you can transfer into and out of a database at one time. Link to comment https://forums.phpfreaks.com/topic/163456-solved-persistent-data/#findComment-862790 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.