Ядро UTM5 подвисает после миграции БД на новую машину.

Технические вопросы по UTM 5.0
Ответить
Дёня
Сообщения: 14
Зарегистрирован: Чт ноя 13, 2008 19:17

Ядро UTM5 подвисает после миграции БД на новую машину.

Сообщение Дёня »

Коллеги, прошу помощи, т.к. не понимаю куда копать дальше. :(


Имеется ядро UTM5 5.2.1-007-update4-bsd7 (Compile date: Nov 5 2009 14:57:34)
БД работает на отдельной машине с MySQL 5.0

Всё было хорошо, шли годы, но в итоге мы "упёрлись в потолок" производительности и дискового пространства машины с БД.
Поэтому пришлось собрать новую машину и перенести на неё БД: Debian 7.3 x64 MySQL 5.0.51a-24+lenny5


После миграции БД на новую машину ядро начало "подвисать". :(

Проявляется это следующим образом: примерно раз в 15-20 минут интерфейс администратора "подвисает" одновременно у всех сотрудников.
"Подвисает" примерно на 1-2 минуты и всё опять начинает работать.
При этом интерфейс администратора не выдаёт никаких ошибок, а в его console.log и логах ядра тоже нет ошибок.

В первую очередь начали грешить на MySQL, но в моменты "подвисаний" ядра он нормально работает и отвечает на запросы, а в его логах нет никаких ошибок.
"Подвисших" и долго выполняющихся (slow queries) запросов в эти моменты тоже нет.

Наблюдая за debug логом ядра UTM5 в реальном времени заметили, что в момент "подвисаний" в debug лог ядра UTM5 добавляются только сообщения типа "Info ... RPCServer ... Client connecting ...", "Info ... Connection from ..." и "?Debug ... RPCConn ... URFA ping received, sending reply".

Т.е. если нормальный debug лог выглядит так:

Код: Выделить всё

?Debug : Jan 09 13:45:58 DBA:Ctx: Looking for free context (system=1)
?Debug : Jan 09 13:45:58 PluginManagerImpl: Got DynaShapePlugin plugin for event EventProcessShaping/95
?Debug : Jan 09 13:45:58 TransactionFilter: transaction sent to the internal queue
?Debug &#58; Jan 09 13&#58;45&#58;58 TransactionQueueManager&#58; pushing transaction <0x45163a80> into queue <2> &#40;default&#41;
?Debug &#58; Jan 09 13&#58;45&#58;58 TransactionHandlerImpl&#58; push&#58; empty transaction ptr <0x45163a80> dropped
?Debug &#58; Jan 09 13&#58;45&#58;58 DummyTransactionQueue&#58; commit&#58; 0 transactions
?Debug &#58; Jan 09 13&#58;45&#58;58 DBA&#58;Ctx&#58; Pushing back free context &#40;system=1&#41;
?Debug &#58; Jan 09 13&#58;45&#58;58 TransactionHandlerImpl&#58; incoming transaction ptr <0x45a60d80> done
?Debug &#58; Jan 09 13&#58;45&#58;58 RPCConn&#91;SSL&#93;<d3vi1@10.1.2.8>&#58; URFA ping received, sending reply
?Debug &#58; Jan 09 13&#58;45&#58;58 RPCConn&#91;SSL&#93;<d3vi1@10.1.2.8>&#58; URFA ping received, sending reply
?Debug &#58; Jan 09 13&#58;45&#58;58 RPCConn&#91;SSL&#93;<d3vi1@10.1.2.8>&#58; URFA ping received, sending reply
?Debug &#58; Jan 09 13&#58;45&#58;58 RPCConn&#91;SSL&#93;<d3vi1@10.1.2.8>&#58; Call&#58; 0x5002 &#40;__rpcs_get_routers_list &#41;
?Debug &#58; Jan 09 13&#58;45&#58;58 RPCConn&#91;SSL&#93;<d3vi1@10.1.2.8>&#58; Real Call&#58; 0x5002 &#40;__rpcs_get_routers_list &#41;
?Debug &#58; Jan 09 13&#58;45&#58;58 RPCConn&#91;SSL&#93;<d3vi1@10.1.2.8>&#58; Call&#58; 0x5002 &#40;__rpcs_get_routers_list &#41;
?Debug &#58; Jan 09 13&#58;45&#58;58 RPCConn&#91;SSL&#93;<d3vi1@10.1.2.8>&#58; Call&#58; 0x5002 &#40;__rpcs_get_routers_list &#41;
?Debug &#58; Jan 09 13&#58;45&#58;58 RPCConn&#91;SSL&#93;<d3vi1@10.1.2.8>&#58; Real Call&#58; 0x5002 &#40;__rpcs_get_routers_list &#41;
?Debug &#58; Jan 09 13&#58;45&#58;58 RPCConn&#91;SSL&#93;<d3vi1@10.1.2.8>&#58; Real Call&#58; 0x5002 &#40;__rpcs_get_routers_list &#41;
?Debug &#58; Jan 09 13&#58;45&#58;58 RPCConn&#91;SSL&#93;<d3vi1@10.1.2.8>&#58; Call 0x5002 &#40;__rpcs_get_routers_list &#41; finished...
?Debug &#58; Jan 09 13&#58;45&#58;58 RPCConn&#91;SSL&#93;<d3vi1@10.1.2.8>&#58; Stream cleared
?Debug &#58; Jan 09 13&#58;45&#58;58 RPCConn&#91;SSL&#93;<d3vi1@10.1.2.8>&#58; Call 0x5002 &#40;__rpcs_get_routers_list &#41; finished...
?Debug &#58; Jan 09 13&#58;45&#58;58 RPCConn&#91;SSL&#93;<d3vi1@10.1.2.8>&#58; Stream cleared
?Debug &#58; Jan 09 13&#58;45&#58;58 RPCConn&#91;SSL&#93;<d3vi1@10.1.2.8>&#58; Call 0x5002 &#40;__rpcs_get_routers_list &#41; finished...
?Debug &#58; Jan 09 13&#58;45&#58;58 RPCConn&#91;SSL&#93;<d3vi1@10.1.2.8>&#58; Stream cleared
?Debug &#58; Jan 09 13&#58;45&#58;58 RPCConn&#91;SSL&#93;<d3vi1@10.1.2.8>&#58; URFA ping received, sending reply
?Debug &#58; Jan 09 13&#58;45&#58;58 RPCConn&#91;SSL&#93;<d3vi1@10.1.2.8>&#58; Call&#58; 0x2910 &#40;rpcf_get_currency_list&#41;
?Debug &#58; Jan 09 13&#58;45&#58;58 RPCConn&#91;SSL&#93;<d3vi1@10.1.2.8>&#58; Real Call&#58; 0x2910 &#40;rpcf_get_currency_list&#41;
?Debug &#58; Jan 09 13&#58;45&#58;58 RPCConn&#91;SSL&#93;<d3vi1@10.1.2.8>&#58; Call 0x2910 &#40;rpcf_get_currency_list&#41; finished...
?Debug &#58; Jan 09 13&#58;45&#58;58 RPCConn&#91;SSL&#93;<d3vi1@10.1.2.8>&#58; Stream cleared
?Debug &#58; Jan 09 13&#58;45&#58;58 RPCConn&#91;SSL&#93;<d3vi1@10.1.2.8>&#58; URFA ping received, sending reply
?Debug &#58; Jan 09 13&#58;45&#58;58 RPCConn&#91;SSL&#93;<d3vi1@10.1.2.8>&#58; Call&#58; 0x9021 &#40;rpcf_get_user_othersets&#41;
?Debug &#58; Jan 09 13&#58;45&#58;58 RPCConn&#91;SSL&#93;<d3vi1@10.1.2.8>&#58; Real Call&#58; 0x9021 &#40;rpcf_get_user_othersets&#41;
?Debug &#58; Jan 09 13&#58;45&#58;58 DBCtx&#58; <682363904> SQL SELECT query&#58; SELECT remote_switch_id, port_number FROM users  WHERE id='15'
?Debug &#58; Jan 09 13&#58;45&#58;58 DBCtx&#58; <682363904> SQL SELECT query&#58; SELECT binded_currency_code FROM users WHERE id='15'
?Debug &#58; Jan 09 13&#58;45&#58;58 DBCtx&#58; <682363904> SQL SELECT query&#58; SELECT currency_brief_name, currency_full_name FROM currency_list WHERE id='810'
?Debug &#58; Jan 09 13&#58;45&#58;58 RPCConn&#91;SSL&#93;<d3vi1@10.1.2.8>&#58; Call 0x9021 &#40;rpcf_get_user_othersets&#41; finished...
?Debug &#58; Jan 09 13&#58;45&#58;58 RPCConn&#91;SSL&#93;<d3vi1@10.1.2.8>&#58; Stream cleared
То в момент "зависания" так:

Код: Выделить всё

?Debug &#58; Jan 09 13&#58;45&#58;11 RPCConn&#91;SSL&#93;<kasatkinp@10.1.2.100>&#58; URFA ping received, sending reply
?Debug &#58; Jan 09 13&#58;45&#58;11 RPCConn&#91;SSL&#93;<pavell@10.1.2.22>&#58; URFA ping received, sending reply
?Debug &#58; Jan 09 13&#58;45&#58;14 RPCConn&#91;SSL&#93;<d3vi1@10.1.2.8>&#58; URFA ping received, sending reply
?Debug &#58; Jan 09 13&#58;45&#58;15 RPCConn&#91;SSL&#93;<d3vi1@10.1.2.8>&#58; URFA ping received, sending reply
?Debug &#58; Jan 09 13&#58;45&#58;15 RPCConn&#91;SSL&#93;<natal@10.1.3.10>&#58; URFA ping received, sending reply
 Info  &#58; Jan 09 13&#58;45&#58;17 RPCServer@0.0.0.0&#58; Client connecting&#58; 10.3.65.71&#58;50231
 Info  &#58; Jan 09 13&#58;45&#58;17 RPCConn&#58; Connection from&#58; 10.3.65.71&#58;50231
?Debug &#58; Jan 09 13&#58;45&#58;18 RPCConn&#91;SSL&#93;<pichugina@10.1.3.30>&#58; URFA ping received, sending reply
?Debug &#58; Jan 09 13&#58;45&#58;25 RPCConn&#91;SSL&#93;<olegg@10.1.2.177>&#58; URFA ping received, sending reply
?Debug &#58; Jan 09 13&#58;45&#58;26 RPCConn&#91;SSL&#93;<d3vi1@10.1.2.8>&#58; URFA ping received, sending reply
 Info  &#58; Jan 09 13&#58;45&#58;26 RPCServer@0.0.0.0&#58; Client connecting&#58; 10.9.154.233&#58;1184
 Info  &#58; Jan 09 13&#58;45&#58;26 RPCConn&#58; Connection from&#58; 10.9.154.233&#58;1184
 Info  &#58; Jan 09 13&#58;45&#58;31 RPCServer@0.0.0.0&#58; Client connecting&#58; 10.9.131.59&#58;51727
 Info  &#58; Jan 09 13&#58;45&#58;31 RPCConn&#58; Connection from&#58; 10.9.131.59&#58;51727
 Info  &#58; Jan 09 13&#58;45&#58;32 RPCServer@0.0.0.0&#58; Client connecting&#58; 10.2.81.16&#58;49733
 Info  &#58; Jan 09 13&#58;45&#58;32 RPCConn&#58; Connection from&#58; 10.2.81.16&#58;49733
?Debug &#58; Jan 09 13&#58;45&#58;32 FW@rfw&#58; ping reply received
?Debug &#58; Jan 09 13&#58;45&#58;36 RPCConn&#91;SSL&#93;<nastya_b@10.1.3.2>&#58; URFA ping received, sending reply
 Info  &#58; Jan 09 13&#58;45&#58;45 RPCServer@0.0.0.0&#58; Client connecting&#58; 10.23.252.116&#58;50845
 Info  &#58; Jan 09 13&#58;45&#58;45 RPCConn&#58; Connection from&#58; 10.23.252.116&#58;50845
 Info  &#58; Jan 09 13&#58;45&#58;47 RPCServer@0.0.0.0&#58; Client connecting&#58; 10.24.61.12&#58;53558
 Info  &#58; Jan 09 13&#58;45&#58;47 RPCConn&#58; Connection from&#58; 10.24.61.12&#58;53558

Дёня
Сообщения: 14
Зарегистрирован: Чт ноя 13, 2008 19:17

Сообщение Дёня »

На всякий случай конфиги ядра UTM5 и MySQL:

/netup/utm5/utm5.cfg

Код: Выделить всё

##
## /netup/utm5/utm5.cfg
## Main UTM5 configuration file
##

## =============================================================================
## DATABASE
## =============================================================================

## database_type
##  Description&#58; Database type.
##  Possible values&#58; mysql, postgres
##  Required field.
database_type=mysql

## database
##  Description&#58; Database name.
##  Required field.
database=UTM5new

## database_host
##  Description&#58; Database server IP/hostname.
##  Default value&#58; localhost
database_host=192.168.0.2

## database_login
##  Description&#58; Database username.
##  Default value&#58; user starting utm5_core
database_login=utm5_core
##database_login=root

## database_password
##  Description&#58; Database password.
##  Default value&#58; <empty>
database_password=

## database_sock_path
##  Description&#58; Only for MySQL. Path to the database socket file. Used if
##   database_host is unset or set to "localhost".
##  Default value&#58; /tmp/mysql.sock
#database_sock_path=/var/run/mysqld/mysqld.sock

## database_port
##  Description&#58; Only for MySQL. Database server port.
##  Default value&#58; 3306
#database_port=3306

## dbcount
##  Description&#58; Number of database connections.
##  Possible values&#58; an integer from 2 to 64
##  Default value&#58; 6
#dbcount=6

## database_reconnect_count
##  Description&#58; Number of connection retries.
##  Default value&#58; 5
#database_reconnect_count=5

## database_reconnect_sleep
##  Description&#58; Reconnect timeout in seconds.
##  Default value&#58; 2
#database_reconnect_sleep=2

## database_charset
##  Description&#58; Only for MySQL. Database character set.
##  Possible values&#58; character set
##  Default value&#58; <empty>
#database_charset=utf8

## =============================================================================
## URFA SERVER
## =============================================================================

## urfa_bind_host
##  Description&#58; Listening IP address. Several values can be set.
##  Possible values&#58; interface IP address or 0.0.0.0.
##  Default value&#58; disabled
urfa_bind_host=0.0.0.0

## urfa_bind_port
##  Description&#58; Listening port.
##  Possible values&#58; an integer from 1 to 65534
##  Default value&#58; 11758

## urfa_lib_file
##  Description&#58; Dynamic modules that will be loaded at system start-up. Several
##   values can be set.
##  Possible values&#58; both absolute and relative paths may be used
##  Default value&#58; <empty>
urfa_lib_file=/netup/utm5/lib/utm5_core/liburfa-utils.so
urfa_lib_file=/netup/utm5/lib/utm5_core/liburfa-std.so
urfa_lib_file=/netup/utm5/lib/utm5_core/liburfa-reports.so
urfa_lib_file=/netup/utm5/lib/utm5_core/liburfa-card.so
urfa_lib_file=/netup/utm5/lib/utm5_core/liburfa-graph.so
#urfa_lib_file=/netup/utm5/lib/utm5_radius/liburfa-radius.so
#urfa_lib_file=/netup/utm5/lib/utm5_hotspot/liburfa-hotspot.so
urfa_lib_file=/netup/utm5/lib/utm5_core/liburfa-dynashape.so

## =============================================================================
## STREAM TRANSPORT SERVER
## =============================================================================

## stream_bind_host
##  Description&#58; Listening IP address.
##  Possible values&#58; interface IP address or 0.0.0.0
##  Default value&#58; 0.0.0.0 &#40;listen all interfaces&#41;

## stream_bind_port
##  Description&#58; Listening port.
##  Possible values&#58; an integer from 1 to 65534
##  Default value&#58; 12758

## =============================================================================
## NETFLOW BUFFER
## =============================================================================

## nfbuffer_host
##  Description&#58; Listening IP address.
##  Possible values&#58; IP address
##  Default value&#58; 0.0.0.0
nfbuffer_host=0.0.0.0

## nfbuffer_port
##  Description&#58; Listening port.
##  Default value&#58; 9997
nfbuffer_port=9996

## nbuffer_bufsize
##  Description&#58; UDP socket buffer size &#40;set as SO_RCVBUF&#41;
##   in FreeBSD you can change maximum bufsize limit with command&#58;
##   sysctl -w kern.ipc.maxsockbuf=20485760
##   in Linux you can change maximum bufsize limit with command&#58;
##   sysctl -w net.core.rmem_max=20485760
##  Possible values&#58; an integer
##  Default value&#58; set in OS
#nfbuffer_bufsize=10485760

## =============================================================================
## LOGGING
## =============================================================================

## log_level
##  Description&#58; Logging level.
##  Possible values&#58; 0, 1, 2, 3
##  Default value&#58; 1
log_level=3

## log_file_main
##  Description&#58; Main logfile path.
##  Possible values&#58; <filename>
##  Default value&#58; STDERR
log_file_main=/var/log/utm5_core.log


## log_file_debug
##  Description&#58; Debug logfile path.
##  Possible values&#58; <filename>
##  Default value&#58; STDERR
log_file_debug=/var/log/utm5_core_debug.log

## log_file_critical
##  Description&#58; Critical logfile path.
##  Possible values&#58; <filename>
##  Default value&#58; STDERR
#log_file_critical=/var/log/utm5_core_critical.log

## log_file_verificator
##  Description&#58; Database verifier logfile path.
##  Possible values&#58; <filename>
##  Default value&#58; /netup/utm5/log/verificator.sql
log_file_verificator=/var/log/utm5_core_verificator.log

## rotate_logs
##  Description&#58; Enables logfile rotation
##  Possible values&#58; yes, on, enable
##  Default value&#58; disabled
rotate_logs=yes

## max_logfile_count
##  Description&#58; Maximum number of logfiles to retain. Valid if logfile rotation
##   is on.
##  Default value&#58; not limited
max_logfile_count=50

## max_logfile_size
##  Description&#58; Maximum logfile size. When logfile size reaches this limit, a
##   rotation is performed. Valid if logfile rotation is on.
##  Default value&#58; 10485760
max_logfile_size=20971520

## core_pid_file
##  Description&#58; Path to PID file
##  Possible values&#58; <filename>
##  Default value&#58; /var/run/utm5_core.pid
#core_pid_file=/var/run/utm5_core.pid

## =============================================================================
## CERTIFICATE SETTINGS
## =============================================================================

## ssl_cert_file
##  Description&#58; Path to SSL certificate file
##  Default value&#58; /netup/utm5/cert.crt

## ssl_privkey_file
##  Description&#58; Path to SSL private key file
##  Default value&#58; /netup/utm5/privkey.pem

## ssl_privkey_passphrase
##  Description&#58; SSL private key passphrase
##  Default value&#58; <empty>

## =============================================================================
## THREADS SETTINGS
## =============================================================================

## thread_stack_size
##  Description&#58; Thread stack size for business logic threads.
##  Possible values&#58; size in bytes, more than 65536
##  Default value&#58; 8388608

## rpc_stack_size
##  Description&#58; Thread stack size for threads of URFA server.
##  Possible values&#58; size in bytes, more than 65536
##  Default value&#58; <unset>
rpc_stack_size=65536
/etc/mysql/my.cnf

Код: Выделить всё

#BEGIN CONFIG INFO
#DESCR&#58; 4GB RAM, InnoDB only, ACID, few connections, heavy queries
#TYPE&#58; SYSTEM
#END CONFIG INFO

#
# This is a MySQL example config file for systems with 4GB of memory
# running mostly MySQL using InnoDB only tables and performing complex
# queries with few connections.
# 
# You can copy this file to /etc/my.cnf to set global options,
# mysql-data-dir/my.cnf to set server-specific options 
# &#40;/var/lib/mysql for this installation&#41; or to
# ~/.my.cnf to set user-specific options.
#
# In this file, you can use all long options that a program supports.
# If you want to know which options a program supports, run the program
# with the "--help" option.
#
# More detailed information about the individual options can also be
# found in the manual.
#

#
# The following options will be read by MySQL client applications.
# Note that only client applications shipped by MySQL are guaranteed
# to read this section. If you want your own MySQL client program to
# honor these values, you need to specify it as an option during the
# MySQL client library initialization.
#
&#91;client&#93;
#password       = &#91;your_password&#93;
port            = 3306
socket          = /var/run/mysqld/mysqld.sock

# *** Application-specific options follow here ***

#
# The MySQL server
#
&#91;mysqld&#93;

# generic configuration options
port            = 3306
socket          = /var/run/mysqld/mysqld.sock

# back_log is the number of connections the operating system can keep in
# the listen queue, before the MySQL connection manager thread has
# processed them. If you have a very high connection rate and experience
# "connection refused" errors, you might need to increase this value.
# Check your OS documentation for the maximum value of this parameter.
# Attempting to set back_log higher than your operating system limit
# will have no effect.
back_log = 50

# Don't listen on a TCP/IP port at all. This can be a security
# enhancement, if all processes that need to connect to mysqld run
# on the same host.  All interaction with mysqld must be made via Unix
# sockets or named pipes.
# Note that using this option without enabling named pipes on Windows
# &#40;via the "enable-named-pipe" option&#41; will render mysqld useless!
#skip-networking

# The maximum amount of concurrent sessions the MySQL server will
# allow. One of these connections will be reserved for a user with
# SUPER privileges to allow the administrator to login even if the
# connection limit has been reached.
###max_connections = 100
max_connections = 250

# Maximum amount of errors allowed per host. If this limit is reached,
# the host will be blocked from connecting to the MySQL server until
# "FLUSH HOSTS" has been run or the server was restarted. Invalid
# passwords and other errors during the connect phase result in
# increasing this value. See the "Aborted_connects" status variable for
# global counter.
max_connect_errors = 10

# The number of open tables for all threads. Increasing this value
# increases the number of file descriptors that mysqld requires.
# Therefore you have to make sure to set the amount of open files
# allowed to at least 4096 in the variable "open-files-limit" in
# section &#91;mysqld_safe&#93;
table_cache = 2048

# Enable external file level locking. Enabled file locking will have a
# negative impact on performance, so only use it in case you have
# multiple database instances running on the same files &#40;note some
# restrictions still apply!&#41; or if you use other software relying on
# locking MyISAM tables on file level.
#external-locking

# The maximum size of a query packet the server can handle as well as
# maximum query size server can process &#40;Important when working with
# large BLOBs&#41;.  enlarged dynamically, for each connection.
max_allowed_packet = 16M

# The size of the cache to hold the SQL statements for the binary log
# during a transaction. If you often use big, multi-statement
# transactions you can increase this value to get more performance. All
# statements from transactions are buffered in the binary log cache and
# are being written to the binary log at once after the COMMIT.  If the
# transaction is larger than this value, temporary file on disk is used
# instead.  This buffer is allocated per connection on first update
# statement in transaction
binlog_cache_size = 1M

# Maximum allowed size for a single HEAP &#40;in memory&#41; table. This option
# is a protection against the accidential creation of a very large HEAP
# table which could otherwise use up all memory resources.
max_heap_table_size = 64M

# Sort buffer is used to perform sorts for some ORDER BY and GROUP BY
# queries. If sorted data does not fit into the sort buffer, a disk
# based merge sort is used instead - See the "Sort_merge_passes"
# status variable. Allocated per thread if sort is needed.
sort_buffer_size = 8M

# This buffer is used for the optimization of full JOINs &#40;JOINs without
# indexes&#41;. Such JOINs are very bad for performance in most cases
# anyway, but setting this variable to a large value reduces the
# performance impact. See the "Select_full_join" status variable for a
# count of full JOINs. Allocated per thread if full join is found
join_buffer_size = 8M

# How many threads we should keep in a cache for reuse. When a client
# disconnects, the client's threads are put in the cache if there aren't
# more than thread_cache_size threads from before.  This greatly reduces
# the amount of thread creations needed if you have a lot of new
# connections. &#40;Normally this doesn't give a notable performance
# improvement if you have a good thread implementation.&#41;
thread_cache_size = 8

# This permits the application to give the threads system a hint for the
# desired number of threads that should be run at the same time.  This
# value only makes sense on systems that support the thread_concurrency&#40;&#41;
# function call &#40;Sun Solaris, for example&#41;.
# You should try &#91;number of CPUs&#93;*&#40;2..4&#41; for thread_concurrency
thread_concurrency = 8

# Query cache is used to cache SELECT results and later return them
# without actual executing the same query once again. Having the query
# cache enabled may result in significant speed improvements, if your
# have a lot of identical queries and rarely changing tables. See the
# "Qcache_lowmem_prunes" status variable to check if the current value
# is high enough for your load.
# Note&#58; In case your tables change very often or if your queries are
# textually different every time, the query cache may result in a
# slowdown instead of a performance improvement.
query_cache_size = 64M

# Only cache result sets that are smaller than this limit. This is to
# protect the query cache of a very large result set overwriting all
# other query results.
query_cache_limit = 2M

# Minimum word length to be indexed by the full text search index.
# You might wish to decrease it if you need to search for shorter words.
# Note that you need to rebuild your FULLTEXT index, after you have
# modified this value.
ft_min_word_len = 4

# If your system supports the memlock&#40;&#41; function call, you might want to
# enable this option while running MySQL to keep it locked in memory and
# to avoid potential swapping out in case of high memory pressure. Good
# for performance.
#memlock

# Table type which is used by default when creating new tables, if not
# specified differently during the CREATE TABLE statement.
default_table_type = MYISAM

# Thread stack size to use. This amount of memory is always reserved at
# connection time. MySQL itself usually needs no more than 64K of
# memory, while if you use your own stack hungry UDF functions or your
# OS requires more stack for some operations, you might need to set this
# to a higher value.
thread_stack = 192K

# Set the default transaction isolation level. Levels available are&#58;
# READ-UNCOMMITTED, READ-COMMITTED, REPEATABLE-READ, SERIALIZABLE
transaction_isolation = REPEATABLE-READ

# Maximum size for internal &#40;in-memory&#41; temporary tables. If a table
# grows larger than this value, it is automatically converted to disk
# based table This limitation is for a single table. There can be many
# of them.
tmp_table_size = 64M

# Enable binary logging. This is required for acting as a MASTER in a
# replication configuration. You also need the binary log if you need
# the ability to do point in time recovery from your latest backup.
log-bin=/var/lib/mysql/mysql-bin

# If you're using replication with chained slaves &#40;A->B->C&#41;, you need to
# enable this option on server B. It enables logging of updates done by
# the slave thread into the slave's binary log.
#log_slave_updates

# Enable the full query log. Every query &#40;even ones with incorrect
# syntax&#41; that the server receives will be logged. This is useful for
# debugging, it is usually disabled in production use.
#log

# Print warnings to the error log file.  If you have any problem with
# MySQL you should enable logging of warnings and examine the error log
# for possible explanations. 
log_warnings=1

# Log slow queries. Slow queries are queries which take more than the
# amount of time defined in "long_query_time" or which do not use
# indexes well, if log_long_format is enabled. It is normally good idea
# to have this turned on if you frequently add new queries to the
# system.
log_slow_queries=/var/log/mysql-slow.log

# All queries taking more than this amount of time &#40;in seconds&#41; will be
# trated as slow. Do not use "1" as a value here, as this will result in
# even very fast queries being logged from time to time &#40;as MySQL
# currently measures time with second accuracy only&#41;.
long_query_time = 2

# Log more information in the slow query log. Normally it is good to
# have this turned on. This will enable logging of queries that are not
# using indexes in addition to long running queries.
log_long_format

# Log errors.
log_error=/var/log/mysql.log

# The directory used by MySQL for storing temporary files. For example,
# it is used to perform disk based large sorts, as well as for internal
# and explicit temporary tables. It might be good to put it on a
# swapfs/tmpfs filesystem, if you do not create very large temporary
# files. Alternatively you can put it on dedicated disk. You can
# specify multiple paths here by separating them by ";" - they will then
# be used in a round-robin fashion.
#tmpdir = /tmp


# ***  Replication related settings 

binlog-do-db = dhcp
replicate-do-db = dhcp

# Unique server identification number between 1 and 2^32-1. This value
# is required for both master and slave hosts. It defaults to 1 if
# "master-host" is not set, but will MySQL will not function as a master
# if it is omitted.
server-id = 1

# Replication Slave &#40;comment out master section to use this&#41;
#
# To configure this host as a replication slave, you can choose between
# two methods &#58;
#
# 1&#41; Use the CHANGE MASTER TO command &#40;fully described in our manual&#41; -
#    the syntax is&#58;
#
#    CHANGE MASTER TO MASTER_HOST=<host>, MASTER_PORT=<port>,
#    MASTER_USER=<user>, MASTER_PASSWORD=<password> ;
#
#    where you replace <host>, <user>, <password> by quoted strings and
#    <port> by the master's port number &#40;3306 by default&#41;.
#
#    Example&#58;
#
#    CHANGE MASTER TO MASTER_HOST='125.564.12.1', MASTER_PORT=3306,
#    MASTER_USER='joe', MASTER_PASSWORD='secret';
#
# OR
#
# 2&#41; Set the variables below. However, in case you choose this method, then
#    start replication for the first time &#40;even unsuccessfully, for example
#    if you mistyped the password in master-password and the slave fails to
#    connect&#41;, the slave will create a master.info file, and any later
#    changes in this file to the variable values below will be ignored and
#    overridden by the content of the master.info file, unless you shutdown
#    the slave server, delete master.info and restart the slaver server.
#    For that reason, you may want to leave the lines below untouched
#    &#40;commented&#41; and instead use CHANGE MASTER TO &#40;see above&#41;
#
# required unique id between 2 and 2^32 - 1
# &#40;and different from the master&#41;
# defaults to 2 if master-host is set
# but will not function as a slave if omitted
#server-id = 2
#
# The replication master for this slave - required
#master-host = <hostname>
#
# The username the slave will use for authentication when connecting
# to the master - required
#master-user = <username>
#
# The password the slave will authenticate with when connecting to
# the master - required
#master-password = <password>
#
# The port the master is listening on.
# optional - defaults to 3306
#master-port = <port>

# Make the slave read-only. Only users with the SUPER privilege and the
# replication slave thread will be able to modify data on it. You can
# use this to ensure that no applications will accidently modify data on
# the slave instead of the master
#read_only


#*** MyISAM Specific options


# Size of the Key Buffer, used to cache index blocks for MyISAM tables.
# Do not set it larger than 30% of your available memory, as some memory
# is also required by the OS to cache rows. Even if you're not using
# MyISAM tables, you should still set it to 8-64M as it will also be
# used for internal temporary disk tables.
key_buffer_size = 32M

# Size of the buffer used for doing full table scans of MyISAM tables.
# Allocated per thread, if a full scan is needed.
read_buffer_size = 2M

# When reading rows in sorted order after a sort, the rows are read
# through this buffer to avoid disk seeks. You can improve ORDER BY
# performance a lot, if set this to a high value.
# Allocated per thread, when needed.
read_rnd_buffer_size = 16M

# MyISAM uses special tree-like cache to make bulk inserts &#40;that is,
# INSERT ... SELECT, INSERT ... VALUES &#40;...&#41;, &#40;...&#41;, ..., and LOAD DATA
# INFILE&#41; faster. This variable limits the size of the cache tree in
# bytes per thread. Setting it to 0 will disable this optimisation.  Do
# not set it larger than "key_buffer_size" for optimal performance.
# This buffer is allocated when a bulk insert is detected.
bulk_insert_buffer_size = 64M

# This buffer is allocated when MySQL needs to rebuild the index in
# REPAIR, OPTIMIZE, ALTER table statements as well as in LOAD DATA INFILE
# into an empty table. It is allocated per thread so be careful with
# large settings.
myisam_sort_buffer_size = 128M

# The maximum size of the temporary file MySQL is allowed to use while
# recreating the index &#40;during REPAIR, ALTER TABLE or LOAD DATA INFILE.
# If the file-size would be bigger than this, the index will be created
# through the key cache &#40;which is slower&#41;.
myisam_max_sort_file_size = 10G

# If the temporary file used for fast index creation would be bigger
# than using the key cache by the amount specified here, then prefer the
# key cache method.  This is mainly used to force long character keys in
# large tables to use the slower key cache method to create the index.
myisam_max_extra_sort_file_size = 10G

# If a table has more than one index, MyISAM can use more than one
# thread to repair them by sorting in parallel. This makes sense if you
# have multiple CPUs and plenty of memory.
myisam_repair_threads = 1

# Automatically check and repair not properly closed MyISAM tables.
myisam_recover


# *** BDB Specific options ***

# Use this option if you run a MySQL server with BDB support enabled but
# you do not plan to use it. This will save memory and may speed up some
# things.
skip-bdb


# *** INNODB Specific options ***

# Use this option if you have a MySQL server with InnoDB support enabled
# but you do not plan to use it. This will save memory and disk space
# and speed up some things.
#skip-innodb

# Additional memory pool that is used by InnoDB to store metadata
# information.  If InnoDB requires more memory for this purpose it will
# start to allocate it from the OS.  As this is fast enough on most
# recent operating systems, you normally do not need to change this
# value. SHOW INNODB STATUS will display the current amount used.
innodb_additional_mem_pool_size = 16M

# InnoDB, unlike MyISAM, uses a buffer pool to cache both indexes and
# row data. The bigger you set this the less disk I/O is needed to
# access data in tables. On a dedicated database server you may set this
# parameter up to 80% of the machine physical memory size. Do not set it
# too large, though, because competition of the physical memory may
# cause paging in the operating system.  Note that on 32bit systems you
# might be limited to 2-3.5G of user level memory per process, so do not
# set it too high.
innodb_buffer_pool_size = 2G

# InnoDB stores data in one or more data files forming the tablespace.
# If you have a single logical drive for your data, a single
# autoextending file would be good enough. In other cases, a single file
# per device is often a good choice. You can configure InnoDB to use raw
# disk partitions as well - please refer to the manual for more info
# about this.
innodb_data_file_path = ibdata1&#58;10M&#58;autoextend

# Set this option if you would like the InnoDB tablespace files to be
# stored in another location. By default this is the MySQL datadir.
#innodb_data_home_dir = <directory>

# Number of IO threads to use for async IO operations. This value is
# hardcoded to 4 on Unix, but on Windows disk I/O may benefit from a
# larger number.
innodb_file_io_threads = 4

# If you run into InnoDB tablespace corruption, setting this to a nonzero
# value will likely help you to dump your tables. Start from value 1 and
# increase it until you're able to dump the table successfully.
#innodb_force_recovery=1

# Number of threads allowed inside the InnoDB kernel. The optimal value
# depends highly on the application, hardware as well as the OS
# scheduler properties. A too high value may lead to thread thrashing.
innodb_thread_concurrency = 16

# If set to 1, InnoDB will flush &#40;fsync&#41; the transaction logs to the
# disk at each commit, which offers full ACID behavior. If you are
# willing to compromise this safety, and you are running small
# transactions, you may set this to 0 or 2 to reduce disk I/O to the
# logs. Value 0 means that the log is only written to the log file and
# the log file flushed to disk approximately once per second. Value 2
# means the log is written to the log file at each commit, but the log
# file is only flushed to disk approximately once per second.
innodb_flush_log_at_trx_commit = 1

# Speed up InnoDB shutdown. This will disable InnoDB to do a full purge
# and insert buffer merge on shutdown. It may increase shutdown time a
# lot, but InnoDB will have to do it on the next startup instead.
#innodb_fast_shutdown

# The size of the buffer InnoDB uses for buffering log data. As soon as
# it is full, InnoDB will have to flush it to disk. As it is flushed
# once per second anyway, it does not make sense to have it very large
# &#40;even with long transactions&#41;. 
innodb_log_buffer_size = 8M

# Size of each log file in a log group. You should set the combined size
# of log files to about 25%-100% of your buffer pool size to avoid
# unneeded buffer pool flush activity on log file overwrite. However,
# note that a larger logfile size will increase the time needed for the
# recovery process.
innodb_log_file_size = 256M

# Total number of files in the log group. A value of 2-3 is usually good
# enough.
innodb_log_files_in_group = 3

# Location of the InnoDB log files. Default is the MySQL datadir. You
# may wish to point it to a dedicated hard drive or a RAID1 volume for
# improved performance
#innodb_log_group_home_dir

# Maximum allowed percentage of dirty pages in the InnoDB buffer pool.
# If it is reached, InnoDB will start flushing them out agressively to
# not run out of clean pages at all. This is a soft limit, not
# guaranteed to be held.
innodb_max_dirty_pages_pct = 90

# The flush method InnoDB will use for Log. The tablespace always uses
# doublewrite flush logic. The default value is "fdatasync", another
# option is "O_DSYNC".
#innodb_flush_method=O_DSYNC

# How long an InnoDB transaction should wait for a lock to be granted
# before being rolled back. InnoDB automatically detects transaction
# deadlocks in its own lock table and rolls back the transaction. If you
# use the LOCK TABLES command, or other transaction-safe storage engines
# than InnoDB in the same transaction, then a deadlock may arise which
# InnoDB cannot notice. In cases like this the timeout is useful to
# resolve the situation.
innodb_lock_wait_timeout = 120

# хранить каждую таблицу InnoDB в отдельном файле
innodb_file_per_table

# ротация бинарных логов
expire_logs_days = 5

# не преобразовывать IP адреса в доменные имена &#40;решает проблему с долгим подключением к mysqld через сеть&#41;
skip_name_resolve

# concurrent_insert решает проблему зависания UTM5 на время &#40;пока выполнится запрос&#41; выполнения больших отчётов
#
# If 1 &#40;the default&#41;, MySQL permits INSERT and SELECT statements to run concurrently for MyISAM tables that
# Если 1 &#40;по умолчанию&#41;, MySQL разрешает операторам INSERT и SELECT выполняться конкурентно для таблиц
#
# have no free blocks in the middle of the data file.
# MyISAM, у которых нет свободных блоков в середине файла с данными.
#
# If you start mysqld with --skip-new, this variable is set to 0.
# Если вы запустили mysqld с опцией --skip-new, то эта переменная будет установлена в 0.
#
# In MySQL 5.0.6, this variable was changed to take three integer values&#58;
# В MySQL 5.0.6 логика этой переменной изменена и она может принимать 3 целочисленных значения&#58;
#
# Value                Description
# Значение             Описание
#
#   0                    Disables concurrent inserts
#                        Отключает "конкурентные вставки"
#
#   1 &#40;Default&#41;          Enables concurrent insert for MyISAM tables that do not have holes
#     &#40;По умолчанию&#41;     Включает "конкурентные вставки" для таблиц MyISAM без "дыр"
#
#   2                    Enables concurrent inserts for all MyISAM tables, even those that have holes.
#                        Включает "конкурентные вставки" для всех таблиц MyISAM, даже с "дырами".
#
#                        For a table with a hole, new rows are inserted at the end of the table if it is in use
#                        Для таблицы с "дырой" новые строки будут вставлены в конец таблицы, если она занята
#
#                        by another thread. Otherwise, MySQL acquires a normal write lock and inserts
#                        другим потоком. В обратном случае MySQL производит нормальную блокировку записи и вставля
#
#                        the row into the hole.
#                        строку в "дыру".
#
concurrent_insert = 2

&#91;mysqldump&#93;
# Do not buffer the whole result set in memory before writing it to
# file. Required for dumping very large tables
quick

max_allowed_packet = 16M

&#91;mysql&#93;
no-auto-rehash

# Only allow UPDATEs and DELETEs that use keys.
#safe-updates

&#91;isamchk&#93;
key_buffer = 512M
sort_buffer_size = 512M
read_buffer = 8M
write_buffer = 8M

&#91;myisamchk&#93;
key_buffer = 512M
sort_buffer_size = 512M
read_buffer = 8M
write_buffer = 8M

&#91;mysqlhotcopy&#93;
interactive-timeout

&#91;mysqld_safe&#93;
# Increase the amount of open files allowed per process. Warning&#58; Make
# sure you have set the global system limit high enough! The high value
# is required for a large number of opened tables
open-files-limit = 8192

Аватара пользователя
Magnum72
Сообщения: 1947
Зарегистрирован: Чт сен 22, 2005 06:54
Контактная информация:

Сообщение Magnum72 »

Увеличь до 32 например:
## dbcount
## Description: Number of database connections.
## Possible values: an integer from 2 to 64
## Default value: 6

Дёня
Сообщения: 14
Зарегистрирован: Чт ноя 13, 2008 19:17

Сообщение Дёня »

Увеличил до максимума (64) и перезапустил ядро - ничего не изменилось. :(

Дёня
Сообщения: 14
Зарегистрирован: Чт ноя 13, 2008 19:17

Сообщение Дёня »

Заметил, что во время "подвисания" растёт кол-во блокировок для таблиц accounts, users, ip_groups и ban_rule, которая не относится к UTM5 и используется костылём для блокировки неплательщиков.

Код: Выделить всё

# mysql -e 'show open tables where in_use or name_locked'
+------------+-----------+--------+-------------+
| Database   | Table     | In_use | Name_locked |
+------------+-----------+--------+-------------+
| UTM5new    | accounts  |      8 |           0 | 
| UTM5new    | users     |      1 |           0 | 
| UTM5new    | ip_groups |      6 |           0 | 
| BAN_MODULE | ban_rule  |      1 |           0 | 
+------------+-----------+--------+-------------+

# mysql -e 'show open tables where in_use or name_locked'
+------------+-----------+--------+-------------+
| Database   | Table     | In_use | Name_locked |
+------------+-----------+--------+-------------+
| UTM5new    | accounts  |     10 |           0 | 
| UTM5new    | users     |      1 |           0 | 
| UTM5new    | ip_groups |      8 |           0 | 
| BAN_MODULE | ban_rule  |      1 |           0 | 
+------------+-----------+--------+-------------+

# mysql -e 'show open tables where in_use or name_locked'
+------------+-----------+--------+-------------+
| Database   | Table     | In_use | Name_locked |
+------------+-----------+--------+-------------+
| UTM5new    | accounts  |     11 |           0 | 
| UTM5new    | users     |      1 |           0 | 
| UTM5new    | ip_groups |      9 |           0 | 
| BAN_MODULE | ban_rule  |      1 |           0 | 
+------------+-----------+--------+-------------+

# mysql -e 'show open tables where in_use or name_locked'
+------------+-----------+--------+-------------+
| Database   | Table     | In_use | Name_locked |
+------------+-----------+--------+-------------+
| UTM5new    | accounts  |     12 |           0 | 
| UTM5new    | users     |      1 |           0 | 
| UTM5new    | ip_groups |     10 |           0 | 
| BAN_MODULE | ban_rule  |      1 |           0 | 
+------------+-----------+--------+-------------+

# mysql -e 'show open tables where in_use or name_locked'
+------------+-----------+--------+-------------+
| Database   | Table     | In_use | Name_locked |
+------------+-----------+--------+-------------+
| UTM5new    | accounts  |     13 |           0 | 
| UTM5new    | users     |      1 |           0 | 
| UTM5new    | ip_groups |     11 |           0 | 
| BAN_MODULE | ban_rule  |      1 |           0 | 
+------------+-----------+--------+-------------+

# mysql -e 'show open tables where in_use or name_locked'
+------------+-----------+--------+-------------+
| Database   | Table     | In_use | Name_locked |
+------------+-----------+--------+-------------+
| UTM5new    | accounts  |     14 |           0 | 
| UTM5new    | users     |      1 |           0 | 
| UTM5new    | ip_groups |     12 |           0 | 
| BAN_MODULE | ban_rule  |      1 |           0 | 
+------------+-----------+--------+-------------+

# mysql -e 'show open tables where in_use or name_locked'
+------------+-----------+--------+-------------+
| Database   | Table     | In_use | Name_locked |
+------------+-----------+--------+-------------+
| UTM5new    | accounts  |     16 |           0 | 
| UTM5new    | users     |      1 |           0 | 
| UTM5new    | ip_groups |     14 |           0 | 
| BAN_MODULE | ban_rule  |      1 |           0 | 
+------------+-----------+--------+-------------+
Все блокировки пропадают как-только "подвисание" заканчивается.

http://dev.mysql.com/doc/refman/5.0/en/ ... ables.html
In_use

The number of table locks or lock requests there are for the table. For example, if one client acquires a lock for a table using LOCK TABLE t1 WRITE, In_use will be 1. If another client issues LOCK TABLE t1 WRITE while the table remains locked, the client will block waiting for the lock, but the lock request causes In_use to be 2. If the count is zero, the table is open but not currently being used. In_use is also increased by the HANDLER ... OPEN statement and decreased by HANDLER ... CLOSE.
Завтра буду искать костыли, которые могут блокировать эти таблицы...

Дёня
Сообщения: 14
Зарегистрирован: Чт ноя 13, 2008 19:17

Сообщение Дёня »

И да... для всех таблиц UTM5 используется MyISAM Engine.

Дёня
Сообщения: 14
Зарегистрирован: Чт ноя 13, 2008 19:17

Сообщение Дёня »

Дёня писал(а): Завтра буду искать костыли, которые могут блокировать эти таблицы...
Действительно, дело оказалось в костыле, который на минуту-две блокирует таблицы accounts и ip_roups следующим запросом:

Код: Выделить всё

SELECT BAN_MODULE.ban_rule.id as id,
       BAN_MODULE.ban_rule.router as router,
       BAN_MODULE.ban_rule.profile_id as profile_id,
       BAN_MODULE.ban_rule.access_id as access_id,
       BAN_MODULE.ban_rule.user_ip as ip
FROM   BAN_MODULE.ban_rule,
       UTM5new.accounts,
       UTM5new.ip_groups
WHERE  INET_ATON&#40;BAN_MODULE.ban_rule.user_ip&#41; = UTM5new.ip_groups.ip
AND    UTM5new.ip_groups.account_id           = UTM5new.accounts.id
AND    UTM5new.accounts.is_blocked            = 0
AND    UTM5new.accounts.is_deleted            = 0
AND    UTM5new.ip_groups.is_deleted           = 0;
Зачем MySQL блокирует таблицы при выполнении данного запроса и почему этого не происходило до миграции - мне не очень понятно.
Подозреваю, что на старой машине для данных таблиц использовался InnoDB Engine.
С этими тонкостями разбираться не стали - просто переписали костыль.

Всем спасибо! Проблема решена! :)

Ответить