homepage Welcome to WebmasterWorld Guest from 54.166.62.226
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Pubcon Platinum Sponsor 2014
Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
Forum Library, Charter, Moderators: coopster & jatar k

PHP Server Side Scripting Forum

    
Optimize Memory Usage?
storing data in session vs. running same methods on every page
willis1480

10+ Year Member



 
Msg#: 3941676 posted 6:23 pm on Jun 27, 2009 (gmt 0)

So my main question is this.

I want to determine wether I should store information in session or run the method for every page call.

Storing to session costs about .5 MB. How can I determine the use of resources for running the methods that create the data?

I need the data for every page. I figure its less work recalculating the data all the time, but has a memory cost.

The memory cost should be the same when the page is being requested regardless of Session or running the data on the fly, but CPU usage will go up during the calculations.

However, I believe php garbage collection will release the memory usage as soon as page request is complete.

Any ideas on how to optimize this?

 

lethal0r

5+ Year Member



 
Msg#: 3941676 posted 12:09 pm on Jun 28, 2009 (gmt 0)

well a useful guideline is to store data that rarely changes as session data (e.g. username, dob).

sorry i cant offer anything more specific.

willis1480

10+ Year Member



 
Msg#: 3941676 posted 12:38 pm on Jun 29, 2009 (gmt 0)

Thanks...what Im going to do, is calc the array size, and set some limits and play with that. Ill also set a session on/off global for using session for my arrays.

Play with those limits and try to figure out the best combination.

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved