My question is not about SPEED, i'm keen to minimize memory usage of my scripts. LAMP Web Application on limited share hosting resource (1GB Virtual Mem only) .
- Application reads from mySQL at every page visit to load from sys_config table and user table (pretty normal operation)
Should i load the configs to session instead? Knowing sessions are basically disk writing activity
Will this be lower memory use? (important) will this be faster execution? (less important)
- Application also writes to mySQL at every page load to maintain bits of data (last visit, and few micro data) this is imporant as it keeps the system aware if a user is still online
Should i write this microdata to file instead? (and periodically save it to DB if needed later?)
Will this be lower memory use? (important) will this be faster execution? (less important)
- Application uses AjAX and while user is on page, it AJAX loads data in the background at every 10 or so second interval. Each page has several sets of data that could be treated and thereby loaded differently (ie: contacts, online users, Groups). I separated each http/ajax request for each set of data assuming smaller chunks of requests will be easier/lighter for the server to process rather than one AJAX request pulling and preparing different sets of data at once.
Is this a good strategy to minimizing php memory usage?