Tell me more ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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.

share|improve this question
I don't think you want to be running 150 Apache instances. What MPM are you using? – David Schwartz Aug 7 '12 at 12:01
@DavidSchwartz: If i am correct, these modules you were talking about: Compiled in modules: core.c mod_log_config.c mod_logio.c prefork.c http_core.c mod_so.c – shihon Aug 7 '12 at 12:11
You don't want 150 forked instances. – David Schwartz Aug 7 '12 at 12:13
@DavidSchwartz : I cant tell because it is used by apache server for running, and i dont have proper explanation for why server use 150 process. Due to this problem i am not sure these instances are necessary or not!! instead i am using lamp server for my work and some time i am using tom cat apache and mail server also – shihon Aug 7 '12 at 12:19

Know someone who can answer? Share a link to this question via email, Google+, Twitter, or Facebook.

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.