php - How to handle large amounts of data to achieve good performance? -


i have files of size 1mb 2mb (i need 1 file @ time) want load on website using fopen() , show related information on website. have read these files every , search inside files , show info:

so wanted know option better concerning performance,

  1. whether should open file using fopen() , use.

  2. whether should convert file data array , load , use.

  3. whether should insert data mysql , fetch , use.

  4. whether should load/fetch info , serialize , save file , use future purpose use.

or other options available.

data , around 30,000 lines:

1000,asther,asther path,0,50,,70,5,2,,5,fff,7,2,,24,,45,,{ "is girl" },{},{}  1001,sinkn,sinkn keth,0,50,,70,,7,34,6,fff,7,2,65,3,,67,,{ "like flower" },{},{}  

if have 1 file load data from, file easier mysql. array definition in file better option (save time parse / unserialize).

if have quite number of files, slow scan directory , fopen files 1 one. doesn't turn files array / serialized data. file operation plus directory scan slower in php in mysql. mysql automatically index data it'll better php complex search. mysql better option in case.


Comments

Popular posts from this blog

node.js - Bad Request - node js ajax post -

Why does Ruby on Rails generate add a blank line to the end of a file? -

keyboard - Smiles and long press feature in Android -