问题背景:
用户在使用Doris的时候,当访问用户过多时会报Reach limit of connections
,针对这种情况需要调整Doris最大连接数,具体做法如下。
解决办法:
- Session变量设置
SET PROPERTY FOR 'root' 'max_user_connections' = '10000';
- 在fe.conf添加如下配置并重启
qe_max_connection= 102400
max_connection_scheduler_threads_num=409600
- 创建库表和插入数据:
CREATE TABLE `test_xxx` (`day` date NOT NULL COMMENT 'default 1980-00-00',`user_type` varchar(20) NULL,`product` varchar(20) NULL,`user_id` varchar(20) NULL,`value` int(11) NULL,`cut` bigint(20) NULL,`cut1` smallint(6) NULL
) ENGINE=OLAP
UNIQUE KEY(`day`, `user_type`, `product`, `user_id`)
COMMENT 'OLAP'
PARTITION BY RANGE(`day`)
(PARTITION p201701 VALUES [('0000-01-01'), ('2017-02-01')),
PARTITION p201702 VALUES [('2017-02-01'), ('2017-03-01')),
PARTITION p201703 VALUES [('2017-03-01'), ('2017-04-01')))
DISTRIBUTED BY HASH(`day`, `user_type`) BUCKETS 1
PROPERTIES (
"replication_allocation" = "tag.location.default: 1",
"is_being_synced" = "false",
"storage_format" = "V2",
"light_schema_change" = "true",
"disable_auto_compaction" = "false",
"enable_single_replica_compaction" = "false"
); mysql> select * from test_xxx;
+------------+-----------+---------+---------+-------+------+------+
| day | user_type | product | user_id | value | cut | cut1 |
+------------+-----------+---------+---------+-------+------+------+
| 2017-02-02 | a | p_a | user1 | 1 | 2 | 3 |
+------------+-----------+---------+---------+-------+------+------+
1 row in set (0.03 sec)mysql>
- vim max_connect.sql 并写入如下数据
select * from test_xxx;
- 执行
mysqlslap -h127.0.0.1 -P9030 -uroot --concurrency=3000 --iterations=1 --create-schema=test --query=max_connect.sql
,使用mysqlslap进行压测。 - 这里可以看到有3000个并发同时提交到Doris,所有SQL正常支持完成。