Website master needs help with Memory Usage Limit being exceeded.
  1. Forums
  2. General
  3. Programming for CloudLinux
  1. Peter Dow
  2. 04.01.2012
  3.  Subscribe via email
I'd like to diagnose my website's higher memory usage problem. A log file of webpage memory usage would be useful.
Rate this post:
  1. 04.01.2012 18:01:30
  2. # 1
Peter Dow Accepted Answer
Posts: 1
Joined: 04.01.2012
Hi Newbie here.

I have an account with a reseller host and fr om the looks of my cPanel pages, cPanel has a Memory Usage Limit feature provided by your (CloudLinux) plug in to cPanel.

I have tracked you down fr om this page on the cPanel website.

This is a screen shot of cPanel - Resource Usage showing the memory faults being generated with a MEMORY Limit / LMEM of 700 MB.

Now, I have pointed out to the reseller and he in turn has contact his ISP hosting package provider quoting fr om that page and commenting as follows.

"VIRTUAL MEMORY Limit controls the total amount of virtual memory available for applications running within an account. By default, each customer is limited to :!: 1GB :!: of virtual memory. If a user application tries to use more than that such application will fail, as it hasn't been able to allocate memory. This usually shows up as error 500 (Internal Server Error) in a visitor’s browser.
The memory limit is the sum of virtual memory used by all applications in the account. It is important to note that we are limiting virtual, not physical memory. Multiple processes often share physical memory but don't share virtual memory. As a result you need to allocate much more virtual memory than physical memory. This is why it is important to leave virtual memory limits high enough."

My emphasis of 1GB or 1024MB presumably, which is significantly more than they had me on initially - 500MB and still more than I am on now 700MB. Seems to me there is evidence for saying - "at least give my users the default of 1024MB."

"Adjusting Limits
By default, limits are optimized for servers with 50-5000 accounts and require no tuning. Yet, often there are just a couple of bad neighbors on a server that you might want to fence a bit more tightly. Sometimes you would want to adjust limits if some site is having an issue. The customer might be willing to pay more, or you feel that the customer deserves to be able to burst a bit higher, as he isn’t causing problems for the server."

"Memory limits are the trickiest. Visitors will get an error 500 (Internal Server Error) when the site hits the memory limit. This error might mean something is wrong with the script, with server settings, or it might be due to memory limits. Differentiating is easy; just go to LVE Manager and do a search “By Fault” and sel ect memory. If you see that the site displayed in the search results it means that the memory limit was hit by that site. If you don't see it there the issue lies elsewhere. "

There I would suggest approaching the ISP with the argument that my site ought to be allowed to burst a bit higher as my site isn't causing problems for the server. Try asking them for my site only for twice the default of 2GB or 2048MB for MEM Limit / LMEM

After all it is only virtual memory that they are limiting. It seems pointless to wreck a website just to save virtual memory.

The above is by way of explaining my background.

Now meantime, I'd like to investigate and diagnose exactly where my website is using more memory compared to other sites.

I have an idea of which page is causing my problem - I have a webpage with IFRAMES and both the webpage and the IFRAME pages are PHP pages and the PHP also uses a MySQL database so I think the memory usage coming fr om php or mysql but I'd like to be sure.

I'd like to know for each page served how much additional memory usage has been added to the total.

If I know how much memory each page service has used then I can see when I make a change if the memory usage goes down and by how much.

So I am thinking I would like to have a log file showing how much memory has been used by each page served and I am looking for help to write the software to write such a log file (since no such log file is provided in the system).

Unfortunately the only data available for memory used in cPanel is over a period of time and that could be many pages served by many visitors to the site. It is not sufficient information to diagnose how much memory is being used by each PHP page on each occasion.

I am thinking I would like a log file something quite like the cPanel Raw Access Log file but with data items such as

    Visitor IP
    Date and time page served
    Page URL
    Memory used in serving this page :?:

Now I know how to write a log file fr om php but I don't know how to access the data for memory used for that page.

So since CloudLinux adds up the running total for Memory Usage value the CloudLinux programmers must know how to access this data and can perhaps suggest a way for me to access the values they are using.

It is not sufficient to access how much memory PHP alone is using, nor how much memory mysql alone is using. I need to know the exact value that is being added to the total by the plugin.

So can anyone here help me with programming this?

I have tried finding this memory usage problem "flying blind". I have tried using directory php.ini files to lim it PHP configuration memory_lim it but that has not solved the problem and I'd like some programmer tips to help me find out wh ere the memory usage is coming from please.

Thanks! :)

Also I would like to point out that this forum is behaving strangely and adding unwanted spaces in between words which I am not typing.
  • Page :
  • 1

There are no replies made for this post yet.
Be one of the first to reply to this post!
Submit Your Response
Upload files or images for this discussion by clicking on the upload button below. Supports gif,jpg,png,zip,rar,pdf
• Insert • Remove Upload Files (Maximum File Size: 2 MB)
To protect the site from bots and unauthorized scripts, we require that you enter the captcha codes below before posting your question.