1
How to set up the Mysql server for better performance in relation to memory usage, processing and cache usage where the machine has limited resources? Is there any tool that can help me set the best settings for my server?
I am having problems with the response time of SQL queries due to the high number of data in the database, and the problem is not in queries or modeling, as it worked well in another virtual machine with the same settings, but it was corrupted and I lost the settings.
- Total of 5Gb data;
- The tables are Innodb;
- The server is currently virtualized with 512Mb of RAM and 20Gb;
- Architecture 32bits;
- Ubuntu Server 14 operating system;
- Mysql version 5.5.46;
- Tables and indexes are optimized;
- The system is done in the PHP language;
- PHP version 5.5;
- Utilizes PDO.
The file my.cnf
[client]
port = 3306
socket = /var/run/mysqld/mysqld.sock
[mysqld_safe]
socket = /var/run/mysqld/mysqld.sock
nice = 0
[mysqld]
user = mysql
pid-file = /var/run/mysqld/mysqld.pid
socket = /var/run/mysqld/mysqld.sock
port = 3306
basedir = /usr
datadir = /var/lib/mysql
tmpdir = /tmp
lc-messages-dir = /usr/share/mysql
skip-external-locking
#bind-address = 127.0.0.1
key_buffer_size = 16M
max_allowed_packet = 16M
thread_stack = 192K
thread_cache_size = 8
myisam-recover = BACKUP
#max_connections = 100
#table_cache = 64
#thread_concurrency = 10
query_cache_limit = 1M
query_cache_size = 16M
#general_log_file = /var/log/mysql/mysql.log
#general_log = 1
log_error = /var/log/mysql/error.log
#log_slow_queries = /var/log/mysql/mysql-slow.log
#long_query_time = 2
#log-queries-not-using-indexes
#server-id = 1
#log_bin = /var/log/mysql/mysql-bin.log
expire_logs_days = 10
max_binlog_size = 100M
#binlog_do_db = include_database_name
#binlog_ignore_db = include_database_name
# ssl-ca=/etc/mysql/cacert.pem
# ssl-cert=/etc/mysql/server-cert.pem
# ssl-key=/etc/mysql/server-key.pem
[mysqldump]
quick
quote-names
max_allowed_packet = 16M
[mysql]
#no-auto-rehash # faster start of mysql but no tab completition
[isamchk]
key_buffer = 16M
#
# * IMPORTANT: Additional settings that can override those from this file!
# The files must end with '.cnf', otherwise they'll be ignored.
#
!includedir /etc/mysql/conf.d/
server with 512 Mb of memory is complicated.. About data volume. 5GB is not considered large.. In a default setting, it does not affect performance. Maybe it’s using indices too much or unnecessarily or putting together very complex queries. Often a simple change of technique in a complex query or a change in modeling can improve performance considerably. So it’s a very broad question. There are many variants.
– Daniel Omine
The problem is not in the queries or modeling, because it worked well in another virtual machine with the same settings. The machine that was before was corrupted and lost the settings.
– marcusagm
add this "small detail" and other relevant to the question..
– Daniel Omine
Added more details to the question.
– marcusagm