I have a VPS with 256MB of guaranteed memory, and no burst/swap. Having little memory like this is quite common for a VPS and I want to know how to make the most of it while running websites. By far the biggest culprit for taking my memory is Apache and I'm not convinced that the default setup makes sense on a VPS.
I know there are other daemons out there that use considerably less memory, such as lighttpd, but enough people (myself included) are going to use Apache regardless (they might require some of the advanced features after all) so it is worth knowing how to get the most out of it.
Apache 2 has various mpm options, most notably prefork and worker. As I understand it the prefork method forks processes to handle requests ahead of time, and can fork more on demand if required, each process handles one request at a time. Worker uses threads, again created ahead of time and on demand, each thread handles one request at a time.
With the default configuration and prefork Apache spawned 6 processes each taking about 5MB, so there goes 50MB in total. With workers it wanted to create 50 threads, each with a 10MB stack, this instantly went over the memory limit so wouldn't start at all. Thankfully the stack can be adjusted using the ThreadStackSize setting so it can be made to run, but even after this what do you really have for your memory?
One problem with having one request per process/thread is that, again by default, Apache has a keep alive setting of 15 seconds. This means that once a request has been processed, the process/thread is then kept around for up to 15 seconds in case the client wants to do anything else. With prefork that is 5MB of memory being used, and even with threads with a reasonable 1MB stack size there is still a huge amount of memory wastage on a connection that might not even do anything. Meanwhile other visitors might be getting out-of-memory problems as Apache tries to spawn more handlers to meet demand.
I think it should be fairly obvious that the worker mpm is the best option here, if everything works fine with a 1MB stack then the thread overhead is considerably lower than the process overhead.
The new events mpm should relieve this problem as it uses an event queue to keep an eye on keep alive connections rather than a whole thread. Unfortunately this mpm is not considered stable yet, so in the mean time I am wondering if VPS users should just disable keep alive, or at least adjust it to just a few seconds.
The benefit of keep alive is that it reduces network traffic and CPU load as there is a small amount of overhead in setting up a new TCP connection. When servers had 400MHz chips and massive 256MB of ram this was a good trade off. But now VPS often have access to much more powerful processors, and the same 256MB isn't considered massive any more so a lot of applications are less frugal and less adept at running in this environment.
In the unlikely even that Apache had 200MB to play with, using 1MB threads means that the system can handle 200 idle connections before running out of resources and failing to handle new connections. With a keep alive of 15 seconds you can support 200 connections per 15 seconds. In light of the fact that many newer browsers will open 4 simultaneous connections (up from the previous 2) that is only 3.34 users per second. Drop the keep alive to 1 second and you can handle 50 users per second. These numbers are unrealistic because they assume the request handling itself takes no time at all, but a lot of requests can be handled in split seconds so maybe these numbers aren't so far fetched. If the request handling takes 250ms and you turn keep alive off you could handle 200 users per second.
I am thinking that it would be great to have a reverse proxy sat in front of Apache, one that used an event queue and thus had little memory overhead for maintaining incoming connections, but closed down its connection to Apache after each request. Unfortunately I do not know of one.
I'm running 4 websites on a quad core xeon x3220, with 2gig of ram. It's 4 proxy sites, they are running fine and dandy, except for the fact that even when their is little traffic going to them ram is still just as high. I'm running debian 4.0, and heres a copy of my footer Apache/2.2.3 (Debian) mod_python/3.2.10 Python/2.4.4 PHP/5.2.0-8+etch11 mod_perl/2.0.2 Perl/v5.8.8. I'v modified nothing since I got the server, I installed apache2, and awstats, that's it. I'v read up about optimizing and it hasn't helped much, and I thought maybe their is proxy specific tweaks I could make to the conf.
I have also enabled SSL in the apache http server using mod_ssl. The load balancing works fine, but in all the response headers these connection attributes are added "Connection: keep-alive keep-alive: timeout=5"
Is there a way to remove these headers? I do not want these headers to be added in the response. I have also tried mod_header to unset these headers, but no use. HTTP/1.1 protocol is being used, so eventhough the connection is not present in the header, the connection would should be considered as persistent. Why is apache sending these attributes explicitly in each response. I just want to get rid of these attribute...
As i seem unable to get a decent reply to my ticket which is currently open with you (#210268) through your ticketing system. I am afraid i need to resort to posting here.
As i have asked in the ticket numerous times, can you please provide a reason as to why our server was offline? This ticket has been open since 29th April and so far we have only been told that you had "a couple of issues with you system".
KeepAlive Off MaxKeepAliveRequests 100 KeepAliveTimeout 3 MinSpareServers 5 MaxSpareServers 10 StartServers 5 MaxRequestsPerChild 0 ServerLimit 1024 MaxClients 250 ExtendedStatus On ServerSignature Off
My php.php info:
Apache Version Apache Apache API Version 20051115 Server Administrator webmaste@MYDOMAIN.com Hostname:Port www.MYDOMAIN.com:0 User/Group apache(48)/48 Max Requests Per Child: 0 - Keep Alive: on - Max Per Connection: 100 Timeouts Connection: 60 - Keep-Alive: 1 Virtual Server Yes Server Root /etc/httpd
I have a vPS and couldnt connect my SSH or reset my server about 72 hours and they didnt reply my ticket about 24 hours. also server's panels are down so i couldnt get backup.
Are there any person like me? My VPS has problems after they migrate thier node from Softlayer . I want to get my backup folder now but they arent replying me.
if anyone knows the status on vps4less.de? I have a VPS with them that was set to renew on 10/29, but I canceled way before then, or at least I thought it should have. I noticed a couple days after the renew date that it was still online so I sent another one, this time via WHMCS and request account cancellation link. So far, it's been 10 days (now 11/8) and I haven't heard from them, and my VPS is still online. I received an automated invoice overdue notice today, but I know that's just because they haven't closed my account yet.
I am using VPS (Linux OS), and web server is apache. I totally have 768M memory. When the system start up, I usually have 550M-600M free memory.
I just found that each httpd process occupied almost 20M memory. It's horrible, I was though that 1M for each process is reasonable.
Now the httpd.conf looks like: StartServers 5 MinSpareServers 5 MaxSpareServers 10 MaxClients 150
But if I change StartServers to 50, httpd will eat up all my memory. I did some calculation, that 600M/20M = 30. This means if apache have more than 30 concurrent requests, There server will be out of memory. The "MaxClients 150" is meaningless! I was though 150 is too small.
I only use apache with php, they are complied by WHM. Should I re-complied the apache with php?
So mysql is using 6% of memory, xcache is set to 256MB, and rest is for apache. So my question is what do I need to do? Compile apache to have smaller memory foot print or cut down more quicker idlers? Usually there is no problem, but if I got like 300+ people browsing the joomla site all day eventually system gets out of memory and starts swaping. Any ideas?
Quote:
Server Version: Apache/1.3.37 (Unix) mod_gzip/1.3.26.1a mod_auth_passthrough/1.8 mod_log_bytes/1.2 mod_bwlimited/1.4 PHP/4.4.7 FrontPage/5.0.2.2635.SR1.2 mod_ssl/2.8.28 OpenSSL/0.9.7a Server Built: May 31 2007 00:49:37
Quote:
Current Time: Monday, 24-Sep-2007 19:54:50 CEST Restart Time: Monday, 24-Sep-2007 12:19:45 CEST Parent Server Generation: 27 Server uptime: 7 hours 35 minutes 5 seconds Total accesses: 691782 - Total Traffic: 2.7 GB CPU Usage: u199.12 s35.93 cu.09 cs.71 - .864% CPU load 25.3 requests/sec - 102.3 kB/second - 4135 B/request 30 requests currently being processed, 31 idle servers
I got apache 1.3.3.7 installed and i really do not know what to do. I though I already optimized server but after 6 days of uptime memory is full and i just saw load went to 3 and started to swap. Specs are RHEL 4, xeon 3060 with 4gb of ram.
I'm under impression that if i add 64gb of ram i would still fill it up in lets say 15 days because apache isn't releasing memory properly. After load 3 some memory is released:
I got atm 220 users online and when i restart apache even if i have 500 concurrent users online usage of memory is only 800mb, and as u see now its 3gb and only half of users are online so its not really peak time. Apache processes are still hanging from 4 hours ago and they are not cut, as you can see every process takes around 4% of memory:
Apache is wasting away a bit over a GB of memory at about 100 connections. Is this something normal? Or should I be receiving a little better performance?
Also, I find that the load is very low. Is there anyway to sort of trade a bit of the CPU Usage for some more memory?
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.
Which is more efficient in the way of memory? Using Subversion with Apache and WebDav, or using SVNServe? I figure the latter, but by how much? How much ram usually would be used by the former? I'm undecided as to which method I want to use to set up Subversion yet.
recently I have an weird problem and I don't know what might be, I just suspect that this error appeared after we have enabled Keep Alive on apache
I have the same error with randomly Forbidden error. The most time I see it is on 2 websites that are build with Gallery 2 and very rarely on other website, on my end never happent on other websites but some people told me it did.
Bellow is a small part of cPanel's "Last 300 visits" it shows every request so you can see first request was a direct link , I have wrote the galery name .. and the others are aither requests to images either other files ....
I currently have 2 VPSs that I'm monitoring and I noticed that on one of them the memory usage is much higher than the other which doesn't make sense to me. I tracked the high memory usage to the Apache processes.
Here's the overview of the VPSs:
LiquidWeb VPS- 512MB RAM, 10 Sites with minimal usage. Average httpd process (Owner Priority Cpu% Mem% Command): nobody 0 0.0 1.2 /usr/local/apache/bin/httpd -k start -DSSL
Virpus VPS- 384MB RAM, 61 sites with moderate usage. Average httpd process (Owner Priority Cpu% Mem% Command): nobody 0 0.0 0.3 /usr/local/apache/bin/httpd -k start -DSSL
Both Apache configurations are identical, the only difference besides the hardware is that LiquidWeb runs CentOS4.7 and Virpus runs CentOS5.2, any ideas? It's not to big of a deal since I'm not near my limit for either of them but I was just curious.
I've got a complicated problem and I can't figure out what I need to edit to fix this.
I've been messing with the httpd.conf and php.ini files trying to optimize them as best I can. I've managed to get the load to stay pretty low all day, and everything seemed to be working fine. But then apache crashes.
(See screenshot for details)
httpd starts out with 70-150 VIRT memory, and it constantly goes up all day, and I've yet to see it go down. And, eventually it just crashes Apache! In the screenshot it's 502m, but I've seen that get as high as 800! And sometimes I even see a number like this "80376" no "m" or anything, just "80376"; I've no idea what that's about.
So what do I need to edit or tweak to fix this?
I'm on a cPanel linux server, Apache 2.2.8 and PHP 5.2.6.
In the last day or two I've been having issues with memory on one of by boxes.
Something eats it all up, so the OS starts swapping, the I/O wait shoots up, and soon the load is up in the hundreds and the thing is totally useless.
During the day today I've tracked the something to occational apache processes. It seems that occationally a thread is started which uses upwards of 150M of memory. These threads are obvioudly doing something heavyweight and take a while to complete. When I get a few of them running together it soons finishes off all my available memory. Below is an extract from top when a couple of these threads are running.
Code: PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND 10230 nobody 25 0 197m 27m 9392 R 45.5 2.9 0:03.27 /usr/local/apache/bin/httpd -DSSL 10231 nobody 25 0 197m 25m 8376 R 52.8 2.7 0:01.60 /usr/local/apache/bin/httpd -DSSL I was wondering if anyone could help out by suggesting some ways of tracking down what page/script it which uses so much memory. It's a cPanel server so it's not really practical to tail -f the apache logs (not knowing which account it is means I don't know which file to watch).
I'm running a single Magento website with only around 150 products, and very low traffic, on a VPS with 2 Cores and 4GB of ram. However I am getting constant warning emails about high Apache Memory usage and High CPU usage.
The server and site were working fine, however since the server failed (Power cut on upgrade at the hosts end) and we rebuilt the website I'm getting these warnings, my host said it is just the website and the server needed upgrading... to which I did (server was a 1 core 2GB ram server). However since I've upgraded I'm still getting these warning emails.
I'm really new to VPS's and plesk so I'm wondering what I can do to try and track down what is causing these high usage as I'm 100% certain the site was fine before. The server has default build both before and after the fail.
I'm having an issue with what I believe is Apache. Things will be running nicely, then all of a sudden things will just 'blow up'. Apache seems to fork a bunch of new processes, and it starts ripping into the memory. I've had it essentially eat through all the free memory and swap, and the system will then freeze up as there's no more memory. This is a CentOS server running CPanel, the configuration had been up and running for a long time without problems then this suddenly started happening.
We are currently running plesk 11.5 and over the last few months, the apache memory usage has been very high. On investigation we have gone through the logs and we can't find a cause.
I can issue a service httpd restart and the memory drops for about 30 minutes and then we see the apache memory grow to almost 1.5 - 2GB. Why this keeps happening?
I have a VPS. And have had an issue both when it was 1Gig and now I recently downgraded it to 768m, because I am moving some sites to a dedicated.
However, the part I am having trouble grasping is that when I look at graphs from Munin, it will typically always show 200-400MB free memory (and free -m and top agrees with munin), but Munin shows 'committed' memory that is above the total Ram on the VPS and once the 'committed' ram exceeds the VPS limit, processes start failing.
So, why is 'committed' memory exceeding the RAM on my VPS, when Munin, free -m and top all show there is free memory available?
Code: root@server [~]# free -m total used free shared buffers cached Mem: 768 449 318 0 0 0 -/+ buffers/cache: 449 318 Swap: 0 0 0 Here's a graph that munin produces that shows the 'committed' memory exceeding the total memory. [url]
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?
I have a 512mb DV server with Mediatemple, which I am running 24 (ish) domains off (most of them static websites) and a teamspeak server. I would say MAX theres 10 users online at a time)
Now, I know its running out of memory because i get frequent QoS Alerts in plesk (kmemsize is apparently the memory size):
Oct 01, 2009 11:52:57 AMBlack zonekmemsize
I have attached my results (when I did top).
My questions are:
1. Should I be expecting to be out of memory running what I am?
2. Is there a way to see the problem domains (memory wise)?
3. Are there any ways I can reduce the memory? (I have followed this already: [url]
4. Where is the memory usage coming from (I am finding it very hard to understand TOP)
I am hoping someone with experience of these things can comment on memory usage on my VPS partition. The master server on which my partition sits seems to be running at full memory usage and I'm getting lots of fork and mutex errors in apache causing apache to crash several times a day.
I'm running Invision Power Board on there with an average of 100 users in the last 15 mins during most of the day.
oomguarpages and privmpages are reported in 4KB blocks.