jeremyapp Posted November 17, 2008 Share Posted November 17, 2008 Hi, I was wondering, if there is such a thing, what would be considered a "good" level of memory usage. I have a social-network project that performs multiple queries per request, which in itself, isn't such a bad thing. However, I have noticed that the average memory usage is 3.85MB per request. Is this considered high? Caching output isn't an option, because each page needs to be dynamically loaded and changes are frequent. I'm not sure what other information I should give to help someone answer, so if I'm missing anything, please let me know. If anyone has a big project and would care to share the amount of memory they use, that would also be a big help. Thanks! Quote Link to comment https://forums.phpfreaks.com/topic/133116-memory-usage/ Share on other sites More sharing options...
DeanWhitehouse Posted November 17, 2008 Share Posted November 17, 2008 Does it matter? Is it really affecting anyone? Quote Link to comment https://forums.phpfreaks.com/topic/133116-memory-usage/#findComment-692293 Share on other sites More sharing options...
jeremyapp Posted November 17, 2008 Author Share Posted November 17, 2008 I don't know if it will affect anyone yet. I haven't opened the site to the public, so my question is whether or not this will become an issue as traffic builds. So yes, it does matter, because if 3.85MB is a high amount of memory to be using, my site won't scale well. My question is whether or not this is the case. Quote Link to comment https://forums.phpfreaks.com/topic/133116-memory-usage/#findComment-692313 Share on other sites More sharing options...
Andy82 Posted November 17, 2008 Share Posted November 17, 2008 Hey, Surely if you have more memory available than what you are using then everything should be fine. Andy Quote Link to comment https://forums.phpfreaks.com/topic/133116-memory-usage/#findComment-692398 Share on other sites More sharing options...
DeanWhitehouse Posted November 17, 2008 Share Posted November 17, 2008 The memory usage will only effect the server the site is on, not the user. Edit: BTW, what the hell does this have to do with php? Post in the correct section. Quote Link to comment https://forums.phpfreaks.com/topic/133116-memory-usage/#findComment-692402 Share on other sites More sharing options...
cooldude832 Posted November 17, 2008 Share Posted November 17, 2008 You should think of it this way 1) Am I using so much bandwidth that when I meet my user goal my server will crash? 2) Am I sending so much data per transfer that users are discouraged by wait times or is it worth it? If you are satisfied with those you aren't using too much memory If you are on a shared hosting plan make sure you are within your limits set forth by the hosting company Quote Link to comment https://forums.phpfreaks.com/topic/133116-memory-usage/#findComment-692403 Share on other sites More sharing options...
jeremyapp Posted November 17, 2008 Author Share Posted November 17, 2008 If it uses a little under 4mb per request, with 1000 users on at once would my site be using 4gb of memory, or does it not add up that way. On a shared host, that much usage would surely pose a problem, which was the purpose of my question. Edit: I fully understand that this does not affect the user. My question is about server-side memory usage. The pages being served are not unusually large. Quote Link to comment https://forums.phpfreaks.com/topic/133116-memory-usage/#findComment-692407 Share on other sites More sharing options...
DeanWhitehouse Posted November 17, 2008 Share Posted November 17, 2008 They will only be requesting one page not all the site files, so i doubt one file is 3.58 mb in size? Quote Link to comment https://forums.phpfreaks.com/topic/133116-memory-usage/#findComment-692410 Share on other sites More sharing options...
cooldude832 Posted November 17, 2008 Share Posted November 17, 2008 I think this is correct: When you make a request that request starts to eat memory as the php is processed once something is echoed out or var_dumped or mysql_closed etc. it is freed from the resources and so when the requested is done the memory is freed. So using output buffer will make it eat that memory for longer along with unclosed mysql connections (this is less of a problem because mysql auto closes usually) You can't quantifiy it that simply you need to arbirtray look at the site and get user feedback and your system resource logs and then answer it. Quote Link to comment https://forums.phpfreaks.com/topic/133116-memory-usage/#findComment-692411 Share on other sites More sharing options...
jeremyapp Posted November 18, 2008 Author Share Posted November 18, 2008 So besides data that persists throughout a session, most memory is being freed at the end of a request? So it seems that it's more a question of memory being retained than the overall usage per request. That still leaves some unknowns, but I think that pretty much answers it. Quote Link to comment https://forums.phpfreaks.com/topic/133116-memory-usage/#findComment-692431 Share on other sites More sharing options...
cooldude832 Posted November 18, 2008 Share Posted November 18, 2008 sessions are stored as a file the data usage on session is dependent on the total # of sessions Quote Link to comment https://forums.phpfreaks.com/topic/133116-memory-usage/#findComment-692434 Share on other sites More sharing options...
DarkWater Posted November 18, 2008 Share Posted November 18, 2008 Just to let you know, 3.85MB per request is not too much at all. Honestly. Most PHP apps with activity and moderate-large databases(in my personal experience) usually exceed the default 16MB limit. =P Just what I tend to see. Quote Link to comment https://forums.phpfreaks.com/topic/133116-memory-usage/#findComment-692444 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.