Desde hace unos meses tengo mi primer VPS no administrado con la siguiente maquina:
CPU Dual Quad Core Xeon
Centos 6 64 bits
2Gb Ram + 2 Gb
1000Gb Transferencia
Tengo rodando 4 tiendas en magento y una web mas en joomla, desde hace unas semanas e notado muchas alertas del tipo
Resource counter_memory_share_used red alert on environment xxxx.vservers.es current value: 92 soft limit: 85 hard limit: 95 counter_memory_share_used
Resource counter_cpu_share_used yellow alert on environment xxxx.vservers.es current value: 82 soft limit: 85 hard limit: 95 counter_cpu_share_used
La memoria se me suele disparar al 85% y de normal, sin nadie en las tiendas, esta en 1.1 GB 55.4% (esto desde luego no es normal)
Tambien observo que la cpu se me dispara con los php.ini de 3 tiendas
1459 78.5 0.0 /usr/bin/php-cgi -c /var/www/vhosts/españa.com/etc/php.ini 0 19 75100 S 00:00:01 10003
1443 7.1 0.0 /usr/bin/php-cgi -c /var/www/vhosts/alemania.com/etc/php.ini 0 19 75960 S 00:00:04 10001
1449 4.4 0.0 /usr/bin/php-cgi -c /var/www/vhosts/italia.com/etc/php.ini 0 19 76400 S 00:00:01 10004
lunes tube 1500 visitas entre las tres a lo largo del dia por lo que creo que es mas de configuración que de capacidad.
e pasado el MsSQLTuner con estos resultados
>> MySQLTuner 1.2.0 - Major Hayden <[email protected]>
>> Bug reports, feature requests, and downloads at mysqltuner.com
>> Run with '--help' for additional options and output filtering
-------- General Statistics --------------------------------------------------
[--] Skipped version check for MySQLTuner script
[OK] Currently running supported MySQL version 5.1.61
[OK] Operating on 64-bit architecture
-------- Storage Engine Statistics -------------------------------------------
[--] Status: -Archive -BDB -Federated +InnoDB -ISAM -NDBCluster
[--] Data in MyISAM tables: 3M (Tables: 280)
[--] Data in InnoDB tables: 477M (Tables: 2477)
[--] Data in MEMORY tables: 496K (Tables: 119)
[!!] Total fragmented tables: 2481
-------- Security Recommendations -------------------------------------------
[OK] All database users have passwords assigned
-------- Performance Metrics -------------------------------------------------
[--] Up for: 16h 39m 53s (785K q [13.101 qps], 16K conn, TX: 1B, RX: 322M)
[--] Reads / Writes: 90% / 10%
[--] Total buffers: 27.0M global + 2.7M per thread (151 max threads)
[OK] Maximum possible memory usage: 442.2M (21% of installed RAM)
[OK] Slow queries: 0% (48/785K)
[OK] Highest usage of available connections: 5% (9/151)
[OK] Key buffer size / total MyISAM indexes: 8.0M/3.5M
[OK] Key buffer hit rate: 98.8% (650K cached / 7K reads)
[!!] Query cache is disabled
[OK] Sorts requiring temporary tables: 0% (0 temp sorts / 165K sorts)
[!!] Joins performed without indexes: 1780
[OK] Temporary tables created on disk: 18% (38K on disk / 211K total)
[!!] Thread cache is disabled
[!!] Table cache hit rate: 0% (64 open / 273K opened)
[OK] Open file limit used: 0% (0/1K)
[OK] Table locks acquired immediately: 100% (1M immediate / 1M locks)
[!!] InnoDB data size / buffer pool: 477.5M/2.0M
-------- Recommendations -----------------------------------------------------
General recommendations:
Run OPTIMIZE TABLE to defragment tables for better performance
MySQL started within last 24 hours - recommendations may be inaccurate
Enable the slow query log to troubleshoot bad queries
Adjust your join queries to always utilize indexes
Set thread_cache_size to 4 as a starting value
Increase table_cache gradually to avoid file descriptor limits
Variables to adjust:
query_cache_size (>= 8M)
join_buffer_size (> 128.0K, or always use indexes with joins)
thread_cache_size (start at 4)
table_cache (> 64)
innodb_buffer_pool_size (>= 477M)
mire el my.cnf y tenia solo esto
[mysqld]
local-infile=0
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock
user=mysql
# Disabling symbolic-links is recommended to prevent assorted security risks
symbolic-links=0
innodb_buffer_pool_size=2M
innodb_additional_mem_pool_size=500K
innodb_log_buffer_size=500K
innodb_thread_concurrency=2
[mysqld_safe]
log-error=/var/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid
innodb_buffer_pool_size=2M
innodb_additional_mem_pool_size=500K
innodb_log_buffer_size=500K
innodb_thread_concurrency=2
lo e modificado y ahora lo tengo asi:
[mysqld]
local-infile=0
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock
user=mysql
# Disabling symbolic-links is recommended to prevent assorted security risks
symbolic-links=0
innodb_buffer_pool_size=1G
innodb_additional_mem_pool_size=500K
innodb_log_buffer_size=500K
innodb_thread_concurrency=2
[mysqld_safe]
log-error=/var/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid
innodb_buffer_pool_size=2M
innodb_additional_mem_pool_size=500K
innodb_log_buffer_size=500K
innodb_thread_concurrency=2
### query-cache settings ###
query_cache_type=1
query_cache_size=64M
query_cache_limit=8M
# key_buffer_size is important for MyISAM tables.
key_buffer_size=16M
join_buffer_size=2M
thread_cache_size=4
table_cache=1024
log-slow-queries=/var/log/mysql.slow-queries.log
ahora estoy esperando las 24h para poder pasar de nuevo el MySQLTuner, pero... ¿creeis que puedo mejorar algo mas? no veo normal que consuma tanta memoria sin estar nadie visitando las tiendas. algo no esta bien, si necesitais mas datos o mas configuraciones os las ire poniendo.
Muchas Gracias de antemano