I am using Mysql server 5.6. I don't have much idea about setting in my.ini file under MySql folder.
In my my.ini file the memory pool size is set to 679M. We are using InnoDB engine for mysql. Can I change the memory pool size? If yes, how much memory I have to give for better performance? Here below I specify my my.ini file settings.
What are the required settings for the Innodb engine?
Please mention settings which are unnecessary in my.ini file if engine used for mysql is innodb.
My my.ini file:
default-storage-engine=INNODB
sql-mode="STRICT_TRANS_TABLES,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION"
log-output=FILE
general_log_file="INDIAN-SERVER.log"
slow-query-log=1
slow_query_log_file="INDIAN-SERVER-slow.log"
long_query_time=10
log-error="INDIAN-SERVER.err"
server-id=1
max_connections=151
query_cache_size=0
table_open_cache=2000
tmp_table_size=107M
thread_cache_size=10
myisam_max_sort_file_size=100G
myisam_sort_buffer_size=204M
key_buffer_size=8M
read_buffer_size=64K
read_rnd_buffer_size=256K
sort_buffer_size=256K
innodb_additional_mem_pool_size=15M
innodb_flush_log_at_trx_commit=1
innodb_log_buffer_size=8M
innodb_buffer_pool_size=679M
innodb_log_file_size=48M
innodb_thread_concurrency=9
innodb_autoextend_increment=64
innodb_buffer_pool_instances=8
innodb_concurrency_tickets=5000
innodb_old_blocks_time=1000
innodb_open_files=300
innodb_stats_on_metadata=0
innodb_file_per_table=1
innodb_checksum_algorithm=0
back_log=80
flush_time=0
join_buffer_size=256K
max_allowed_packet=4M
max_connect_errors=100
open_files_limit=4161
query_cache_type=0
sort_buffer_size=256K
table_definition_cache=1400
binlog_row_event_max_size=8K
sync_master_info=10000
sync_relay_log=10000
sync_relay_log_info=10000
See memory for discussion of what to set it to. (It depends on how much RAM you have available.)
Those settings need to be in the [mysqld] secdion of the config file. The value look like they were generated by some install script; they are probably reasonable. Most people do not need to touch the config, especially if the install script does things such as adjust for RAM size.
To have my.ini (or my.cnf) values take effect, stop and restart the server. The details of that are OS-dependent.
Related
good morning This is my problem
I have two servers
first A: AMD Epyc 7371 - 16c / 32t - 3.1 GHz / 3.8 GHz 256 GB ECC 2400 MHz 2 × 960 GB NVMe SSD MySql 8.0.26
second B: Dual Intel Xeon Gold 6242R - 20c / 40t - 3.1 GHz / 4.1 GHz 384 GB ECC 2933 MHz 6 × 3.84 TB NVMe SSD 2 × 480 GB SATA SSD
On server A, despite being smaller, the database works well and transactions are very fast in terms of users on this server they reach over 200 in councurrency
On the much larger Server B this happens to me: up to 50 concurrent users is not a problem the database works well, after the 50 users to go up, the database starts to slow down.
I specify that both servers have the same database, same tables, same Stored Procedure, same applications, in practice they are a copy of each other
I lost sleep to figure out where the problem lies
This is the configuration file
[client]
pipe=
socket=MYSQL
port=3306
[mysql] no-beep
default-character-set=
server_type=1
[mysqld]
port=3306
datadir=E:/ProgramData/MySQL/MySQL Server 8.0\Data
character-set-server=
default-storage-engine=INNODB
sql-mode="STRICT_TRANS_TABLES,NO_ENGINE_SUBSTITUTION"
log-output=FILE
general-log=0
general_log_file="NS31525947.log"
slow-query-log=1
slow_query_log_file="NS31525947-slow.log"
long_query_time=10
log-error="NS31525947.err"
log-bin="NS31525947-bin"
server-id=1
lower_case_table_names=1
secure-file-priv="C:/ProgramData/MySQL/MySQL Server 8.0/Uploads"
max_connections = 500
table_open_cache=3G
tmp_table_size=3G
thread_cache_size=100
myisam_max_sort_file_size=10G
myisam_sort_buffer_size=68G
key_buffer_size=61M
read_buffer_size=23M
read_rnd_buffer_size=256K
innodb_flush_log_at_trx_commit=0
innodb_log_buffer_size=512M
innodb_buffer_pool_size=10G
innodb_log_file_size=1G
innodb_thread_concurrency=0
innodb_autoextend_increment=64
innodb_buffer_pool_instances=8
innodb_concurrency_tickets=5000
innodb_old_blocks_time=1000
innodb_stats_on_metadata=0
innodb_file_per_table=1
innodb_checksum_algorithm=0
back_log=80
flush_time=0
join_buffer_size=256K
max_allowed_packet=4M
max_connect_errors=100
open_files_limit=10000
sort_buffer_size=256K
table_definition_cache=1400
binlog_row_event_max_size=8K
sync_relay_log=10000
sync_relay_log_info=10000
loose_mysqlx_port=33060
default_authentication_plugin = mysql_native_password
I state I also tried to put the same My.ini as server A on server B and nothing i put logs to track write times, and in this case past the 50 users on the B server the writes slow down The strange thing that i noticed that the value of the Key Efficient is always 0.0% unlike Server A the value is 100%
Please Help me Thanks
I'm setting up a new server, and want to move existing phpBB installation there. Everything went OK, except one SELECT is in SLOW log and eats CPU forever. I am not DB specialist, so I am lost.
Old server - Win2008 R2, MySQL 5.7.24, php 5.6.39, single i7 Quad Core CPU, 24GB RAM
New Server - Win2016, MySQL 8.0.15, php 7.1.5, dual Xeon CPUs, 96GB RAM
I tried to open every table and check for errors, performed mysql_upgrade with OK result. The problematic SELECT is:
SELECT ug.user_id, a.forum_id, r.auth_setting, r.auth_option_id, ao.auth_option
FROM phpbb_acl_groups a, phpbb_user_group ug, phpbb_groups g, phpbb_acl_roles_data r, phpbb_acl_options ao
WHERE a.auth_role_id = r.role_id AND r.auth_option_id = ao.auth_option_id
AND a.group_id = ug.group_id
AND g.group_id = ug.group_id
AND ug.user_pending = 0
AND NOT (ug.group_leader = 1 AND g.group_skip_auth = 1)
AND ao.auth_option = 'm_';
On the old server the select is done immeditely. On the new server it last 25 - 30 seconds. See pictures - look a the "rows examined". But all tables looks OK...
New server
Old server
Old server my.ini looks like this:
max_connections=151
table_open_cache=2000
tmp_table_size=922M
myisam_max_sort_file_size=100G
myisam_sort_buffer_size=3G
key_buffer_size=8M
read_buffer_size=64K
read_rnd_buffer_size=256K
innodb_flush_log_at_trx_commit=1
innodb_log_buffer_size=1M
innodb_buffer_pool_size=1024M
innodb_log_file_size=128M
innodb_thread_concurrency=17
innodb_autoextend_increment=64
innodb_buffer_pool_instances=8
innodb_concurrency_tickets=5000
innodb_old_blocks_time=1000
innodb_open_files=300
innodb_stats_on_metadata=0
innodb_file_per_table=1
innodb_checksum_algorithm=0
back_log=80
flush_time=0
join_buffer_size=256K
max_allowed_packet=4M
max_connect_errors=100
open_files_limit=4161
sort_buffer_size=256K
table_definition_cache=1400
binlog_row_event_max_size=8K
sync_master_info=10000
sync_relay_log=10000
sync_relay_log_info=10000
New server my.ini looks like this:
max_connections=151
table_open_cache=2000
tmp_table_size=5G
thread_cache_size=10
myisam_max_sort_file_size=100G
myisam_sort_buffer_size=10G
key_buffer_size=8M
read_buffer_size=64K
read_rnd_buffer_size=256K
innodb_flush_log_at_trx_commit=1
innodb_log_buffer_size=1M
innodb_buffer_pool_size=2048M
innodb_log_file_size=128M
innodb_thread_concurrency=24
innodb_autoextend_increment=64
innodb_buffer_pool_instances=8
innodb_concurrency_tickets=5000
innodb_old_blocks_time=1000
innodb_open_files=300
innodb_stats_on_metadata=0
innodb_file_per_table=1
innodb_checksum_algorithm=0
back_log=80
flush_time=0
join_buffer_size=256K
max_allowed_packet=4M
max_connect_errors=100
open_files_limit=4161
sort_buffer_size=256K
table_definition_cache=1400
binlog_row_event_max_size=8K
sync_master_info=10000
sync_relay_log=10000
sync_relay_log_info=10000
So, I:
compared every table data, columns, rows, indexes between old and new database. I didnt found any single difference.
installed mysql 8.0.15 on different machine and tried it there - just in case there is something wrong on the new server.
With no luck.
So as last try, I downloaded current mysql 5.7.25 version and guess what - it works.
So is it possible that it is some bug in MySQL 8.x branch ? I dont see any other explanation...
This url https://dev.mysql.com/doc/relnotes/mysql/8.0/en/
indicates the GA release date is 2019-02-01 for 8.0.15. Anytime you JUMP into a release with LESS THAN 90 days of GA, you are indicating your willingness to find/report bugs that were missed. You made a wise decision to go back to a 5.7 something with some practical in the field history of success. You may wish to establish 180 days AFTER General Availability to prevent finding/reporting or being exposed to bugs that have just not been corrected yet.
We are not able to create a stable configuration of a production server with MySQL and Tomcat Application Server. The MySQL throws very often an error:
MySQL: Out of memory (Needed 429496728 bytes)
It was a Windows Server 2012 with 64 GB of RAM. We see in the process tab, that the MySQLd commited 64 GB of RAM (that means all the available RAM in the server).
For your explaination, the Application uses completly inMemory based Tables in the MySQL Server.
See the my.ini Configuration
[client]
port=3306
[mysql]
default-character-set=utf8
[mysqld]
port=3306
basedir="F:/MySQL Server 5.6/"
datadir="F:/MySQL Server 5.6/data/"
character-set-server=utf8
default-storage-engine=MyISAM
sql-mode="STRICT_TRANS_TABLES,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION"
max_connections=200
query_cache_size=0
# table_cache=256
tmp_table_size=6G
max_heap_table_size=6G
max_tmp_tables=2048
open_files_limit=40000
thread_cache_size=8
myisam_max_sort_file_size=100G
myisam_sort_buffer_size=32M
myisam_use_mmap=0
concurrent_insert=2
key_buffer_size=2G
read_buffer_size=512M
read_rnd_buffer_size=512M
sort_buffer_size=128M
bulk_insert_buffer_size=32M
#skip-innodb
innodb_additional_mem_pool_size=15M
innodb_flush_log_at_trx_commit=1
innodb_log_buffer_size=7M
innodb_buffer_pool_size=686M
innodb_log_file_size=343M
innodb_thread_concurrency=34
slow_query_log=1
log-queries-not-using-indexes=1
long_query_time=1
log-output=FILE,TABLE
slow_query_log_file="F:/MySQL Server 5.6/localhost-slow-query.log"
event-scheduler=ON
Does anybody have a suitable solution to get this fixed?
We also use the MySQL Tuner to get informations, here the results:
What I cannot attach is the MySQL Tuner results as image (too few reputations). But look here.
Up for 39days
Data in Memory Tables 42G (Tables:281)
Data in MyISAM tables 31G (Tables 668)
total buffers: 2.3G global + 144.5M per Thread (200 max threads)
maximum possible memory usage: 30.5G (47% of installed RAM)
Key buffer size /total MyISAM indixes: 640M/7.0G
query cache disabled
joins performed without indixes: 337737
In an intranet Apache/PHP/MySQL web application that has run very well for several years now, I recently undertook an upgrade from 2.2/5.2.5/5.0.x to 2.4/5.5.11/5.6.17 respectively, all on Windows 8.
The most obvious consequence of this upgrade, sadly, has been to notice significant performance bottlenecks at most of my more intensive db queries.
In particular, I have a script that restores an entire db, consisting of over 250 tables, into an empty schema, using csv files and LOAD DATA INFILE.... Whereas this query used to get done in around one minute, it now takes over 5 minutes, and sometimes much longer.
I have also noticed slow performance during recreation of the tables (using mysqldump created script), even prior to loading data.
Apart from about 5 tables which are MyISAM, all others are InnoDB.
The hardware environment is a 'regular' HP laptop with 4GB of RAM and Intel 2.40GHz, dual core with 4 Logical Processors.
My my.ini is auto-created during installation (which I have always done using the windows executable option from MySQL website. The current configurations are:
[mysqld]
port=3306
datadir="C:/ProgramData/MySQL/MySQL Server 5.6/data/"
character-set-server=utf8
default-storage-engine=INNODB
sql-mode="STRICT_TRANS_TABLES,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION"
log-output=FILE
general-log=0
general_log_file="COMPUTERNAME.log"
slow-query-log=1
slow_query_log_file="COMPUTERNAME-slow.log"
long_query_time=10
log-error="COMPUTERNAME.err"
max_connections=100
query_cache_size=0
table_open_cache=2000
tmp_table_size=19M
thread_cache_size=9
myisam_max_sort_file_size=100G
myisam_sort_buffer_size=36M
key_buffer_size=8M
read_buffer_size=64K
read_rnd_buffer_size=256K
sort_buffer_size=256K
innodb_additional_mem_pool_size=2M
innodb_flush_log_at_trx_commit=1
innodb_log_buffer_size=4M
innodb_buffer_pool_size=512M
innodb_log_file_size=128M
innodb_thread_concurrency=9
innodb_autoextend_increment=64M
innodb_buffer_pool_instances=8
innodb_concurrency_tickets=5000
innodb_old_blocks_time=1000
innodb_open_files=300
innodb_stats_on_metadata=0
innodb_file_per_table=1
innodb_checksum_algorithm=0
back_log=70
flush_time=0
join_buffer_size=512K
max_allowed_packet=4M
max_connect_errors=100
open_files_limit=4110
query_cache_type=0
sort_buffer_size=256K
table_definition_cache=1400
binlog_row_event_max_size=8K
sync_master_info=10000
sync_relay_log=10000
sync_relay_log_info=10000
Please forgive the long question, as I reckon that these details might hold the key to an eventual solution.
Thank you.
I'm moving from a shared web hosting company to a VPS. And I'm trying to find the optimum configuration for my system.
For 1 specific table with half a million record, 1 query that was taking few seconds on the previous server is now taking minutes.
I'm trying to improve the response time of my server, so I bought more memory (I have 2GB of RAM, and I can still buy more resources if needed and 2 cores). I have also "cheated" by copying my.cnf of the old company to my VPS:
[mysqld]
read_buffer_size=8M
read_rnd_buffer_size=8M
sort_buffer_size=32M
innodb_additional_mem_pool_size=503M
innodb_flush_log_at_trx_commit=1
innodb_log_buffer_size=16M
innodb_buffer_pool_size=1007M
innodb_log_file_size=256M
innodb_thread_concurrency=8
innodb_autoextend_increment=128
max_connections=8059
max_user_connections=50
thread_cache_size=128
thread_stack=196608
binlog_cache_size=2M
net_read_timeout=30
net_retry_count=10
net_write_timeout=30
thread_concurrency=10
open_files_limit=9940
max_heap_table_size=32M
tmp_table_size=64M
key_buffer_size=512M
key_buffer=128M
myisam_sort_buffer_size=64M
join_buffer=16M
record_buffer=8M
wait_timeout=300
connect_timeout=10
max_allowed_packet=16M
max_connect_errors=100
table_cache=1024
query_cache_size=32M
query_cache_type=1
ft_min_word_len=4
datadir=/var/lib/mysql
tmpdir=/tmp
socket=/var/lib/mysql/mysql.sock
old-passwords=0
[mysqldump]
quick
max_allowed_packet=16M
[myisamchk]
key_buffer=64M
sort_buffer=64M
read_buffer=16M
write_buffer=16M
The problem is that the query is still slow, and the server does not use the available memory!
total used free shared buffers cached
Mem: 2002 1986 15 0 6 1079
-/+ buffers/cache: 901 1101
Swap: 1747 2 1745
Any suggestions?
Regards
You can have a look at using
https://github.com/rackerhacker/MySQLTuner-perl
Which you can use to analyse MySQL and it will output recommended settings.
Your settings seem way high for 2gb memory.
IE max_connections=8059
That in its self would require way more memory than you have.
[mysqld]
max_connections=100
innodb_buffer_pool_size=256M
query_cache_size=256M
key_buffer_size=256M
innodb_flush_log_at_trx_commit=0
innodb_flush_method=O_DIRECT
query_cache_type=1
query_cache_limit=2M
table_cache=1024
join_buffer_size=4M
thread_cache_size=128
tmp_table_size=256M
max_heap_table_size=256MB
For 2gb RAM you could try using these settings in MySQL
These are the recommended settings for one of the 2gb servers I am currently using