当前位置:首页 > MySQL > 正文内容

MY SQL configuration

canca13年前 (2013-06-10)MySQL463

ASK:

We have a database Server Configuration:
4GB RAM
600GB Hard Disk
Xeon Processor 1.3 Ghz.

We are barely able to have 100 concurrent users!!! What are we doing wrong.

I know I need to configure mysql_query cache, mysql_limit_size and table_cache. But what should be the formula, and how do we go about checking the same.

Below is the details of our my.ini file.

[mysqld]
datadir=/database/data
socket=/var/lib/mysql/mysql.sock
set-variable=max_connections=2000
set-variable = max_allowed_packet=64M
default-storage-engine = innodb
log-bin=/database/data/mysql-bin

old_passwords=1

[mysql.server]
user=mysql
basedir=/var/lib

[mysqld_safe]
log-error=/var/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid

Answer:

Try this configuration and read my comments inside it

#you really don't need more than 200 connections
max_connections = 200  

#this can be safely reduced to 32 or even 16M if you have few (0-20) or small (<1gb total) databases
key_buffer = 128M 

myisam_sort_buffer_size = 32M
join_buffer_size = 2M
read_buffer_size = 1M
sort_buffer_size = 8M

#use total number of database tables +20%  (ALL databases) - if you just have a single drupal database 100-150 will be enough
table_cache = 2000 

thread_cache_size = 32
wait_timeout = 3600
connect_timeout = 4
tmp_table_size = 64M
max_heap_table_size = 64M
max_allowed_packet = 64M
read_rnd_buffer_size = 524288
bulk_insert_buffer_size = 8M

#if you get a long query selecting a lot of data you might want to increase this
query_cache_limit = 32M

#play with this until you get 80% cache filled after mysql server has been running for 24h+, if this is a dedicated database server you can go nuts with this up to 70% of RAM, but it there is no queries to be cached this will be pretty useless. Better stay under 512M and use rest for memcached
query_cache_size = 96M

query_cache_type = 1
query_prealloc_size = 65536
query_alloc_block_size = 131072
open_files_limit = 8196

key_buffer_size         = 64M
thread_stack            = 128K

add the rest of the config (user, pid, passwords, etc) from you current configuration

If you can't handle it on your own, or need someone to fine tune the settings let me know - I'll have a look.


Refer:https://groups.drupal.org/node/13844

扫描二维码推送至手机访问。

版权声明:本文由Ant.Master's Blog发布,如需转载请注明出处。

本文链接:https://iant.work/post/140.html

标签: MySQL
分享给朋友:

“MY SQL configuration” 的相关文章

小谈MySQL字符集

首先,这片文章纯粹是我的个人经验之谈,适用于我常见的环境及项目中.个人建议,数据库字符集尽量使用utf8(HTML页面对应的是utf-8),以使你的数据能很顺利的实现迁移,因为utf8字符集是目前最适合于实现多种不同字符集之间的转换的字符集,尽管你在命令行工具上可能无法正确查看数据库中的内容,我依然...

mysql 配置命令大全

--auto-rehash       Enable automatic rehashing. One doesn't need to use             ...

mysql 外鍵約束

1. 什么是参照完整性?——————–参照完整性(完整性约束)是数据库设计中的一个重要概念,当数据库中的一个表与一个或多个表进行关联时都会涉及到参照完整性。比如下面这个例子:文章分类表 -  categoriescategory_id     nam...

MySQL免安装配置方法

1.下载一个安装版的。 安装版,安装后%MYSQL_HOME%\bin下有一个mysqld-nt.exe文件。将它复制出来(珍藏起来)。 2.下载一个免安装版MSYQL 将它解压。例如:E:/mysql-6.0.3-alpha-win32 将my-huge.ini另存为my.ini。 打开my.in...

MySQL备份与恢复语句

mysql备份语句:E:\MySQL Server 5.0\bin>mysqldump -uroot -padmin --default-character-set=utf8 --opt --extended-insert=false --triggers -R --hex-blob -x s...

Mysql中触发器的使用

在SQL中,名词触发器指“在数据库中为响应一个特殊表格中的某些事件而自动执行的程序代码。”(Wikipedia)说得简单一些,它是在一个特殊的数据库事件,如INSERT或DELETE发生时,自动激活的一段代码。触发器可方便地用于日志记录、对单个表格到其他链接式表格进行自动...

发表评论

访客

◎欢迎参与讨论,请在这里发表您的看法和观点。