Ver Mensaje Individual
  #5 (permalink)  
Antiguo 26/11/2014, 11:31
Avatar de lauser
lauser
Moderator Unix/Linux
 
Fecha de Ingreso: julio-2013
Ubicación: Odessa (Ukrania)
Mensajes: 3.278
Antigüedad: 11 años, 4 meses
Puntos: 401
Respuesta: Necesito optimizar Apache y Mysql para un VPS

Te pongo un ejemplo:
Código :
Ver original
  1. root@XXXXX:/usr/local/bin# /usr/local/bin/mysqltuner.pl
  2. >>  MySQLTuner 1.3.0 - Major Hayden <[email protected]>
  3. >>  Bug reports, feature requests, and downloads at http://mysqltuner.com/
  4. >>  Run with '--help' for additional options and output filtering
  5. Please enter your MySQL administrative login: root
  6. Please enter your MySQL administrative password:
  7. -------- General Statistics --------------------------------------------------
  8. [--] Skipped version check for MySQLTuner script
  9. [OK] Currently running supported MySQL version 5.0.51a-24+lenny2
  10. [!!] Switch to 64-bit OS - MySQL cannot currently use all of your RAM
  11. -------- Storage Engine Statistics -------------------------------------------
  12. [--] Status: +Archive -BDB -Federated +InnoDB -ISAM -NDBCluster
  13. [--] Data in MyISAM tables: 26M (Tables: 215)
  14. [!!] InnoDB is enabled but isn't being used
  15. [!!] Total fragmented tables: 33
  16. -------- Performance Metrics -------------------------------------------------
  17. [--] Up for: 96d 23h 3m 41s (10M q [1.239 qps], 686K conn, TX: 701M, RX: 1B)
  18. [--] Reads / Writes: 44% / 56%
  19. [--] Total buffers: 58.0M global + 2.6M per thread (100 max threads)
  20. [OK] Maximum possible memory usage: 320.5M (12% of installed RAM)
  21. [OK] Slow queries: 0% (20/10M)
  22. [OK] Highest usage of available connections: 33% (33/100)
  23. [OK] Key buffer size / total MyISAM indexes: 16.0M/8.5M
  24. [OK] Key buffer hit rate: 99.9% (57M cached / 30K reads)
  25. [OK] Query cache efficiency: 78.6% (5M cached / 6M selects)
  26. [!!] Query cache prunes per day: 483
  27. [OK] Sorts requiring temporary tables: 0% (0 temp sorts / 408K sorts)
  28. [!!] Temporary tables created on disk: 36% (269K on disk / 745K total)
  29. [OK] Thread cache hit rate: 99% (427 created / 686K connections)
  30. [!!] Table cache hit rate: 2% (64 open / 3K opened)
  31. [OK] Open file limit used: 11% (120/1K)
  32. [OK] Table locks acquired immediately: 99% (3M immediate / 3M locks)
  33. -------- Recommendations -----------------------------------------------------
  34. General recommendations:
  35. Add skip-innodb to MySQL configuration to disable InnoDB
  36. Run OPTIMIZE TABLE to defragment tables for better performance
  37. Enable the slow query log to troubleshoot bad queries
  38. When making adjustments, make tmp_table_size/max_heap_table_size equal
  39. Reduce your SELECT DISTINCT queries without LIMIT clauses
  40. Increase table_cache gradually to avoid file descriptor limits
  41. Variables to adjust:
  42. query_cache_size (> 16M)
  43. tmp_table_size (> 32M)
  44. max_heap_table_size (> 16M)
  45. table_cache (> 64)

El resultado es:

Código :
Ver original
  1. nano /etc/mysql/my.cnf

Código :
Ver original
  1. [mysqld]
  2. #
  3. # * Basic Settings
  4. #
  5. user            = mysql
  6. pid-file        = /var/run/mysqld/mysqld.pid
  7. socket          = /var/run/mysqld/mysqld.sock
  8. port            = 3306
  9. basedir         = /usr
  10. datadir         = /var/lib/mysql
  11. tmpdir          = /tmp
  12. language        = /usr/share/mysql/english
  13. skip-external-locking
  14. #
  15. # Instead of skip-networking the default is now to listen only on
  16. # localhost which is more compatible and is not less secure.
  17. bind-address            = 127.0.0.1
  18. #
  19. # * Fine Tuning
  20. #
  21. key_buffer              = 16M
  22. max_allowed_packet      = 16M
  23. thread_stack            = 128K
  24. thread_cache_size       = 8
  25. # This replaces the startup script and checks MyISAM tables if needed
  26. # the first time they are touched
  27. myisam-recover          = BACKUP
  28. #max_connections        = 100
  29. table_cache            = 128
  30. #thread_concurrency     = 10
  31. #
  32. # * Query Cache Configuration
  33. #
  34. query_cache_limit       = 1M
  35. query_cache_size        = 32M
  36. tmp_table_sizee        = 64M
  37. max_heap_table_sizee        = 32M
__________________
Los usuarios que te responden, lo hacen altruistamente y sin ánimo de lucro con el único fin de ayudarte. Se paciente y agradecido.
-SOLOLINUX-