i am using ubuntu 12.04LTS on my linode vps include core2 cpu, 2gb RAM. I am doing a lot of research on optimizing memory for mysql and apache process -> optimize apache memory use, there i am using two scripts for compute memory per process. Here is the output of total memory usage :
Total used by apache2 (150 instances): 0.67G Total used by other > processes: 0.21G > > Average memory used per apache2 process: 4.57M Recommended number of > processes based on Average: 395 Needed memory for 500 processes based > on Average: 2.23G > > Max memory used for apache2 process: 7.52M Recommended number of > processes based on Max: 240 Needed memory for 500 processes based on > Max: 3.67G > > Mean plus two Standard Deviations (bulk of usage under max): 6.00M > Recommended number of processes based on Mean + 2*Stdev: 301 Needed > memory for 500 processes based on Mean + 2*Stdev: 2.93G
and using python script for processes, it shows:
> Private + Shared = RAM used Program > > 4.0 KiB + 27.5 KiB = 31.5 KiB getty > 32.0 KiB + 19.5 KiB = 51.5 KiB atd > 112.0 KiB + 74.5 KiB = 186.5 KiB upstart-socket-bridge > 200.0 KiB + 31.0 KiB = 231.0 KiB cron > 152.0 KiB + 92.0 KiB = 244.0 KiB upstart-udev-bridge > 320.0 KiB + 14.0 KiB = 334.0 KiB dhclient3 > 368.0 KiB + 29.0 KiB = 397.0 KiB udevd > 340.0 KiB + 114.0 KiB = 454.0 KiB ntpd > 616.0 KiB + 29.0 KiB = 645.0 KiB dbus-daemon > 676.0 KiB + 115.0 KiB = 791.0 KiB init > 616.0 KiB + 314.5 KiB = 930.5 KiB whoopsie > 1.0 MiB + 51.5 KiB = 1.0 MiB rsyslogd > 1.4 MiB + 821.0 KiB = 2.2 MiB mysql (2) > 2.6 MiB + 1.8 MiB = 4.4 MiB sshd (5) > 6.9 MiB + 925.0 KiB = 7.8 MiB bash (4) > 202.5 MiB + 144.0 KiB = 202.7 MiB mysqld > 199.7 MiB + 30.3 MiB = 230.0 MiB apache2 (151) > --------------------------------- > 452.2 MiB > =================================
Apache using maximum memory in one of them. On other hand i am having a problem in mysql process, total RAM Capacity is 2 GB and mysql innodb buffer pool more ram around ~50%, which i can't allocate mysql because rest other processes like apache , cron, php using memory. I am totally stuck in this problem, my database is very large consist in millions of rows and now server respond connection time out to all requests.
The final thing, on using mysqltuner.pl, get some info about mysql process:
[--] Up for: 6s (706 q [117.667 qps], 196 conn, TX: 238K, RX: 99K) [--] Reads / Writes: 44% / 56% [--] Total buffers: 880.0M global + 2.6M per thread (300 max threads) [OK] Maximum possible memory usage: 1.6G (81% of installed RAM) [OK] Slow queries: 0% (0/706) [OK] Highest usage of available connections: 1% (3/300) [OK] Key buffer size / total MyISAM indexes: 8.0M/124.0K [!!] Query cache efficiency: 0.0% (0 cached / 228 selects) [OK] Query cache prunes per day: 0 [OK] Temporary tables created on disk: 21% (54 on disk / 252 total) [OK] Thread cache hit rate: 98% (3 created / 196 connections) [OK] Table cache hit rate: 25% (64 open / 254 opened) [OK] Open file limit used: 4% (70/1K) [OK] Table locks acquired immediately: 100% (627 immediate / 627 locks) [!!] InnoDB data size / buffer pool: 977.4M/800.0M
Changing apache with nginx or httpd approach is work in this situation? Any reliable info is working for me , because i am really helpless in this case.
If i am asking some strange which against community then please help me to improve this question , as it is essential for me and i want to resolve this problem asap.