How much memory does my script use?

How much memory does my script use?

am 23.08.2007 07:22:19 von FFMG

Hi,

My Hosting company is saying that I am using too much memory on the VPS
and that I should upgrade.

I am currently running at 65%-75%, (according to WHM).

It does seem a bit high, but I cannot see what could be using a lot of
memory. I have MySQL 5 and and php 4.4.
Is there any PHP code that I could use to 'check' how much memory a
script is using to run so that I could flag the problem ones?

How would you identify what process is taking large amount of memory?

FFMG


--

'webmaster forum' (http://www.httppoint.com) | 'Free Blogs'
(http://www.journalhome.com/) | 'webmaster Directory'
(http://www.webhostshunter.com/)
'Recreation Vehicle insurance'
(http://www.insurance-owl.com/other/car_rec.php) | 'Free URL
redirection service' (http://urlkick.com/)
------------------------------------------------------------ ------------
FFMG's Profile: http://www.httppoint.com/member.php?userid=580
View this thread: http://www.httppoint.com/showthread.php?t=19636

Message Posted via the webmaster forum http://www.httppoint.com, (Ad revenue sharing).

Re: How much memory does my script use?

am 23.08.2007 11:27:38 von Erwin Moller

FFMG wrote:
> Hi,
>
> My Hosting company is saying that I am using too much memory on the VPS
> and that I should upgrade.
>
> I am currently running at 65%-75%, (according to WHM).
>
> It does seem a bit high, but I cannot see what could be using a lot of
> memory. I have MySQL 5 and and php 4.4.
> Is there any PHP code that I could use to 'check' how much memory a
> script is using to run so that I could flag the problem ones?
>
> How would you identify what process is taking large amount of memory?
>
> FFMG
>
>

Hi,

Have a look at memory_get_usage() at php.net.
You could try to use it to get an idea of what parts of your script take
up what amount of memory.
Just place it at strategically placed points in your script, like before
calling a heavy function, and during the function, and when it returns.
Since we don't know your script, you'll have to identify the subject
actions in the script yourself.

Hope that helps.
Good luck.

Regards,
Erwin Moller

PS: Tip: If you have a question like this, first go to www.php.net and
type it in the searchfield. (If you type 'memory' there you find this
function.)

Re: How much memory does my script use?

am 23.08.2007 15:02:07 von Jerry Stuckle

FFMG wrote:
> Hi,
>
> My Hosting company is saying that I am using too much memory on the VPS
> and that I should upgrade.
>
> I am currently running at 65%-75%, (according to WHM).
>
> It does seem a bit high, but I cannot see what could be using a lot of
> memory. I have MySQL 5 and and php 4.4.
> Is there any PHP code that I could use to 'check' how much memory a
> script is using to run so that I could flag the problem ones?
>
> How would you identify what process is taking large amount of memory?
>
> FFMG
>
>

Are you talking about real memory or virtual memory? How much of each
do you have? And is it PHP and/or MySQL using the memory or something
else? Is this average or peak?

What are you doing in your scripts which might be memory intensive? I.e.
are you using large arrays? Graphic manipulation? Reading large files
into memory? Something else?

I regularly run 75%+ of real memory on my VPS's and they runs fine. But
I also have the systems tuned to run that way.


--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
==================

Re: How much memory does my script use?

am 23.08.2007 16:07:34 von FFMG

Jerry Stuckle;88408 Wrote:
>
> Are you talking about real memory or virtual memory? How much of each
> do you have? And is it PHP and/or MySQL using the memory or something
> else? Is this average or peak?
>
> What are you doing in your scripts which might be memory intensive?
> I.e.
> are you using large arrays? Graphic manipulation? Reading large
> files
> into memory? Something else?
>
> I regularly run 75%+ of real memory on my VPS's and they runs fine.
> But
> I also have the systems tuned to run that way.
>

Well, everything runs fine except for the WHM updates, every nights it
tries to update the system but for the life of me I cannot see what
could take so much memory, (maybe the unpacking?).

I am a windows user but my VPS is unix, so I am not sure if I am using
Virtual or real memory. And if I should allocate virtual memory or
not.
I am guessing that if I could allocate some virtual memory then the WHM
updates could run without a hitch.

The reason I ask is, last week the system went down and since then the
Hosting co is saying that it was my fault, (but I had changed nothing
in my scripts).
After complaining that they had screwed up the system and not me they
are now saying that I am using too much memory and the Updates are
crashing every morning.

I have disabled the updates for now, but i need to resolve the issue.

What are the unix commands to
- Get the virtual memory
- Get the real memory
- Set the virtual memory, (and what do you suggest it should be?)

Thanks

FFMG


--

'webmaster forum' (http://www.httppoint.com) | 'Free Blogs'
(http://www.journalhome.com/) | 'webmaster Directory'
(http://www.webhostshunter.com/)
'Recreation Vehicle insurance'
(http://www.insurance-owl.com/other/car_rec.php) | 'Free URL
redirection service' (http://urlkick.com/)
------------------------------------------------------------ ------------
FFMG's Profile: http://www.httppoint.com/member.php?userid=580
View this thread: http://www.httppoint.com/showthread.php?t=19636

Message Posted via the webmaster forum http://www.httppoint.com, (Ad revenue sharing).

Re: How much memory does my script use?

am 23.08.2007 17:46:44 von Jerry Stuckle

FFMG wrote:
> Jerry Stuckle;88408 Wrote:
>> Are you talking about real memory or virtual memory? How much of each
>> do you have? And is it PHP and/or MySQL using the memory or something
>> else? Is this average or peak?
>>
>> What are you doing in your scripts which might be memory intensive?
>> I.e.
>> are you using large arrays? Graphic manipulation? Reading large
>> files
>> into memory? Something else?
>>
>> I regularly run 75%+ of real memory on my VPS's and they runs fine.
>> But
>> I also have the systems tuned to run that way.
>>
>
> Well, everything runs fine except for the WHM updates, every nights it
> tries to update the system but for the life of me I cannot see what
> could take so much memory, (maybe the unpacking?).
>
> I am a windows user but my VPS is unix, so I am not sure if I am using
> Virtual or real memory. And if I should allocate virtual memory or
> not.
> I am guessing that if I could allocate some virtual memory then the WHM
> updates could run without a hitch.
>
> The reason I ask is, last week the system went down and since then the
> Hosting co is saying that it was my fault, (but I had changed nothing
> in my scripts).
> After complaining that they had screwed up the system and not me they
> are now saying that I am using too much memory and the Updates are
> crashing every morning.
>
> I have disabled the updates for now, but i need to resolve the issue.
>
> What are the unix commands to
> - Get the virtual memory
> - Get the real memory
> - Set the virtual memory, (and what do you suggest it should be?)
>
> Thanks
>
> FFMG
>
>

You need to ask these questions in a Unix/Linux admin group.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
==================