Mysql problem CPU usage

Support for the latest build of L2J Server, get help here with installations, upgrades, problems.
Do not post bugs reports here, use viewforum.php?f=77 instead.
There is no support for other server builds than the official provided by l2jserver.com
Forum rules
READ NOW: L2j Forums Rules of Conduct
kama3a
Posts: 125
Joined: Mon Jul 07, 2008 4:01 pm

Mysql problem CPU usage

Post by kama3a »

hello im using the freya pack and have some problems with mysql last weeks.
The problem is related with huge CPU usage at 500 online, strange but i tried almost everything that i know.
Let me give some info about the machine.
  • Intel Xeon i7 W3520
    4x 2.66+ GHz
    8 Mb L2 - QPI 4.8 GT/sec
    Virtualisation: VT Instructions
    Turbo Boost Technology @ 2.93GHz
    12 GB DDR3
    2x 1500 GB - SATA2
    RAID 0/1
    NIC 100mbits
    OS : Ubuntu 64x
I was testing with all kind of configs on the mysql server but with not good results.
At 500 online it have lag peeks, normaly when some one make subclass or on mass pvp the CPU usage peek get up to 25-30 % from the mysql.

Here is the last result from mysqltuner
  • -------- General Statistics --------------------------------------------------
    [--] Skipped version check for MySQLTuner script
    [OK] Currently running supported MySQL version 5.1.49-1ubuntu8.1-log
    [OK] Operating on 64-bit architecture

    -------- Storage Engine Statistics -------------------------------------------
    [--] Status: -Archive -BDB -Federated +InnoDB -ISAM -NDBCluster
    [--] Data in MyISAM tables: 170M (Tables: 4)
    [--] Data in InnoDB tables: 161M (Tables: 166)
    [!!] Total fragmented tables: 167

    -------- Performance Metrics -------------------------------------------------
    [--] Up for: 10h 23m 17s (2M q [63.514 qps], 7K conn, TX: 291M, RX: 372M)
    [--] Reads / Writes: 14% / 86%
    [--] Total buffers: 1.4G global + 8.8M per thread (600 max threads)
    [OK] Maximum possible memory usage: 6.6G (56% of installed RAM)
    [OK] Slow queries: 0% (1/2M)
    [OK] Highest usage of available connections: 8% (49/600)
    [OK] Key buffer size / total MyISAM indexes: 350.0M/117.7M
    [OK] Key buffer hit rate: 99.8% (15M cached / 25K reads)
    [!!] Query cache efficiency: 3.9% (13K cached / 351K selects)
    [!!] Query cache prunes per day: 23223
    [OK] Sorts requiring temporary tables: 0% (143 temp sorts / 19K sorts)
    [!!] Joins performed without indexes: 2406
    [OK] Temporary tables created on disk: 2% (86 on disk / 3K total)
    [OK] Thread cache hit rate: 99% (51 created / 7K connections)
    [OK] Table cache hit rate: 26% (278 open / 1K opened)
    [OK] Open file limit used: 1% (78/4K)
    [!!] Table locks acquired immediately: 91%
    [!!] Connections aborted: 30%
    [OK] InnoDB data size / buffer pool: 161.3M/1.0G

    -------- Recommendations -----------------------------------------------------
    General recommendations:
    Run OPTIMIZE TABLE to defragment tables for better performance
    MySQL started within last 24 hours - recommendations may be inaccurate
    Adjust your join queries to always utilize indexes
    Optimize queries and/or use InnoDB to reduce lock wait
    Your applications are not closing MySQL connections properly
    Variables to adjust:
    query_cache_limit (> 2M, or use smaller result sets)
Current mysql config :
  • max_connections = 600
    table_open_cache = 2048
    max_allowed_packet = 16M
    max_heap_table_size = 64M
    sort_buffer_size = 4M
    join_buffer_size = 4M
    thread_cache_size = 8
    thread_concurrency = 8
    query_cache_size = 16M
    query_cache_limit = 2M
    thread_stack = 192K
    tmp_table_size = 64M
    slow_query_log

    #*** MyISAM Specific options
    key_buffer_size = 350M
    read_buffer_size = 128K
    read_rnd_buffer_size = 512K
    myisam_sort_buffer_size = 64M
    myisam_max_sort_file_size = 1G
    # *** INNODB Specific options ***
    innodb_additional_mem_pool_size = 8M
    innodb_buffer_pool_size = 1G
    innodb_data_file_path = ibdata1:10M:autoextend
    innodb_thread_concurrency = 8
    innodb_log_buffer_size = 16M
    innodb_log_file_size = 256M
    innodb_log_files_in_group = 3
    innodb_max_dirty_pages_pct = 90
    innodb_lock_wait_timeout = 120

    [myisamchk]
    key_buffer_size = 256M
    sort_buffer_size = 256M
    read_buffer = 2M
    write_buffer = 2M

    [mysqld_safe]
    open-files-limit = 8192
This is the latest config that i made for testing, but the result is still bad at 500 online mysql CPU have peeks up to 30 %.
I used only myisam tables , only Inoodb but same results huge CPU usage and delay after 500 online, just the skill,item,skill_save tables are too big and i think that slows the whole server.
Atm i try use both myisam and innodb to reduce the work but no idea if work propertly...

Server start configs :
Gameserver
  • java -server -Djava.util.logging.manager=com.l2jserver.util.L2LogManager -Xms3072m -Xmx4096m -Xmn1024m -Xss128k -XX:+UseConcMarkSweepGC -XX:+UseParNewGC -XX:SurvivorRatio=8 -XX:TargetSurvivorRatio=90 -XX:MaxTenuringThreshold=31 -XX:+AggressiveOpts -cp ./../libs/*:l2jserver.jar com.l2jserver.gameserver.GameServer > log/stdout.log 2>&1
Login
  • nice -n -2 java -Xms256m -Xmx512m -Xmn128m -cp ./../libs/*:l2jlogin.jar com.l2jserver.loginserver.L2LoginServer > log/stdout.log 2>&1
    err=$?
  • # ---------------------------------------------------------------------------
    # Thread Configuration
    # ---------------------------------------------------------------------------
    # Extreme caution should be here, set to defaults if you do not know what you are doing.
    # These could possibly hurt your servers performance or improve it depending on your server's configuration, size, and other factors.
    # Default: 10
    ThreadPoolSizeEffects = 10

    # Default: 13
    ThreadPoolSizeGeneral = 13

    # Default: 2
    UrgentPacketThreadCoreSize = 2

    # Default: 4
    GeneralPacketThreadCoreSize = 4

    # Default: 4
    GeneralThreadCoreSize = 4

    # Default: 6
    AiMaxThread = 6

    # Dead Lock Detector (a separate thread for detecting deadlocks).
    # For improved crash logs and automatic restart in deadlock case if enabled.
    # Check interval is in seconds.
    # Default: False
    DeadLockDetector = False

    # Default: 20
    DeadLockCheckInterval = 20

    # Default: False
    RestartOnDeadlock = False
Can u give some advice where is the problem in the configs or somewhere other ?
I try almost everything that i know... so i ask for help :)

Ty in advice !

Best regards
KaMa3a
kama3a
Posts: 125
Joined: Mon Jul 07, 2008 4:01 pm

Re: Mysql problem CPU usage

Post by kama3a »

any ideas ? :(
User avatar
MELERIX
L2j Veteran
L2j Veteran
Posts: 6667
Joined: Sat Sep 23, 2006 11:31 pm
Location: Chile
Contact:

Re: Mysql problem CPU usage

Post by MELERIX »

I hope you are not using MySQL 32 bits in a machine with 12GB Ram :P

use MySQL 64 bits ;)
kama3a
Posts: 125
Joined: Mon Jul 07, 2008 4:01 pm

Re: Mysql problem CPU usage

Post by kama3a »

MELERIX wrote:I hope you are not using MySQL 32 bits in a machine with 12GB Ram :P

use MySQL 64 bits ;)
mysql Ver 14.14 Distrib 5.1.49, for debian-linux-gnu (x86_64) using readline 6.1
User avatar
MELERIX
L2j Veteran
L2j Veteran
Posts: 6667
Joined: Sat Sep 23, 2006 11:31 pm
Location: Chile
Contact:

Re: Mysql problem CPU usage

Post by MELERIX »

well, that version is a bit old...

better download the new version from MySQL website and install by yourself, you can install with double click RPM files (like in windows), but no idea if debian support RPM files.
kama3a
Posts: 125
Joined: Mon Jul 07, 2008 4:01 pm

Re: Mysql problem CPU usage

Post by kama3a »

MELERIX wrote:well, that version is a bit old...

better download the new version from MySQL website and install by yourself, you can install with double click RPM files (like in windows), but no idea if debian support RPM files.
i spend many weeks trying tuning the mysql, but as many friends telling everything in config is ok.
i try many variants of tuning and etc but aways on 500 online when few ppl change subclass or add new have huge peek to the mysql and that i think lagging the whole server..

Mybe i do something wrong.
Can u confir that configs are ok ? i need change something.... ?
atm i accept all kind of ideas... soon will try reinstall mysql.
User avatar
MELERIX
L2j Veteran
L2j Veteran
Posts: 6667
Joined: Sat Sep 23, 2006 11:31 pm
Location: Chile
Contact:

Re: Mysql problem CPU usage

Post by MELERIX »

mm, try increasing max_connections = 600 -> 1400

and if you have a custom npc buffer, disable that and check how the server goes in at least 2 hours...
kama3a
Posts: 125
Joined: Mon Jul 07, 2008 4:01 pm

Re: Mysql problem CPU usage

Post by kama3a »

MELERIX wrote:mm, try increasing max_connections = 600 -> 1400

and if you have a custom npc buffer, disable that and check how the server goes in at least 2 hours...
[OK] Highest usage of available connections: 8% (49/600)

that varible is fake ?

also when i monitor the custom buffer dont make any kind of bad cpu usage when some one work with him.
User avatar
MELERIX
L2j Veteran
L2j Veteran
Posts: 6667
Joined: Sat Sep 23, 2006 11:31 pm
Location: Chile
Contact:

Re: Mysql problem CPU usage

Post by MELERIX »

because there is some custom npc buffers that have issues closing connections, so they could consume a lot of mysql connections reaching high CPU usage or making server to crash when they consume all connections.
kama3a
Posts: 125
Joined: Mon Jul 07, 2008 4:01 pm

Re: Mysql problem CPU usage

Post by kama3a »

MELERIX wrote:because there is some custom npc buffers that have issues closing connections, so they could consume a lot of mysql connections reaching high CPU usage or making server to crash when they consume all connections.
thats the problem i dont have problem with the custom npc buffer, no error logs for unclosed connection.
also the log of mysqltunner shows
[OK] Highest usage of available connections: 16% (49/300)

also as i read the values seted up are for 1 connection when increase the connections to 600 or etc the max ram used is hm.. around 200 % more then available.

im still trying with random values on the sql to pereform better stability.
any other ideas ?
some info about good configs on the my.cnf ?

tnx
_DS_
L2j Veteran
L2j Veteran
Posts: 3437
Joined: Wed Apr 30, 2008 8:53 am
Location: Russia

Re: Mysql problem CPU usage

Post by _DS_ »

Disable your website during high cpu usage and check.
Commiter of the shit
public static final int PI = 3.1415926535897932384626433832795;
kama3a
Posts: 125
Joined: Mon Jul 07, 2008 4:01 pm

Re: Mysql problem CPU usage

Post by kama3a »

_DS_ wrote:Disable your website during high cpu usage and check.
i remove the select for accounts and characters was making a bit increase of the cpu usage.
but with online count and other stats like pvp, pk etc. - everything is normal.
kama3a
Posts: 125
Joined: Mon Jul 07, 2008 4:01 pm

Re: Mysql problem CPU usage

Post by kama3a »

latest results.
mysql config

Code: Select all

# 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# (via the "enable-named-pipe" option) 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 = 300 # 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 [mysqld_safe]table_open_cache = 3000 # 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 (note some# restrictions still apply!) 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 (Important when working with# large BLOBs).  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 (in memory) 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 = 2M # This buffer is used for the optimization of full JOINs (JOINs without# indexes). 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 foundjoin_buffer_size = 2M # 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. (Normally this doesn't give a notable performance# improvement if you have a good thread implementation.)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()# function call (Sun Solaris, for example).# You should try [number of CPUs]*(2..4) 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: 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 = 350M # 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 = 512k query_cache_type = 1 # 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() 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-storage-engine = INNODB # 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:# READ-UNCOMMITTED, READ-COMMITTED, REPEATABLE-READ, SERIALIZABLE#transaction_isolation = REPEATABLE-READ # Maximum size for internal (in-memory) 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 = 0M # 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=mysql-bin # binary logging format - mixed recommended#binlog_format=mixed # If you're using replication with chained slaves (A->B->C), 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 (even ones with incorrect# syntax) 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 # 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_short_format is not enabled. It is normally good idea# to have this turned on if you frequently add new queries to the# system.slow_query_log # All queries taking more than this amount of time (in seconds) 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 (as MySQL# currently measures time with second accuracy only).#long_query_time = 2 # 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 #*** 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 = 350M # 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 = 256k # 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 = 2M # MyISAM uses special tree-like cache to make bulk inserts (that is,# INSERT ... SELECT, INSERT ... VALUES (...), (...), ..., and LOAD DATA# INFILE) 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 = 30M # The maximum size of the temporary file MySQL is allowed to use while# recreating the index (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 (which is slower).myisam_max_sort_file_size = 100G myisam_max_extra_sort_file_size=100G # 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 # *** 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 = 8M # 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 = 1G # 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:10M: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 = /home/mysql # 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 = 8 # If set to 1, InnoDB will flush (fsync) 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# (even with long transactions). innodb_log_buffer_size = 6M # 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 = 50 innodb_file_per_table = 1 innodb_open_files = 3000 [mysqldump]# Do not buffer the whole result set in memory before writing it to# file. Required for dumping very large tablesquick max_allowed_packet = 16M [mysql]no-auto-rehash # Only allow UPDATEs and DELETEs that use keys.#safe-updates [myisamchk]key_buffer_size = 256Msort_buffer_size = 256Mread_buffer = 4Mwrite_buffer = 4M [mysqlhotcopy]interactive-timeout [mysqld_safe]# Increase the amount of open files allowed per process. Warning: Make# sure you have set the global system limit high enough! The high value# is required for a large number of opened tablesopen-files-limit = 8192

Code: Select all

-------- General Statistics --------------------------------------------------[--] Skipped version check for MySQLTuner script[OK] Currently running supported MySQL version 5.1.49-1ubuntu8.1-log[OK] Operating on 64-bit architecture -------- Storage Engine Statistics -------------------------------------------[--] Status: -Archive -BDB -Federated +InnoDB -ISAM -NDBCluster[--] Data in MyISAM tables: 172M (Tables: 4)[--] Data in InnoDB tables: 174M (Tables: 166)[!!] Total fragmented tables: 167 -------- Performance Metrics -------------------------------------------------[--] Up for: 3h 11m 5s (507K q [44.263 qps], 2K conn, TX: 108M, RX: 77M)[--] Reads / Writes: 19% / 81%[--] Total buffers: 1.7G global + 6.5M per thread (300 max threads)[OK] Maximum possible memory usage: 3.6G (30% of installed RAM)[OK] Slow queries: 0% (1/507K)[OK] Highest usage of available connections: 16% (49/300)[OK] Key buffer size / total MyISAM indexes: 350.0M/120.5M[OK] Key buffer hit rate: 99.7% (6M cached / 19K reads)[!!] Query cache efficiency: 3.8% (3K cached / 98K selects)[OK] Query cache prunes per day: 0[OK] Sorts requiring temporary tables: 0% (48 temp sorts / 5K sorts)[!!] Joins performed without indexes: 598[!!] Temporary tables created on disk: 42% (744 on disk / 1K total)[OK] Thread cache hit rate: 97% (53 created / 2K connections)[OK] Table cache hit rate: 30% (256 open / 842 opened)[OK] Open file limit used: 1% (75/6K)[!!] Table locks acquired immediately: 94%[!!] Connections aborted: 29%[OK] InnoDB data size / buffer pool: 174.2M/1.0G

Gameserver :

Code: Select all

java -server -Djava.util.logging.manager=com.l2jserver.util.L2LogManager -Xms4096m -Xmx6144m -Xmn2048m -Xss128k -XX:ParallelGCThreads=6 -XX:+UseConcMarkSweepGC -XX:+UseParNewGC -XX:SurvivorRatio=8 -XX:TargetSurvivorRatio=90 -XX:MaxTenuringThreshold=31 -XX:+AggressiveOpts -cp ./../libs/*:l2jserver.jar com.l2jserver.gameserver.GameServer > log/stdout.log 2>&1
and one question for that : XX:ParallelGCThreads
it count the threads or cores... ?

after change the gameservloop the cpu on java increase too..

new configuration from 9:00 to 13:00
Online count 280
Untitled.png
You do not have the required permissions to view the files attached to this post.
kama3a
Posts: 125
Joined: Mon Jul 07, 2008 4:01 pm

Re: Mysql problem CPU usage

Post by kama3a »

anyone can give ideas ?
User avatar
Airbourne
Posts: 2
Joined: Tue Oct 26, 2010 6:26 pm
Location: Kiev\Ukraine
Contact:

Re: Mysql problem CPU usage

Post by Airbourne »

kama3a wrote:anyone can give ideas ?
I was Interested by your problem and found few topics about optimization of java server to 1k online people.
There are some configs:

innodb_flush_log_at_trx_commit=2
innodb_log_buffer_size=16M
innodb_buffer_pool_size=1024M //in your config u have 1G try to wrote 1024m but i didnt think that it solve problem
innodb_log_file_size=512M
innodb_thread_concurrency=60
table_cache=256 (Если ваши таблицы становятся большими, нужно поставить более большее значение чем есть,т.е. если ваша таблица весит 200 мб,то нужно поставить в 2 раза больше т.е. 512.)
This is from Russian forum, it says that if your DB has 200mb u need to set config x2 for 200 it 500 if u have 100 u need to set 256 etc.

than u must use "memlock" config, thats use RAM and dont use Swap memory. really dont know where u can find it but 90% thats in mysql conf.

sry for some mistakes. i think these configs will help may be.
One more road to cross
One more risk to take
Gotta live my life
Like there’s one more move to make
Post Reply