Jump to content

[SOLVED] Persistent data


AndyBG

Recommended Posts

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

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 ;-)

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.

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.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.