Few months ago I bought new small VPS box (OpenVZ, 128 MB RAM) in order to place there a new monitoring node of my site monitoring system. Such small amount of RAM is a challenge for operating system optimisation techniques (OpenVZ doesn’t have “swap” as Xen does).
First of all I discovered that apache2-mpm-worker (Apache implementation that uses threads) consumes more memory (100MB) than the classic version that use separate processes (20MB). I had to switch to apache2-mpm-prefork version then.
Next unpleasant suprise: small Python app eats 100MB of virtual memory! I checked that virtual (not resident) memory is taken into account by VPS. I applied some tools to locate memory bottleneck, but without success. Next I added logs with current memory usage to track call that causes big memory consumption. I tracked the following line:
server = WSGIServer(app)
is guilty for high memory increase. After few minutes of googling I located problem: default stack size for a thread. Details:This line creates few threads to handle concurrent calls
Stack size is counted towards virtual memory
Default stack size is very high on Linux (8MB)
Every thread uses separate stack
=> multi threaded application will use at least number_of_threads * 8MB virtual memory!
First solution: use limits.conf file. I altered /etc/security/limits.conf file and changed default stack size. But I couldn’t make this change to alter Python scripts called from Apache (any suggestions why?).
Second (working) solution: lower default stack size using ulimit. For processes launched from Apache I altered /etc/init.d/apache2 script and added:
ulimit -s 256
Now every thread (in apache / Python application) will use only 128 kB of virtual memory (I lowered VSZ from 70 MB to 17 MB this way). Now I have additional space to enlarge MySQL buffers to make DB operations faster.
There’s even better place to inject ulimit system-wide: you can insert this call in:
/etc/init.d/rc
script. Then ulimit will be applied to all daemons (as Apache) and all login sessions. I reduced virtual memory usage by 50% this way.
Note: you may increase stack size on stack overflow errors. In my opinion 256 kb is safe option for most systems, you may increase if in doubt. Still memory savings are big.
Last year my web host stated that my site was over utilizing allowed resources for my plan. Specifically, they state that I was overusing the CPU. At the time, I had to upgrade my plan in order to stay online. I would like to move to a new host, but the prospective hosts are all suggesting a dedicated server because of my CPU usage. I don't want to pay that kind of money, so I would really like to curb the CPU problem. Does anyone know how to reduce the CPU of a Wordpress blog? I tried posting this question over at Wordpress.org, but I haven't received a single reply.
now iam haveing more that 0.50-1.20 cpu useage,also cpu useage is also increased i hosted only 6 site out what only one site use MSQL all other site are plain download site,how to reduce the cpu load can u figure me out this issue also give me some tips to reduce the cpu usage
When my OpenVZ VPS is running with lighttpd, RAM usage is very low, but when I switch to Apache, RAM usage goes all the way up to the max. I've had this happen to two VPSs already and can't figure out why this happens.
I also have two other VPSs, one Xen and one Virtuozzo and have no troubles with Apache.
Let say your VPS has 128MB of memory. My understanding would be that if you had, say, another 128MB of 'burstable' memory, that if another guest on the system wasn't using all it's memory, or if there was some spare on the system, then your VPS could use that.
But, how much memory does your VPS really think it has available? and what happens if the other VPS (or the system) decides it wants it memory back?
Does OpenVZ just start killing off your processes until it free's up enough memory?
I just got a new server Dual E5520 with 6GB RAM, SAS 15k rpm raid10. It's running well. However, the memory usage is just around 2.5GB, even when I have more traffic. Here is the kernel info
Quote:
# uname -a Linux server2.[url]2.6.18-128.1.10.el5 #1 SMP Thu May 7 10:35:59 EDT 2009 x86_64 x86_64 x86_64 GNU/Linux
Any idea that we can put more content into memory?
In the last two weeks I have noticed a major issue concerning memory usage. HyperVM and Top (via console) report two very different amounts of memory being used. On a fresh rebuild, my overall usage should be no more then 22mb. However, HyperVM reports 45mb whereas Top reports 11mb. Notice the huge gap?
I was told by my VPS host that OpenVZ / HyperVM is to blame. The overwhelming issue is: if I pay for 256mb of ram and I'm being cut short, then I'm obviously over paying. What's more: how can I tell whether or not I'm being cut short?
Has anyone run across these problems in the last two weeks?
We're in the process of setting up our new VPS Server, and we can create a VPS with 256MB memory and with 512MB memory fine, but when creating one with 1GB memory, we get the error:
Could Not Start Vps, Reason: Unable to fork: Cannot allocate memory: Not enough resources to start environment: Container start failed:
Even though the server has 4GB RAM and no other VPS's running. Any ideas? Thanks.
[Edit]We now seem to get the problem for all our VPS's. I think it may be something to do with the Server not unallocating the memory, as we've provisioned and de-provisioned quite a few Servers
It seems that a user may get more percentage of memory purchased for real use. I've got a xen VPS which has access to all 8 CPU cores. Guess this is a good thing to be able to burst CPU resources
But this requires lots of kthread running to be able to access all CPU resources, which in turn consumes quite some memory, a valuable, limited resource on a small VPS instance.
The output above is grathered when almost no other services are running except sshd.
While XEN VPS surely consumes more memory than OVZ VPS, I would suggest the Xen VPS can be built in such a way less memory is required to just do the housekeeping.
Of course, that would imply careful provisioning, maybe less "overselling" for the sake of lack of a term. The bottom line is how we can reduce the memory usage, while ensure individual VPS instance can still have fair share of CPU if needed.
Is there anyway in the VPS kernel config which can disable access to certain CPU core, thus reducing the number of kthreads and etc?
I do not know if i have problems with my vps but "top" output looks strange for me. It looks like apache processes have huge VIRT parameter and all processes have huge SWAP param.
My VPS 712 guaranteed and 1024 burstable. I'm running 10 virt hosts with very small traffic. Totally not more than 500 visits/day. Most of sites are static and only two are PHP.
how much adding php to apache will increase memory usage on a VPS? This would be php5.
I need it to use phpMyAdmin to manage my MySQL database (actual site is running off tomcat but jspmyadmin won't work for some reason).
Or can someone recommend a database design tool (I've used toad data modeler before) which I can use on my home pc to generate SQL statements for execution on the server (and please don't say notepad).
I am trying to run tomcat on my linux server and I am getting memory allocation error. When I see check memory usage it is full, but when I check the cpu usage it show as this:
Am using Hypervm,my all vms are not using more than 512 MB memory but when i click on server as localhost the there is show maximum memory usage I have total 8 GB it always show 5-6 GB usage and never drop down, How can I fix this matters?
I was just wondering about DA memory load. Like CPANEL load around 300mb and LXADMIN about 20mb. I was going to get VPS with 256 only to host 40-50 church sites with just static html, not dynamic or anything. Greatly appreciated with your input. I'm still learning all of this
I have a VPS with 384 MB RAM, with free about 100-120 MB. I've upgraded to 512 MB (to have some other features...). I notice that the memory usage is always about 250-300 MB. For example, now:
Code: [root@host ~]# free -m total used free shared buffers cached Mem: 512 311 200 0 0 0 -/+ buffers/cache: 311 200 Swap: 0 0 0 But PHP tells "out of memory" in some tasks
The current PHP config is memory limit 192 MB (it was 96 MB, then I tried to increase). [url]
Code: <b>Fatal error</b>: Out of memory (allocated 19660800) (tried to allocate 39 bytes) in <b>##hidden##/includes/joomla.php</b> on line <b>3041</b><br />
I'm currently playing with my dedicated server, it isn't much but for learning purposes it's more than enough.
I have CentOS 5.3 installed on the server.
It's Intel Atom 330 with 2 GB RAM.
Now my question is:
When server is running nothing but basic install memory comsumption is aroun 500-600 MB.
Today I have rsynced 11 GB of data from one of my VPSs to the ded server and the memory comsumption on the server sky rocketed to 2 GB, leaving only 56 Mb free.
Since a short while back my server memory usage is 100%. The amount of visitors decreased so the memory should be lower in consumption than before.
I suspect a newly installed script could have bugs or misuse of the server by hackers. I don't know how to see on the server what script or what part makes the memory use so high. I see Apache is very high but I'm on VPS. Technical data........
My managed dedicated server at 1and 1 has very low load, but quite slow, I was trying to figure out the reason. The top and free command ( I run at midnight without traffic), here is the result. Can anybody tell me if the memory usage is normal, anything suspicious. Look like the memory usage is high even with no traffic, but 1and 1 support say that's because it's reserved for cache.
It tells me that I only have 50 MB of memory left and it drops down to ~20 MB after Apache has been running for a while. Once it runs out of that 20 MB I will start swapping right? I have also run this command and do not see any process taking up anywhere close to what is being reported: