当前位置:首页 > MySQL

MY SQL configuration

canca13年前 (2013-06-10)MySQL525

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 ...…

MySQl字段类型

MySQL支持大量的列类型,它可以被分为3类:数字类型、日期和时间类型以及字符串(字符)类型。本节首先给出可用类型的一个概述,并且总结每个列类型的存储需求,然后提供每个类中的类型性质的更详细的描述。概述有意简化,…

解决PHP存取MySQL 4.1乱码问题

从MySQL 4.1开始引入的多语言支持确实很棒,而且一些特性已经超过了其他的数据库系统。不过我在测试过程中发现使用适用于MySQL 4.1之前的PHP语句操作MySQL数据库会造成乱码,即使是设置过了表字符集也是如此。我读了一下新的M...…

MySQL免安装配置方法

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

发表评论

访客

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