Visualizzazione dei risultati da 1 a 3 su 3
  1. #1

    Ottimizzazione server Linux che si blocca (Joomla)

    Ciao a tutti ragazzi,
    torno a scrivere qui su HTML perche' di solito e' l'unico forum su cui ricevo dei suggerimenti seri su questo tipo di problemi.

    Il mio problema e' semplice (per modo di dire): per motivi economici ho ridimensionato il server dedicato su cui ho installato un mio sito (solo lui) ed ora sto avendo dei grossi problemi di performance. Soprattutto, mi capita quasi quotidianamente che la CPU si impalli al 100%, per colpa di MySQL (principalmente) e PHP (meno), diventando inaccessibile e costringendomi al riavvio dei servizi.
    Il sito e' fatto in Joomla 1.5 e macina 1000-1500 utenti al giorno, niente di incredibile.

    Mi sembra che tutto vada bene per 3/4 del tempo (anche se e' un po' lento) ma poi qualcosa s'incarta senza motivo e lo schiena.

    Sia il server vecchio che il nuovo sono OVH, della gamma Kimsufi: http://www.ovh.it/server_dedicati/kimsufi.xml
    Prima avevo il KS R-16G, Intel I3 Quad Core 3.4 Ghz con 16 Gb di RAM, decisamente sovradimensionato. Non ho mai visto la CPU andare oltre il 10%.
    Ora ho il KS 2G, Intel Atom 230 single core da 1.6 Ghz, 2 Gb di RAM. Pensavo fosse sufficiente per un singolo sito.

    E' il primo dedicato che configuro interamente da me, ho messo Ubuntu 12.04 ed ho provveduto a fare del tuning di MySQL e PHP basandomi sulle configurazioni fatte dai tecnici OVH sul server precedente e su alcune guide che ho trovato in rete.
    Non ho praticamente toccato Apache ma ho usato ISPConfig per gestire il sito e configurare i VirtualHost e IPTables.

    Come gestore PHP uso FastCGI.

    Vi allego i file di conf.

    Questo, ad esempio, e' l'utilizzo del processere pochi minuti fa:

    http://i.imgur.com/eISsXBb.png

    Questi lo storico della CPU e del system load dell'ultima giornata:

    http://i.imgur.com/JtaEYiF.png

    http://i.imgur.com/QDuX5pZ.png

    E questo un quadro generico:

    http://i.imgur.com/DgWnQrN.png

    Ah, ho fatto girare il Tuning Primer Script e questi sono i suoi consigli, anche se il server non e' stato up 48 ore come vorrebbe lui, a causa dei continui blocchi. Non mi sembra ci sia niente di tragicamente sbagliato.
    Vi allego il risultato.

    Avete qualche consiglio? Non so veramente cosa sto sbagliando.
    Alla peggio passo a KS R-4G, con Intel Atom 330 Dual Core a 1.6 Ghz e 4 Gb di RAM, ma ho pagato questo server fino a luglio e mi sembra impossibile che non sia sufficiente per un singolo sito. E preferivo risparmiarmi i 5 euro in piu' al mese.

    Grazie in anticipo a tutti!
    /*non ho scelto io di venire al mondo, ma da quel momento in poi le altre decisioni le prendo da me*/
    - http://sberla54.altervista.org - My home page -
    - http://www.punk4free.org - My punk hardcore magazine -

  2. #2
    MYSQL:

    codice:
    ##########################################################################################
    # MYSQL CONFIG
    # sberla54 - 2013.05
    # Per le modifiche cercare .CUSTOM. .DEFAULT. e .MODDATO.
    # Configurato seguendo questa guida: http://www.valent-blog.eu/2009/02/16...ione-di-mysql/
    # Tuning fatto con MySQL Performance Tuning Primer Script http://www.day32.com/MySQL/
    ##########################################################################################
    
    
    #
    # The MySQL database server configuration file.
    #
    # You can copy this to one of:
    # - "/etc/mysql/my.cnf" to set global options,
    # - "~/.my.cnf" to set user-specific options.
    # 
    # One can use all long options that the program supports.
    # Run program with --help to get a list of available options and with
    # --print-defaults to see which it would actually understand and use.
    #
    # For explanations see
    # http://dev.mysql.com/doc/mysql/en/se...variables.html
    
    # This will be passed to all mysql clients
    # It has been reported that passwords should be enclosed with ticks/quotes
    # escpecially if they contain "#" chars...
    # Remember to edit /etc/mysql/debian.cnf when changing the socket location.
    [client]
    port            = 3306
    socket          = /var/run/mysqld/mysqld.sock
    
    # Here is entries for some specific programs
    # The following values assume you have at least 32M ram
    
    # This was formally known as [safe_mysqld]. Both versions are currently parsed.
    [mysqld_safe]
    socket          = /var/run/mysqld/mysqld.sock
    nice            = 0
    
    [mysqld]
    #
    # * Basic Settings
    #
    user            = mysql
    pid-file        = /var/run/mysqld/mysqld.pid
    socket          = /var/run/mysqld/mysqld.sock
    port            = 3306
    basedir         = /usr
    datadir         = /var/lib/mysql
    tmpdir          = /tmp
    lc-messages-dir = /usr/share/mysql
    skip-external-locking
    
    #
    # Instead of skip-networking the default is now to listen only on
    # localhost which is more compatible and is not less secure.
    # bind-address          = 127.0.0.1
    #
    # * Fine Tuning
    #
    ### .CUSTOM.
    ### key_buffer
    ### Aumento key_buffer a 200 Mb, come consigliato per server con 2 Gb di RAM.
    ### .DEFAULT.
    ###  key_buffer         = 16M
    ### .MODDATO.
    key_buffer              = 200M
    #
    ### .CUSTOM.
    ### max_allowed_packet
    ### Di .DEFAULT. e' 16 Mb, ma sul server vecchio era 1 Mb
    ### max_allowed_packet  = 1M
    max_allowed_packet      = 16M
    #
    thread_stack            = 192K
    #
    ### .CUSTOM.
    ### thread_cache_size
    ### Configuro i valori consigliati per 2 Gb di RAM.
    ### .DEFAULT.
    ### thread_cache_size       = 8
    ### .MODDATO.
    thread_cache_size       = 128
    
    # This replaces the startup script and checks MyISAM tables if needed
    # the first time they are touched
    myisam-recover          = BACKUP
    
    ### .CUSTOM.
    ### max_connections
    ### Di .DEFAULT. e' commentato.
    ### Inserisco il doppio del valore di default.
    ### max_connections        = 100
    ### .MODDATO.
    max_connections         = 200
    #
    ### .CUSTOM.
    ### table_cache 
    ### Configuro i parametri consigliati per 2 Gb di RAM.
    ### Di .DEFAULT. e' commentato.
    ### table_cache         = 64
    ### .MODDATO.
    table_cache             = 1536
    #
    ### .CUSTOM.
    ### thread_concurrency
    ### Configuro i parametri consigliati per un processore single core (numero_core x 2)
    ### ed_concurrencyi .DEFAULT. e' commentato.
    ### thread_concurrency     = 10
    ### .MODDATO.
    thread_concurrency     = 2
    #
    ### .CUSTOM.
    ### Vari parametri di performance, presi dal vecchio server.
    ### Di .DEFAULT. i parametri non sono presenti.
    ###
    ### .MODDATO.
    ### Vecchio sever:
    ### sort_buffer_size            = 512K
    ### net_buffer_length           = 8K
    ### read_buffer_size            = 256K
    ### read_rnd_buffer_size        = 512K
    ### myisam_sort_buffer_size     = 8M
    ###
    ### .MODDATO
    ### Configuro i parametri consigliati per 2 Gb di RAM:
    sort_buffer_size                = 1M
    read_buffer_size                = 1M
    read_rnd_buffer_size            = 1M
    tmp_table_size                  = 32M
    ### Altri parametri vari
    query_cache_type                = 1
    interactive_timeout             = 100
    wait_timeout                    = 50
    connect_timeout                 = 10
    join_buffer                     = 1M
    myisam_sort_buffer_size         = 64M
    #
    # * Query Cache Configuration
    #
    ### .CUSTOM.
    ### query_cache_limit, query_cache_size
    ### Configuro i valori consigliati per 2 Gb di RAM.
    ### .DEFAULT.
    ### query_cache_limit   = 1M
    ### query_cache_size    = 16M
    ### .MODDATO
    query_cache_limit        = 4M
    query_cache_size         = 128M
    #
    # * Logging and Replication
    #
    # Both location gets rotated by the cronjob.
    # Be aware that this log type is a performance killer.
    # As of 5.1 you can enable the log at runtime!
    #general_log_file        = /var/log/mysql/mysql.log
    #general_log             = 1
    #
    ### .CUSTOM
    ### Attivo log_slow_queries, log e log-bin. Di .DEFAULT. solo log_error era attivo.
    ### Inserisco expire_logs_days per eliminare i log vecchi ed evitare che i log-bin riempiano il disco.
    ### Aumento max_binlog_size fino a 500 Mb, per avere singoli file di log rotate fino a 500 Mb.
    ###
    ### .MODDATO.
    #
    # Error log - should be very few entries.
    #
    log_error               = /var/log/mysql/error.log
    #
    # Here you can see queries with especially long duration
    log_slow_queries        = /var/log/mysql/mysql-slow.log
    #long_query_time = 2
    #log-queries-not-using-indexes
    #
    log                     = /var/log/mysql/mysql.log
    log-bin                 = /var/log/mysql/mysql-bin.log
    #
    # The following can be used as easy to replay backup logs or for replication.
    # note: if you are setting up a replication slave, see README.Debian about
    #       other settings you may need to change.
    #server-id              = 1
    expire_logs_days        = 7
    max_binlog_size         = 500M
    sync_binlog             = 1
    #binlog_do_db           = include_database_name
    #binlog_ignore_db       = include_database_name
    
    #
    # * InnoDB
    #
    # InnoDB is enabled by default with a 10MB datafile in /var/lib/mysql/.
    # Read the manual for more InnoDB related options. There are many!
    #
    ### skip-innodb
    #
    # * Security Features
    #
    # Read the manual, too, if you want chroot!
    # chroot = /var/lib/mysql/
    #
    # For generating SSL certificates I recommend the OpenSSL GUI "tinyca".
    #
    # ssl-ca=/etc/mysql/cacert.pem
    # ssl-cert=/etc/mysql/server-cert.pem
    # ssl-key=/etc/mysql/server-key.pem
    
    
    ###
    ### .CUSTOM.
    ### max_allowed_packet
    ### E' il parametro che indica la dimensione massima dei dump (backup) del database MySQL. 
    ### Lo aumento per sicurezza...
    ###
    [mysqldump]
    quick
    quote-names
    ### .DEFAULT.
    ### max_allowed_packet  = 16M
    ### .MODDATO.
    max_allowed_packet      = 50M
    
    
    [mysql]
    #no-auto-rehash # faster start of mysql but no tab completition
    # uncomment the next directive if you are not familiar with SQL
    #safe-updates
    
    ### .CUSTOM
    ### I prossimi parametri delle sezioni Isamchk e MyIsamchk sono copiati dal vecchio server.
    ### Di .DEFAULT. e' presente solo Isamchk key_buffer
    ### .MODDATO.
    [isamchk]
    ### key_buffer                          = 16M
    key_buffer                              = 20M
    sort_buffer_size                        = 20M
    read_buffer                             = 2M
    write_buffer                            = 2M
    
    [myisamchk]
    key_buffer                              = 20M
    sort_buffer_size                        = 20M
    read_buffer                             = 2M
    write_buffer                            = 2M
    
    [mysqlhotcopy]
    interactive-timeout
    
    #
    # * IMPORTANT: Additional settings that can override those from this file!
    #   The files must end with '.cnf', otherwise they'll be ignored.
    #
    !includedir /etc/mysql/conf.d/
    /*non ho scelto io di venire al mondo, ma da quel momento in poi le altre decisioni le prendo da me*/
    - http://sberla54.altervista.org - My home page -
    - http://www.punk4free.org - My punk hardcore magazine -

  3. #3
    PHP

    codice:
    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    ; PHP.INI
    ; sberla54 - 2013.05
    ; Per le modifiche cercare .CUSTOM. .DEFAULT. e .MODDATO.
    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    
    # .CUSTOM.
    # CONFIGURAZIONI SPECIALI PER IL SITO
    
    open_basedir = /var/www/clients/client1/web2/web:/var/www/clients/client1/web2/private:/var/www/clients/client1/web2/tmp:/var/www/punk4free.org/web:/srv/www/punk4free.org/web:/usr/share/php5:/usr/share/php:/tmp:/usr/share/phpmyadmin:/etc/phpmyadmin:/var/lib/phpmyadmin:/usr/share/php:/var/www/clients/client1/web2/images/eventlist/events/:/var/www/clients/client1/web2/images/eventlist/
    
    
    safe_mode = Off
    disable_functions = exec, passthru, shell_exec, system, proc_open, curl_multi_exec, parse_ini_file, show_source
    auto_prepend_file = "/var/www/punk4free.org/web/ose/administrator/scan.php"
    cgi.fix_pathinfo = 1
    allow_url_fopen = Off
    extension=fileinfo.so
    Il resto e' di default e non me lo fa postare perche' troppo lungo...

    TUNING PRIMER SCRIPT:

    -- MYSQL PERFORMANCE TUNING PRIMER --
    - By: Matthew Montgomery -

    MySQL Version 5.5.31-0ubuntu0.12.04.1-log x86_64

    Uptime = 0 days 8 hrs 36 min 46 sec
    Avg. qps = 12
    Total Questions = 383125
    Threads Connected = 12

    Warning: Server has not been running for at least 48hrs.
    It may not be safe to use these recommendations

    To find out more information on how each of these
    runtime variables effects performance visit:
    http://dev.mysql.com/doc/refman/5.5/...variables.html
    Visit http://www.mysql.com/products/enterprise/advisors.html
    for info about MySQL's Enterprise Monitoring and Advisory Service

    SLOW QUERIES
    The slow query log is enabled.
    Current long_query_time = 10.000000 sec.
    You have 422 out of 383153 that take longer than 10.000000 sec. to complete
    Your long_query_time seems to be fine

    BINARY UPDATE LOG
    The binary update log is enabled

    WORKER THREADS
    Current thread_cache_size = 128
    Current threads_cached = 116
    Current threads_per_sec = 0
    Historic threads_per_sec = 0
    Your thread_cache_size is fine

    MAX CONNECTIONS
    Current max_connections = 200
    Current threads_connected = 12
    Historic max_used_connections = 131
    The number of used connections is 65% of the configured maximum.
    Your max_connections variable seems to be fine.

    INNODB STATUS
    Current InnoDB index space = 0 bytes
    Current InnoDB data space = 32 K
    Current InnoDB buffer pool free = 97 %
    Current innodb_buffer_pool_size = 128 M
    Depending on how much space your innodb indexes take up it may be safe
    to increase this value to up to 2 / 3 of total system memory

    MEMORY USAGE
    Max Memory Ever Allocated : 1.00 G
    Configured Max Per-thread Buffers : 843 M
    Configured Max Global Buffers : 472 M
    Configured Max Memory Limit : 1.28 G
    Physical Memory : 1.94 G
    Max memory limit seem to be within acceptable norms

    KEY BUFFER
    Current MyISAM index space = 21 M
    Current key_buffer_size = 200 M
    Key cache miss rate is 1 : 78166
    Key buffer free ratio = 80 %
    Your key_buffer_size seems to be too high.
    Perhaps you can use these resources elsewhere

    QUERY CACHE
    Query cache is enabled
    Current query_cache_size = 128 M
    Current query_cache_used = 4 M
    Current query_cache_limit = 4 M
    Current Query cache Memory fill ratio = 3.81 %
    Current query_cache_min_res_unit = 4 K
    Your query_cache_size seems to be too high.
    Perhaps you can use these resources elsewhere
    MySQL won't cache query results that are larger than query_cache_limit in size

    SORT OPERATIONS
    Current sort_buffer_size = 1 M
    Current read_rnd_buffer_size = 1 M
    Sort buffer seems to be fine

    JOINS
    Current join_buffer_size = 1.00 M
    You have had 4263 queries where a join could not use an index properly
    You should enable "log-queries-not-using-indexes"
    Then look for non indexed joins in the slow query log.
    If you are unable to optimize your queries you may want to increase your
    join_buffer_size to accommodate larger joins in one pass.

    Note! This script will still suggest raising the join_buffer_size when
    ANY joins not using indexes are found.

    OPEN FILES LIMIT
    Current open_files_limit = 3282 files
    The open_files_limit should typically be set to at least 2x-3x
    that of table_cache if you have heavy MyISAM usage.
    Your open_files_limit value seems to be fine

    TABLE CACHE
    Current table_open_cache = 1536 tables
    Current table_definition_cache = 400 tables
    You have a total of 332 tables
    You have 913 open tables.
    The table_cache value seems to be fine

    TEMP TABLES
    Current max_heap_table_size = 16 M
    Current tmp_table_size = 32 M
    Of 31603 temp tables, 45% were created on disk
    Effective in-memory tmp_table_size is limited to max_heap_table_size.
    Perhaps you should increase your tmp_table_size and/or max_heap_table_size
    to reduce the number of disk-based temporary tables
    Note! BLOB and TEXT columns are not allow in memory tables.
    If you are using these columns raising these values might not impact your
    ratio of on disk temp tables.

    TABLE SCANS
    Current read_buffer_size = 1 M
    Current table scan ratio = 543 : 1
    read_buffer_size seems to be fine

    TABLE LOCKING
    Current Lock Wait ratio = 1 : 53
    You may benefit from selective use of InnoDB.
    If you have long running SELECT's against MyISAM tables and perform
    frequent updates consider setting 'low_priority_updates=1'
    If you have a high concurrency of inserts on Dynamic row-length tables
    consider setting 'concurrent_insert=ALWAYS'.
    /*non ho scelto io di venire al mondo, ma da quel momento in poi le altre decisioni le prendo da me*/
    - http://sberla54.altervista.org - My home page -
    - http://www.punk4free.org - My punk hardcore magazine -

Permessi di invio

  • Non puoi inserire discussioni
  • Non puoi inserire repliche
  • Non puoi inserire allegati
  • Non puoi modificare i tuoi messaggi
  •  
Powered by vBulletin® Version 4.2.1
Copyright © 2025 vBulletin Solutions, Inc. All rights reserved.