Nginx , Apache , Mysql , Memcache with server 4G ram. How optimize to enought memory?

Posted by TomSawyer on Server Fault See other posts from Server Fault or by TomSawyer
Published on 2012-06-11T21:50:22Z Indexed on 2012/06/11 22:41 UTC
Read the original article Hit count: 166

Filed under:
|
|
|
|

i have 1 dedicated server with Nginx proxy for Apache. Memcache, mysql, 4G Ram.

These day, my visitor on my site wasn't increased, but my server get overload always in some specified time. (9AM - 15PM)

Ram in use is increased second by second to full. that's moment, my server will get overload.

i have to kill all apache , mysql service and reboot it to get free memory. that's the circle.

here is my ram in use at the moment 160(nginx) 220(apache) 512(memcache) 924(mysql) here's process number 4(nginx) 14(apache) 5(memcache) 20(mysql)

and here's my my.cnf config. someone can help me to optimize it?

[mysqld]
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock
user=mysql
skip-locking 
skip-networking 
skip-name-resolve

# enable log-slow-queries
log-slow-queries = /var/log/mysql-slow-queries.log
long_query_time=3

max_connections=200
wait_timeout=64
connect_timeout = 10
interactive_timeout = 25
thread_stack = 512K
max_allowed_packet=16M 
table_cache=1500 
read_buffer_size=4M 
join_buffer_size=4M 
sort_buffer_size=4M
read_rnd_buffer_size = 4M 
max_heap_table_size=256M 
tmp_table_size=256M 
thread_cache=256 
query_cache_type=1 
query_cache_limit=4M 
query_cache_size=16M 
thread_concurrency=8
myisam_sort_buffer_size=128M 
# Disabling symbolic-links is recommended to prevent assorted security risks 
symbolic-links=0 
[mysqldump] 
quick 
max_allowed_packet=16M 

[mysql] 
no-auto-rehash 

[isamchk] 
key_buffer=256M 
sort_buffer=256M 
read_buffer=64M 
write_buffer=64M 

[myisamchk] 
key_buffer=256M 
sort_buffer=256M 
read_buffer=64M 
write_buffer=64M 

[mysqlhotcopy] 
interactive-timeout 

[mysql.server]
user=mysql
basedir=/var/lib

[mysqld_safe]
log-error=/var/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid

© Server Fault or respective owner

Related posts about apache2

Related posts about mysql