OVH Community, your new community space.

Help My.cnf


Geremia
30.09.2009, 13.24
Grazie mille per le informazioni !!

Citazione Originariamente Scritto da bejelith
Sposta tutto il carico solo su un engine, io preferisco InnoDB.

Disattiva il binarylog di InnoDB, perdi qualche dato in caso di crash ma ti alleggerisce il sistema.

Incrementa innodb_buffer_pool_size così da fargli usare tutta la ram che hai a disposizione

Se hai molte query di piccole/medie dimensioni parecchio utilizzate allarga la Query cache,
query_cache_size mangari a 60Mb anche in base al paramerto Qcache_hits verifica se ha un valore
significativo per la tua applicazione.

Controlla l'uso degli indici (explain), aumentali se hai poche insert/update.

Imposta lo schedule deadline che favorisce il database, magari ti aiuta:
echo deadline > /sys/block/[DISCO]/queue/scheduler

Se non migliora devi cambiare hardware :/

In bocca al lupo

bejelith
26.09.2009, 00.50
Sposta tutto il carico solo su un engine, io preferisco InnoDB.

Disattiva il binarylog di InnoDB, perdi qualche dato in caso di crash ma ti alleggerisce il sistema.

Incrementa innodb_buffer_pool_size così da fargli usare tutta la ram che hai a disposizione

Se hai molte query di piccole/medie dimensioni parecchio utilizzate allarga la Query cache,
query_cache_size mangari a 60Mb anche in base al paramerto Qcache_hits verifica se ha un valore
significativo per la tua applicazione.

Controlla l'uso degli indici (explain), aumentali se hai poche insert/update.

Imposta lo schedule deadline che favorisce il database, magari ti aiuta:
echo deadline > /sys/block/[DISCO]/queue/scheduler

Se non migliora devi cambiare hardware :/

In bocca al lupo

Geremia
20.04.2009, 20.58
Citazione Originariamente Scritto da bago
difficile dire se il my.cnf è giusto... io ho tutto di default...
Per le insert effettivamente è strano.

Dopo un po' che mysql è in funzione prova a lanciare il MySQL Performance Tuning Primer Script
Grazie per il consiglio e per lo script, domani lo lancio.

Grazie.

bago
20.04.2009, 20.44
difficile dire se il my.cnf è giusto... io ho tutto di default...
Per le insert effettivamente è strano.

Dopo un po' che mysql è in funzione prova a lanciare il MySQL Performance Tuning Primer Script

Geremia
20.04.2009, 11.30
Citazione Originariamente Scritto da bago
se dici che è lenta anche durante l'update i casi sono due:
1) stai mettendo un sacco di dati in un record.
2) non hai impostato gli indici per quella tabella correttamente

E' vero che l'accesso al disco degli RPS è lento, ma la scrittura "random" è comunque piuttosto veloce, quindi dubito che il problema delle update (se correttamente fatte su chiave/indice) sia imputabile alla lentezza dei dischi.
Ciao

Scusa ma mi sono espresso male, ho parlato di Update invece il problema si verifica in fase di insert.

Ogni record non inserisce troppi dati (fai conto 7 campi di una 20 di caratteri l'uno, in media)...

La tabella ha degli indici, non sono un esperto ma trattandosi di uno script non custom, mi fido che sia studiata bene.

Ma secondo te il my.cnf va bene ?

Io continuo ad avere il sospetto che ottimizzando quello riuscirei ad avere delle condizioni di funzionamento nella norma..

Grazie mille.
Geremia

bago
20.04.2009, 11.12
se dici che è lenta anche durante l'update i casi sono due:
1) stai mettendo un sacco di dati in un record.
2) non hai impostato gli indici per quella tabella correttamente

E' vero che l'accesso al disco degli RPS è lento, ma la scrittura "random" è comunque piuttosto veloce, quindi dubito che il problema delle update (se correttamente fatte su chiave/indice) sia imputabile alla lentezza dei dischi.

ibanez89
20.04.2009, 10.21
si, anche io consiglio l'xl, quello da 29€+iva "35€", ho avuto a sfortuna di passare da quest'ultimo al kimsufi L e sto avendo dei problemi, ma mo andiamo offtopic, credo di aprire una discussione mia...

gio01
20.04.2009, 07.51
i kimsufi sono buono... io consiglierei un xl da 29€

ibanez89
19.04.2009, 14.36
Certo un'ottimizzazione potrebbe aiutare ma l'rps ha l'accesso al disco molto lento, dovresti sentire parecchio la differenza con il kimsufi L oltretutto 33.4% wa non dovrebbe proprio esserci... significa che sei in attesa dei dati dall'hard disk presumo "il punto debole degli rps"

Geremia
19.04.2009, 12.34
Citazione Originariamente Scritto da ibanez89
hai un disco sovraccarico ed inoltre stai già swappando, a mio avviso dovresti puntare almeno su un kimsufi L
Azz...avevo pensato al kimsufi L...si migliora molto a livello di prestazioni ?

Ma secondo te (voi) non posso fare niente a livello di configurazione per migliorare questa situazione ?

Il my.cnf va bene ?

Grazie mille per i consigli.
Geremia

ibanez89
19.04.2009, 12.28
hai un disco sovraccarico ed inoltre stai già swappando, a mio avviso dovresti puntare almeno su un kimsufi L

Geremia
19.04.2009, 09.05
Citazione Originariamente Scritto da ibanez89
manda un top mentre fai le query, probabilmente vedrai un i/o wait, gli rps hanno dei dischi molto lenti... ad utilizzo di ram come sei messo?
Ciao Ecco il Top durante un operazione su database.

Purtroppo non me ne intendo..

top - 10:08:19 up 15:28, 2 users, load average: 1.13, 1.25, 1.17
Tasks: 154 total, 3 running, 150 sleeping, 0 stopped, 1 zombie
Cpu(s): 12.6% us, 4.5% sy, 0.0% ni, 48.9% id, 33.4% wa, 0.2% hi, 0.5% si
Mem: 499872k total, 494324k used, 5548k free, 2024k buffers
Swap: 1986552k total, 2732k used, 1983820k free, 189680k cached

PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
30316 mysql 20 0 661m 147m 4388 S 20 30.3 0:06.56 mysqld
3274 prezzone 20 0 25496 14m 3592 R 12 3.0 0:00.42 php
27954 mysql 20 0 661m 147m 4388 D 2 30.3 0:12.68 mysqld
254 root 15 -5 0 0 0 S 1 0.0 0:14.80 kswapd0
2630 root 20 0 2892 836 644 S 1 0.2 1:24.30 collectd
3276 root 20 0 2120 1124 828 R 1 0.2 0:00.04 top
1132 root 15 -5 0 0 0 S 0 0.0 1:03.42 scsi_wq_2
1 root 20 0 1480 500 448 S 0 0.1 0:01.56 init
2 root 15 -5 0 0 0 S 0 0.0 0:00.00 kthreadd
3 root RT -5 0 0 0 S 0 0.0 0:00.32 migration/0
4 root 15 -5 0 0 0 S 0 0.0 0:03.70 ksoftirqd/0
5 root RT -5 0 0 0 S 0 0.0 0:00.30 migration/1
6 root 15 -5 0 0 0 S 0 0.0 0:09.18 ksoftirqd/1
7 root 15 -5 0 0 0 S 0 0.0 0:03.36 events/0
8 root 15 -5 0 0 0 S 0 0.0 0:03.42 events/1
9 root 15 -5 0 0 0 S 0 0.0 0:00.88 khelper
114 root 15 -5 0 0 0 S 0 0.0 0:00.00 kintegrityd/0
115 root 15 -5 0 0 0 S 0 0.0 0:00.00 kintegrityd/1
116 root 15 -5 0 0 0 S 0 0.0 0:00.38 kblockd/0
117 root 15 -5 0 0 0 S 0 0.0 0:00.04 kblockd/1
118 root 15 -5 0 0 0 S 0 0.0 0:00.00 kacpid
119 root 15 -5 0 0 0 S 0 0.0 0:00.00 kacpi_notify
192 root 15 -5 0 0 0 S 0 0.0 0:00.00 ata/0
193 root 15 -5 0 0 0 S 0 0.0 0:00.00 ata/1
194 root 15 -5 0 0 0 S 0 0.0 0:00.00 ata_aux
195 root 15 -5 0 0 0 S 0 0.0 0:00.00 ksuspend_usbd
200 root 15 -5 0 0 0 S 0 0.0 0:00.00 khubd
203 root 15 -5 0 0 0 S 0 0.0 0:00.00 kseriod
252 root 20 0 0 0 0 S 0 0.0 0:00.00 pdflush
253 root 20 0 0 0 0 S 0 0.0 0:07.10 pdflush
255 root 15 -5 0 0 0 S 0 0.0 0:00.00 aio/0
256 root 15 -5 0 0 0 S 0 0.0 0:00.00 aio/1
259 root 15 -5 0 0 0 S 0 0.0 0:00.00 nfsiod
260 root 15 -5 0 0 0 S 0 0.0 0:00.00 cifsoplockd
261 root 15 -5 0 0 0 S 0 0.0 0:00.00 cifsdnotifyd
263 root 15 -5 0 0 0 S 0 0.0 0:00.00 xfs_mru_cache
264 root 15 -5 0 0 0 S 0 0.0 0:00.00 xfslogd/0
265 root 15 -5 0 0 0 S 0 0.0 0:00.00 xfslogd/1
266 root 15 -5 0 0 0 S 0 0.0 0:00.00 xfsdatad/0
267 root 15 -5 0 0 0 S 0 0.0 0:00.00 xfsdatad/1
268 root 15 -5 0 0 0 S 0 0.0 0:15.04 gfs2_scand
269 root 15 -5 0 0 0 S 0 0.0 0:00.00 glock_workqueue

ibanez89
19.04.2009, 00.09
manda un top mentre fai le query, probabilmente vedrai un i/o wait, gli rps hanno dei dischi molto lenti... ad utilizzo di ram come sei messo?

Geremia
18.04.2009, 21.24
Ciao

Sono possessore di un RPS 1 con distribuzione Gentoo personalizzata OVH.

Ho database con una tabella più di 500.000 records e ho notato una lentezza esasperante sia in fase di update che in fase di Query.

Ho letto in giro che il problema potrebbe essere dovuto ad una cattiva configurazione del my.cnf

Però non sono un esperto ho preso un pò di spunti da internet e ne è venuto fuori un mysql ancora più lento.

Qualcuno mi può aiutare ?

Scrivo qui il mio My.cnf magari qualcuno di voi riesce a darmi dei consigli su come migliorarlo..


# /etc/mysql/my.cnf: The global mysql configuration file.
# $Header: /var/cvsroot/gentoo-x86/dev-db/mysql/files/my.cnf-4.1,v 1.3 2006/05/05 19:51:40 chtekk Exp $

# The following options will be passed to all MySQL clients
[client]
#password = your_password
port = 3306
socket = /var/run/mysqld/mysqld.sock
character-sets-dir=/usr/share/mysql/charsets
default-character-set=latin1

[php-cgi]
character-sets-dir=/usr/share/mysql/charsets
default-character-set=latin1

[mysql]
character-sets-dir=/usr/share/mysql/charsets
default-character-set=latin1

[mysqladmin]
character-sets-dir=/usr/share/mysql/charsets
default-character-set=latin1

[mysqlcheck]
character-sets-dir=/usr/share/mysql/charsets
default-character-set=latin1

[mysqldump]
character-sets-dir=/usr/share/mysql/charsets
default-character-set=latin1

[mysqlimport]
character-sets-dir=/usr/share/mysql/charsets
default-character-set=latin1

[mysqlshow]
character-sets-dir=/usr/share/mysql/charsets
default-character-set=latin1

[myisamchk]
character-sets-dir=/usr/share/mysql/charsets

[myisampack]
character-sets-dir=/usr/share/mysql/charsets

# use [safe_mysqld] with mysql-3
[mysqld_safe]
err-log = /var/log/mysql/mysql.err
open_files_limit = 8192

# add a section [mysqld-4.1] or [mysqld-5.0] for specific configurations
[mysqld]
character-set-server = latin1
init-connect='SET NAMES latin1'
default-character-set = latin1
user = mysql
port = 3306
socket = /var/run/mysqld/mysqld.sock
pid-file = /var/run/mysqld/mysqld.pid
log-error = /var/log/mysql/mysqld.err
basedir = /usr
datadir = /var/lib/mysql
skip-locking
key_buffer = 256M
max_allowed_packet = 4M
table_cache = 256
sort_buffer_size = 512K
net_buffer_length = 32K
read_buffer_size = 256K
read_rnd_buffer_size = 512K
myisam_sort_buffer_size = 8M
language = /usr/share/mysql/english

# security:
# using "localhost" in connects uses sockets by default
skip-networking
bind-address = 127.0.0.1
log-bin
server-id = 1

# point the following paths to different dedicated disks
tmpdir = /tmp/
#log-update = /path-to-dedicated-directory/hostname

# you need the debug USE flag enabled to use the following directives,
# if needed, uncomment them, start the server and issue
# #tail -f /tmp/mysqld.sql /tmp/mysqld.trace
# this will show you *exactly* what's happening in your server

#log = /tmp/mysqld.sql
#gdb
#debug = d:t:i,/tmp/mysqld.trace
#one-thread

# uncomment the following directives if you are using BDB tables
#bdb_cache_size = 4M
#bdb_max_lock = 10000

# the following is the InnoDB configuration
# if you wish to disable innodb instead
# uncomment just the next line
skip-innodb
skip-bdb

wait_timeout= 10
connect_timeout= 10
interactive_timeout= 25
max_connections = 400
max_user_connections = 500
join_buffer_size=1M
sort_buffer_size=1M
read_buffer_size=1M
read_rnd_buffer_size=1M
table_cache=256M
max_allowed_packet= 4M
max_connect_errors = 10
key_buffer=256M
myisam_sort_buffer_size = 32M
key_buffer_size=512M
thread_cache=128M
thread_cache_size = 286
thread_concurrency=2
thread_stack=128K
concurrent_insert=2
query_cache_limit= 256M
query_cache_size= 128M
query_cache_type=1
tmp_table_size = 128M
max_heap_table_size = 128M

#
# the rest of the innodb config follows:
# don't eat too much memory, we're trying to be safe on 64Mb boxes
# you might want to bump this up a bit on boxes with more RAM
innodb_buffer_pool_size = 16M
# this is the default, increase it if you have lots of tables
innodb_additional_mem_pool_size = 2M
#
# i'd like to use /var/lib/mysql/innodb, but that is seen as a database :-(
# and upstream wants things to be under /var/lib/mysql/, so that's the route
# we have to take for the moment
#innodb_data_home_dir = /var/lib/mysql/
#innodb_log_arch_dir = /var/lib/mysql/
#innodb_log_group_home_dir = /var/lib/mysql/
# you may wish to change this size to be more suitable for your system
# the max is there to avoid run-away growth on your machine
innodb_data_file_path = ibdata1:10M:autoextend:max:128M
# we keep this at around 25% of of innodb_buffer_pool_size
# sensible values range from 1MB to (1/innodb_log_files_in_group*innodb_buffer_pool_size)
innodb_log_file_size = 5M
# this is the default, increase it if you have very large transactions going on
innodb_log_buffer_size = 8M
# this is the default and won't hurt you
# you shouldn't need to tweak it
set-variable = innodb_log_files_in_group=2
# see the innodb config docs, the other options are not always safe
innodb_flush_log_at_trx_commit = 1
innodb_lock_wait_timeout = 50

[mysqldump]
quick
max_allowed_packet = 16M

[mysql]
# uncomment the next directive if you are not familiar with SQL
#safe-updates

[isamchk]
key_buffer = 64M
sort_buffer_size = 64M
read_buffer = 16M
write_buffer = 16M

[myisamchk]
key_buffer = 80M
sort_buffer_size = 80M
read_buffer = 8M
write_buffer = 8M

[mysqlhotcopy]
interactive-timeout


Grazie mille

Geremia