mycat 用Jconsole监控mycat压测的各种性能曲线

1,最方便的Mycat监控工具—Jconsole

JDK自带,Windows下图形界面,监控分析Java程序,进入jdk安装目录的bin下面,C:\Program Files\Java\jdk1.7.0_15\bin,双击jconsole.exe打开。

 

2,去查看后台jmx启动的端口

查看jmx进程号:

[root@oracle_standby conf]# ps -eaf|grep jmx                                                                                                                                                                                                                                 

root     11362  4823  0 17:15 pts/1    00:00:00 grep jmx

root     13571 13569  0 Mar28 ?        00:34:16 java -DMYCAT_HOME=. -server -XX:MaxPermSize=64M -XX:+AggressiveOpts -XX:MaxDirectMemorySize=2G -Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.port=1984 -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.ssl=false -Xmx4G -Xms1G -Djava.library.path=lib -classpath lib/wrapper.jar:conf:lib/univocity-parsers-1.5.4.jar:lib/libwrapper-linux-x86-64.so:lib/jline-0.9.94.jar:lib/curator-client-2.9.0.jar:lib/wrapper.jar:lib/libwrapper-linux-ppc-64.so:lib/curator-framework-2.9.0.jar:lib/sequoiadb-java-driver-1.0-20150615.070208-1.jar:lib/dom4j-1.6.1.jar:lib/slf4j-api-1.7.12.jar:lib/mongo-java-driver-2.11.4.jar:lib/fastjson-1.2.7.jar:lib/libwrapper-linux-x86-32.so:lib/mapdb-1.0.7.jar:lib/leveldb-api-0.7.jar:lib/netty-3.7.0.Final.jar:lib/leveldb-0.7.jar:lib/zookeeper-3.4.6.jar:lib/druid-1.0.14.jar:lib/guava-18.0.jar:lib/slf4j-log4j12-1.7.12.jar:lib/xml-apis-1.0.b2.jar:lib/ehcache-core-2.6.11.jar:lib/json-20151123.jar:lib/snakeyaml-1.16.jar:lib/Mycat-server-1.5-alpha.jar:lib/log4j-1.2.17.jar:lib/ojdbc14.jar -Dwrapper.key=CRU7IdHhg3TMtPCL -Dwrapper.port=32000 -Dwrapper.jvm.port.min=31000 -Dwrapper.jvm.port.max=31999 -Dwrapper.pid=13569 -Dwrapper.version=3.2.3 -Dwrapper.native_library=wrapper -Dwrapper.service=TRUE -Dwrapper.cpu.timeout=10 -Dwrapper.jvmid=1 org.tanukisoftware.wrapper.WrapperSimpleApp org.opencloudb.MycatStartup start

[root@oracle_standby conf]#

 

根据进程号13571来查看tcp端口:

[root@oracle_standby conf]# netstat -ntpl |grep 13571                                                                                                                                                                                                                 

tcp        0      0 127.0.0.1:32000             0.0.0.0:*                   LISTEN      13571/java         

tcp        0      0 :::42968                    :::*                        LISTEN      13571/java         

tcp        0      0 :::1984                     :::*                        LISTEN      13571/java         

tcp        0      0 :::8066                     :::*                        LISTEN      13571/java         

tcp        0      0 :::9066                     :::*                        LISTEN      13571/java         

tcp        0      0 :::50954                    :::*                        LISTEN      13571/java         

[root@oracle_standby conf]#

 

 原blog地址:http://blog.csdn.net/mchdba/article/details/51050008,未经过原作者mchdba(黄杉)同意,谢绝转载。

3,添加新帐号jconsole用来连接

添加用户:

[root@oracle_standby conf]# useraddjconsole

[root@oracle_standby conf]#

 

赋予jconsole超级管理员权限,能监控jvm的运行状态

[root@oracle_standby conf]# gpasswd -ajconsole root

Adding user jconsole to group root

[root@oracle_standby conf]# passwd jconsole

更改用户 jconsole 的密码。

新的密码:

重新输入新的密码:

passwd: 所有的身份验证令牌已经成功更新。

[root@oracle_standby conf]#

 

4,连接一直报错问题解决

报错是:

连接失败:是否重试?

未成功连接到[email protected]:1984。

是否要重试?

如下图所示:

mycat 用Jconsole监控mycat压测的各种性能曲线_第1张图片mycat 用Jconsole监控mycat压测的各种性能曲线_第2张图片

 mycat 用Jconsole监控mycat压测的各种性能曲线_第3张图片

 

 

 

解决方便,编辑wrapper.conf,将jmxremote.port端口从1984改成51984,然后重新加载mycat,配置文件改动如下:

[root@oracle_standby conf]# more wrapper.conf |grep 1984                                                                                                                                                                                          

wrapper.java.additional.7=-Dcom.sun.management.jmxremote.port=51984

[root@oracle_standby conf]#

 

之后重新使用jconsole连接远程的mycat,就成功了,如下所示:

 

 mycat 用Jconsole监控mycat压测的各种性能曲线_第4张图片

 

5,准备数据环境mysql5.6

在mycat命令窗口上面

-- 1) 创建MYCAT_SEQUENCE表

DROP TABLE IF EXISTS MYCAT_SEQUENCE;                                                                                                                                                                                                                     

CREATE TABLE MYCAT_SEQUENCE (NAME VARCHAR(50) NOT NULL,current_value INT NOT NULL,increment INT NOT NULL DEFAULT 100, PRIMARY KEY(NAME)) ENGINE=INNODB;

 

 

 

INSERT INTO MYCAT_SEQUENCE(NAME,current_value,increment) VALUES ('GLOBAL', 100000, 100);

 

 

5.1在 dn21节点上创建相关function

DROP FUNCTION IF EXISTS `mycat_seq_currval`;                                                                                                                                                                                                                   

DELIMITER ;;

CREATE DEFINER=`root`@`192.168.%` FUNCTION `mycat_seq_currval`(seq_name VARCHAR(50))

RETURNS VARCHAR(64) CHARSET latin1

    DETERMINISTIC

BEGIN

        DECLARE retval VARCHAR(64);

        SET retval="-999999999,null"; 

        SELECT CONCAT(CAST(current_value AS CHAR),",",CAST(increment AS CHAR) ) INTO retval

          FROM MYCAT_SEQUENCE  WHERE NAME = seq_name; 

        RETURN retval ;

END

;;

DELIMITER ;

 

mysql> USE db3;

DATABASE CHANGED

mysql> DROP FUNCTION IF EXISTS `mycat_seq_currval`;

QUERY OK, 0 ROWS affected, 1 warning (0.05 sec)

 

mysql> DELIMITER ;;

mysql> CREATE DEFINER=`root`@`192.168.%` FUNCTION `mycat_seq_currval`(seq_name VARCHAR(50))

    -> RETURNS VARCHAR(64) CHARSET latin1

    ->     DETERMINISTIC

    -> BEGIN

    ->         DECLARE retval VARCHAR(64);

    ->         SET retval="-999999999,null"; 

    ->         SELECT CONCAT(CAST(current_value AS CHAR),",",CAST(increment AS CHAR) ) INTO retval

    ->           FROM MYCAT_SEQUENCE  WHERE NAME = seq_name; 

    ->         RETURN retval ;

    -> END

    -> ;;

QUERY OK, 0 ROWS affected, 1 warning (0.08 sec)

 

mysql> DELIMITER ;

mysql>

 

 

 

 

 

5.2 设置sequence值

DROP FUNCTION IF EXISTS `mycat_seq_nextval`;                                                                                                                                                                                                                 

DELIMITER ;;

CREATE DEFINER=`root`@`192.168.%` FUNCTION `mycat_seq_nextval`(seq_name VARCHAR(50)) RETURNS VARCHAR(64)

 CHARSET latin1

    DETERMINISTIC

BEGIN

         UPDATE MYCAT_SEQUENCE 

                 SET current_value = current_value + increment

                  WHERE NAME = seq_name; 

         RETURN mycat_seq_currval(seq_name); 

END

;;

DELIMITER ;

 

mysql> DROP FUNCTION IF EXISTS `mycat_seq_nextval`;

QUERY OK, 0 ROWS affected, 1 warning (0.00 sec)

 

mysql> DELIMITER ;;

mysql> CREATE DEFINER=`root`@`192.168.%` FUNCTION `mycat_seq_nextval`(seq_name VARCHAR(50)) RETURNS VARCHAR(64)

    ->  CHARSET latin1

    ->     DETERMINISTIC

    -> BEGIN

    ->          UPDATE MYCAT_SEQUENCE 

    ->                  SET current_value = current_value + increment

    ->                   WHERE NAME = seq_name; 

    ->          RETURN mycat_seq_currval(seq_name); 

    -> END

    -> ;;

QUERY OK, 0 ROWS affected, 1 warning (0.01 sec)

 

mysql> DELIMITER ;

mysql>

 

 

 

 

5.3 获取下一个sequence值

DROP FUNCTION IF EXISTS `mycat_seq_setval`;                                                                                                                                                                                                                 

DELIMITER ;;

CREATE DEFINER=`root`@`192.168.%` FUNCTION `mycat_seq_setval`(seq_name VARCHAR(50), VALUE INTEGER)

RETURNS VARCHAR(64) CHARSET latin1

    DETERMINISTIC

BEGIN

         UPDATE MYCAT_SEQUENCE 

                   SET current_value = VALUE 

                   WHERE NAME = seq_name; 

         RETURN mycat_seq_currval(seq_name); 

END

;;

DELIMITER ;

 

 

5.4 设置sequence配置的节点

sequence_db_conf.properties相关配置,指定sequence相关配置在哪个节点上:

 

PERSON=dn101

 

注意:MYCAT_SEQUENCE表和以上的3个function,需要放在同一个节点上。function请直接在具体节点的数据库上执行,如果执行的时候报:

you might want TO USE the LESS safe              variable

需要对数据库做如下设置:

windows下my.ini[mysqld]加上log_bin_trust_function_creators=1

linux下/etc/my.cnf下my.ini[mysqld]加上log_bin_trust_function_creators=1

修改完后,即可在mysql数据库中执行上面的函数.

 

使用示例:

mysql> create table t1(id int,name varchar(255));                                                                                                                                                                                                                       

Query OK, 0 rows affected (0.22 sec)

 

mysql>

mysql> INSERT INTO t1(id) VALUES( 1401328239716208640);

Query OK, 1 row affected (0.01 sec)

 

mysql> select * from t1;

+---------+

| id      |

+---------+

|  100202 |

+---------+

4 rows in set (0.08 sec)

 

mysql>

 

 

5.5,设置hash分片

schema.xml配置文件:      

                                                                                   

  

       

       

 

 

        

rule.xml配置文件:      

                                                                                                                                                                                                                                   

               

                        id

                        rang-long

               

        

       

                class="org.opencloudb.route.function.AutoPartitionByLong">

                autopartition-long.txt

       

 

分片规则配置文件:autopartition-long.txt,M表示万

[root@oracle_standby bin]# more ../conf/autopartition-long.txt                                                                                                                                                                                               

0-50M=0

50M-100M=1

100M-1000M=0

[root@oracle_standby bin]#

 

 

         创建表:       

         drop table person;

         CREATE TABLE person(id INT AUTO_INCREMENT PRIMARY KEY,NAME VARCHAR(16),province VARCHAR(4), school INT, age INT, addr VARCHAR(32),zcode VARCHAR(6),birth DATETIME,score INT);

    录入测试数据:

         insert into person(id,name,province, school, age, addr, zcode, birth, score) values( 1401328239720402944,'zhang','bj', 99, 20,'heibei-baoding','072450','1989-02-01',90);

 

执行过程:

mysql> CREATE TABLE person(id INT AUTO_INCREMENT PRIMARY KEY,NAME VARCHAR(16),province VARCHAR(4), school INT, age INT, addr VARCHAR(32),zcode VARCHAR(6),birth DATETIME,score INT);

Query OK, 0 rows affected (0.02 sec)

 

mysql>

mysql>

mysql> insert into person(id,name,province, school, age, addr, zcode, birth, score) values( 1401328239724597248,'zhang','bj', 99, 20,'heibei-baoding','072450','1989-02-01',90);

Query OK, 1 row affected (0.01 sec)

 

mysql>   

 

 

 

 

 

 

 

6,准备testtools工具包进行压力测试

TestTools工具包,下载地址:https://github.com/MyCATApache/Mycat-download/tree/master/1.5-GA

,解压即可使用(需要JDK环境),下载Mycat-server-1.5-GA-20160225120029-testtool.tar.gz这个包,解压到对应的bin和lib目录。

 

其中bin目录如下:

[root@oracle_standby bin]# cd /usr/local/mycat/bin                                                                                                                                                                                                                 

[root@oracle_standby bin]# ll -t

总用量 428

-rwxr--r--. 1 root root    230 4月   2 23:14 mydata-create.sql

-rwxr-xr-x. 1 root root  15714 12月 21 11:01 mycat

-rwxr-xr-x. 1 root root 140198 12月 21 11:01 wrapper-linux-ppc-64

-rwxr-xr-x. 1 root root  99401 12月 21 11:01 wrapper-linux-x86-32

-rwxr-xr-x. 1 root root 111027 12月 21 11:01 wrapper-linux-x86-64

-rwxr-xr-x. 1 root root    593 12月 15 10:00 init_zk_data.sh

-rw-r--r--. 1 root root    602 12月 13 16:55 test_globalseq_insert_perf.bat

-rw-r--r--. 1 root root    611 12月 13 16:55 test_globaltable_insert_perf.bat

-rwxr--r--. 1 root root    602 12月 13 16:55 test_globaltable_insert_perf.sh

-rw-r--r--. 1 root root    600 12月 13 16:55 test_stand_insert_perf.bat

-rwxr--r--. 1 root root    591 12月 13 16:55 test_stand_insert_perf.sh

-rw-r--r--. 1 root root    611 12月 13 16:55 test_stand_merge_sel_perf.bat

-rwxr--r--. 1 root root    602 12月 13 16:55 test_stand_merge_sel_perf.sh

-rw-r--r--. 1 root root    613 12月 13 16:55 test_stand_select_perf.bat

-rwxr--r--. 1 root root    603 12月 13 16:55 test_stand_select_perf.sh

-rw-r--r--. 1 root root    612 12月 13 16:55 test_stand_update_perf.bat

-rwxr--r--. 1 root root    603 12月 13 16:55 test_stand_update_perf.sh

-rwxr-xr-x. 1 root root   2947 12月 13 16:55 rehash.sh

-rwxr-xr-x. 1 root root   2502 12月 13 16:55 startup_nowrap.sh

[root@oracle_standby bin]#

 

其中lib目录如下:

[root@oracle_standby lib]# cd /usr/local/mycat/lib                                                                                                                                                                                                                 

[root@oracle_standby lib]# ll -t

总用量 15136

-rw-r--r--. 1 root root 1555682 3月  27 21:12 ojdbc14.jar

-rw-r--r--. 1 root root  231817 2月  25 12:01 Mycat-server-1.5-GA-tests.jar

-rwxrwxrwx. 1 root root   71909 12月 21 11:01 curator-client-2.9.0.jar

-rwxrwxrwx. 1 root root  190334 12月 21 11:01 curator-framework-2.9.0.jar

-rwxrwxrwx. 1 root root  313898 12月 21 11:01 dom4j-1.6.1.jar

-rwxrwxrwx. 1 root root 1930456 12月 21 11:01 druid-1.0.14.jar

…………

 

7,开始压力测试3000W条记录

测试sql脚本准备:

[root@oracle_standby ~]# cd /usr/local/mycat/bin/

[root@oracle_standby bin]# more mydata-create.sql

total=20000000

sql=insert into person(id,name,province, school, age, addr, zcode, birth, score) values( 1401328239724597249,'li','BJ', 99, 20,'xinhua road','072450',${date(yyyyMMddHHmmss-[2014-201

6]y)},${int(50,100)});

 

[root@oracle_standby bin]#

 

 

执行命令:

./test_stand_insert_perf.sh jdbc:mysql://192.168.121.52:8066/TESTDB test test 10 file=mydata-create.sql                                                                                                                      

 

 

压力测试截图如下:

整体概览

06.png

 mycat 用Jconsole监控mycat压测的各种性能曲线_第5张图片

 

内存:

07.png

 mycat 用Jconsole监控mycat压测的各种性能曲线_第6张图片

 

线程:

08.png

 mycat 用Jconsole监控mycat压测的各种性能曲线_第7张图片

 

结论:

PS Eden Spac:

消耗比较高,基本在0.5G到1.5G之间,均值1.0G。                                                   

PS Survivor Space:

消耗比较低,基本在3M到8M之间,均值3.5M,峰值8M

PS Old Gen:

消耗比较低,刚开始5M,慢慢上升到20M,稳定下来一直是20M

Metaspace:

消耗比较低,稳定在20M到25M之间,均值在21.7M左右

Code Cache:

消耗比较低,缓慢上升,从10M到14M,有继续上升的迹象

Compressed Class Space:

消耗比较低,基本一条直线,稳定在2.33M左右

 

 

8,在9066端口查看压测时一些系统信息

在上面的压测过程中,可以在后台登录9066端口查看一些mycat系统信息,命令mysql -h127.0.0.1-P9066 -utest -ptest –DTESTDB,后台查看信息如下:

[root@oracle_standby lib]# mysql -h127.0.0.1 -P9066 -utest -ptest -DTESTDB

Welcome to the MySQL monitor.  Commands end with ; or \g.

Your MySQL connection id is 12

Server version: 5.5.8-mycat-1.5-alpha-20151221110028 MyCat Server (monitor)

 

Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved.

 

Oracle is a registered trademark of Oracle Corporation and/or its

affiliates. Other names may be trademarks of their respective

owners.

 

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

 

mysql> show @@processor;

+------------+-----------+-----------+-------------+---------+---------+-------------+--------------+------------+----------+----------+----------+

| NAME       | NET_IN    | NET_OUT   | REACT_COUNT | R_QUEUE | W_QUEUE | FREE_BUFFER | TOTAL_BUFFER | BU_PERCENT | BU_WARNS | FC_COUNT | BC_COUNT |

+------------+-----------+-----------+-------------+---------+---------+-------------+--------------+------------+----------+----------+----------+

| Processor0 | 150735370 | 151852828 |           0 |       0 |       0 |        1959 |         2000 |          2 |  1509389 |        5 |       18 |

| Processor1 | 147163168 | 112853279 |           0 |       0 |       0 |        1959 |         2000 |          2 |  1509389 |        6 |       19 |

+------------+-----------+-----------+-------------+---------+---------+-------------+--------------+------------+----------+----------+----------+

2 rows in set (0.00 sec)

 

mysql> show @@server;

+---------------+-------------+--------------+------------+---------------+---------------+---------+--------+-----------------------+

| UPTIME        | USED_MEMORY | TOTAL_MEMORY | MAX_MEMORY | RELOAD_TIME   | ROLLBACK_TIME | CHARSET | STATUS | AVG_BUFPOOL_ITEM_SIZE |

+---------------+-------------+--------------+------------+---------------+---------------+---------+--------+-----------------------+

| 19m 19s 835ms |   210187320 |   4291297280 | 4291297280 | 1459684108081 |            -1 | latin1  | ON     |                    86 |

+---------------+-------------+--------------+------------+---------------+---------------+---------+--------+-----------------------+

1 row in set (0.00 sec)

 

mysql> show @@datanode;  #看到下面的dn101有10个active线程,这10就是上面的压测启动的10个活动的线程。

+-------------+----------------------+-------+--------+--------+------+------+---------+------------+----------+---------+---------------+

| NAME        | DATHOST              | INDEX | TYPE   | ACTIVE | IDLE | SIZE | EXECUTE | TOTAL_TIME | MAX_TIME | MAX_SQL | RECOVERY_TIME |

+-------------+----------------------+-------+--------+--------+------+------+---------+------------+----------+---------+---------------+

| dn1         | dh1/db1              |     0 | mysql  |      0 |    2 | 1000 |     135 |          0 |        0 |       0 |            -1 |

| dn10        | dh1/db10             |     0 | mysql  |      0 |    1 | 1000 |       5 |          0 |        0 |       0 |            -1 |

| dn101       | dh1/db3              |     0 | mysql  |     10 |    2 | 1000 |   16093 |          0 |        0 |       0 |            -1 |

| dn102       | dh2/db3              |     0 | mysql  |      0 |    2 | 1000 |       3 |          0 |        0 |       0 |            -1 |

| dn2         | dh1/db2              |     0 | mysql  |      0 |    0 | 1000 |       3 |          0 |        0 |       0 |            -1 |

| dn3         | dh1/db3              |     0 | mysql  |     10 |    2 | 1000 |   16093 |          0 |        0 |       0 |            -1 |

| dn4         | dh1/db4              |     0 | mysql  |      0 |    0 | 1000 |       1 |          0 |        0 |       0 |            -1 |

| dn5         | dh2/db5              |     0 | mysql  |      0 |    5 | 1000 |     128 |          0 |        0 |       0 |            -1 |

| dn6         | dh2/db6              |     0 | mysql  |      0 |    4 | 1000 |       5 |          0 |        0 |       0 |            -1 |

| dn7         | dh1/db7              |     0 | mysql  |      0 |    0 | 1000 |       1 |          0 |        0 |       0 |            -1 |

| dn8         | dh1/db8              |     0 | mysql  |      0 |    1 | 1000 |       3 |          0 |        0 |       0 |            -1 |

| dn9         | dh1/db9              |     0 | mysql  |      0 |    0 | 1000 |       1 |          0 |        0 |       0 |            -1 |

| dn_oracle_1 | dh_oracle_1/powerdes |     0 | oracle |      0 |   10 | 1000 |      10 |          0 |        0 |       0 |            -1 |

| dn_uc       | dh1/powerdes         |     0 | mysql  |      0 |    0 | 1000 |       1 |          0 |        0 |       0 |            -1 |

+-------------+----------------------+-------+--------+--------+------+------+---------+------------+----------+---------+---------------+

14 rows in set (0.01 sec)

 

mysql>

 

 

9,cpu120%和load相差比较大,why?

参见05.png:

mycat 用Jconsole监控mycat压测的各种性能曲线_第8张图片

 

 

10,碰到的问题总结:

10.1问题:java.sql.BatchUpdateException: mycat sequnceerr.java.lang.RuntimeException: fetch Param Values error.

 

02 22:40:47 finished records :76100 failed:922300 speed:-1695.2004711783868                                                                                                                                                            

caught err in  thread :19 java.sql.BatchUpdateException: mycat sequnce err.java.lang.RuntimeException: fetch Param Values error.

caught err in  thread :18 java.sql.BatchUpdateException: mycat sequnce err.java.lang.RuntimeException: fetch Param Values error.

caught err in  thread :15 java.sql.BatchUpdateException: mycat sequnce err.java.lang.RuntimeException: fetch Param Values error.

caught err in  thread :14 java.sql.BatchUpdateException: mycat sequnce err.java.lang.RuntimeException: fetch Param Values error.

caught err in  thread :13 java.sql.BatchUpdateException: mycat sequnce err.java.lang.RuntimeException: fetch Param Values error.

caught err in  thread :19 java.sql.BatchUpdateException: mycat sequnce err.java.lang.RuntimeException: fetch Param Values error.

caught err in  thread :18 java.sql.BatchUpdateException: mycat sequnce err.java.lang.RuntimeException: fetch Param Values error.

caught err in  thread :14 java.sql.BatchUpdateException: mycat sequnce err.java.lang.RuntimeException: fetch Param Values error.

caught err in  thread :13 java.sql.BatchUpdateException: mycat sequnce err.java.lang.RuntimeException: fetch Param Values error.

caught err in  thread :18 java.sql.BatchUpdateException: mycat sequnce err.java.lang.RuntimeException: fetch Param Values error.

caught err in  thread :14 java.sql.BatchUpdateException: mycat sequnce err.java.lang.RuntimeException: fetch Param Values error.

caught err in  thread :13 java.sql.BatchUpdateException: mycat sequnce err.java.lang.RuntimeException: fetch Param Values error.

caught err in  thread :18 java.sql.BatchUpdateException: mycat sequnce err.java.lang.RuntimeException: fetch Param Values error.

caught err in  thread :13 java.sql.BatchUpdateException: mycat sequnce err.java.lang.RuntimeException: fetch Param Values error.

caught err in  thread :18 java.sql.BatchUpdateException: mycat sequnce err.java.lang.RuntimeException: fetch Param Values error.

caught err in  thread :13 java.sql.BatchUpdateException: mycat sequnce err.java.lang.RuntimeException: fetch Param Values error.

finishend:76100 failed:923900

used time total:500seconds

tps:-1695.2609478104378

 

 

查看后台日志记录,有如下记录:

INFO   | jvm 1    | 2016/04/02 23:18:37 | 四月 02, 2016 11:18:37 下午 sun.rmi.transport.tcp.TCPTransport$AcceptLoop executeAcceptLoop                                                       
INFO   | jvm 1    | 2016/04/02 23:18:37 | 警告: RMI TCP Accept-51984: accept loop for ServerSocket[addr=0.0.0.0/0.0.0.0,localport=51984] throws
INFO   | jvm 1    | 2016/04/02 23:18:37 | java.net.SocketException: 打开的文件过多
INFO   | jvm 1    | 2016/04/02 23:18:37 |  at java.net.PlainSocketImpl.socketAccept(Native Method)
INFO   | jvm 1    | 2016/04/02 23:18:37 |  at java.net.AbstractPlainSocketImpl.accept(AbstractPlainSocketImpl.java:409)
INFO   | jvm 1    | 2016/04/02 23:18:37 |  at java.net.ServerSocket.implAccept(ServerSocket.java:545)
INFO   | jvm 1    | 2016/04/02 23:18:37 |  at java.net.ServerSocket.accept(ServerSocket.java:513)
INFO   | jvm 1    | 2016/04/02 23:18:37 |  at sun.rmi.transport.tcp.TCPTransport$AcceptLoop.executeAcceptLoop(TCPTransport.java:400)
INFO   | jvm 1    | 2016/04/02 23:18:37 |  at sun.rmi.transport.tcp.TCPTransport$AcceptLoop.run(TCPTransport.java:372)
INFO   | jvm 1    | 2016/04/02 23:18:37 |  at java.lang.Thread.run(Thread.java:745)

 

 

java.net.SocketException: 打开的文件过多,直接临时修改文件句柄:1、ulimit -n204800,然后再重新执行操作,问题解决了。

 

 

10.2问题:can't find any valid datanode :PERSON -> ID ->10708904

 

caught err in  thread :14 java.sql.BatchUpdateException: can't find any valid datanode :PERSON -> ID -> 10708904                                                                                         

03 02:26:14 finished records :9288500 failed:709400 speed:1346.4996518038631

caught err in  thread :18 java.sql.BatchUpdateException: can't find any valid datanode :PERSON -> ID -> 10708991

caught err in  thread :14 java.sql.BatchUpdateException: can't find any valid datanode :PERSON -> ID -> 10709103

caught err in  thread :18 java.sql.BatchUpdateException: can't find any valid datanode :PERSON -> ID -> 10709192

caught err in  thread :14 java.sql.BatchUpdateException: can't find any valid datanode :PERSON -> ID -> 10709302

caught err in  thread :18 java.sql.BatchUpdateException: can't find any valid datanode :PERSON -> ID -> 10709393

caught err in  thread :14 java.sql.BatchUpdateException: can't find any valid datanode :PERSON -> ID -> 10709501

caught err in  thread :18 java.sql.BatchUpdateException: can't find any valid datanode :PERSON -> ID -> 10709594

caught err in  thread :14 java.sql.BatchUpdateException: can't find any valid datanode :PERSON -> ID -> 10709700

caught err in  thread :18 java.sql.BatchUpdateException: can't find any valid datanode :PERSON -> ID -> 10709795

caught err in  thread :14 java.sql.BatchUpdateException: can't find any valid datanode :PERSON -> ID -> 10709899

caught err in  thread :18 java.sql.BatchUpdateException: can't find any valid datanode :PERSON -> ID -> 10709996

caught err in  thread :14 java.sql.BatchUpdateException: can't find any valid datanode :PERSON -> ID -> 10710096

caught err in  thread :18 java.sql.BatchUpdateException: can't find any valid datanode :PERSON -> ID -> 10710148

caught err in  thread :18 java.sql.BatchUpdateException: can't find any valid datanode :PERSON -> ID -> 10710248

caught err in  thread :18 java.sql.BatchUpdateException: can't find any valid datanode :PERSON -> ID -> 10710348

caught err in  thread :18 java.sql.BatchUpdateException: can't find any valid datanode :PERSON -> ID -> 10710448

caught err in  thread :18 java.sql.BatchUpdateException: can't find any valid datanode :PERSON -> ID -> 10710548

caught err in  thread :18 java.sql.BatchUpdateException: can't find any valid datanode :PERSON -> ID -> 10710648

caught err in  thread :18 java.sql.BatchUpdateException: can't find any valid datanode :PERSON -> ID -> 10710748

03 02:26:15 finished records :9288500 failed:711300 speed:1345.9901898952187

caught err in  thread :18 java.sql.BatchUpdateException: can't find any valid datanode :PERSON -> ID -> 10710848

caught err in  thread :18 java.sql.BatchUpdateException: can't find any valid datanode :PERSON -> ID -> 10710948

finishend:9288500 failed:711500

used time total:6373seconds

tps:1345.8128697180334

 

10.3问题:MySQLNonTransientConnectionException: Communications linkfailure during commit()

03 18:22:08 finished records :5312400 failed:0 speed:970.3878628816595                                                                                                                                                                      

caught err in  thread :15 com.mysql.jdbc.exceptions.jdbc4.MySQLNonTransientConnectionException: Communications link failure during commit(). Transaction resolution unknown.

caught err in thread :15 rollback err com.mysql.jdbc.exceptions.jdbc4.MySQLNonTransientConnectionException: No operations allowed after connection closed.

caught err in  thread :19 com.mysql.jdbc.exceptions.jdbc4.MySQLNonTransientConnectionException: Communications link failure during commit(). Transaction resolution unknown.

caught err in thread :19 rollback err com.mysql.jdbc.exceptions.jdbc4.MySQLNonTransientConnectionException: No operations allowed after connection closed.

warn no connection in pool,create new one

warn no connection in pool,create new one

caught err in  thread :16 com.mysql.jdbc.exceptions.jdbc4.MySQLNonTransientConnectionException: Communications link failure during commit(). Transaction resolution unknown.

caught err in thread :16 rollback err com.mysql.jdbc.exceptions.jdbc4.MySQLNonTransientConnectionException: No operations allowed after connection closed.

warn no connection in pool,create new one

caught err in  thread :14 com.mysql.jdbc.exceptions.jdbc4.MySQLNonTransientConnectionException: Communications link failure during commit(). Transaction resolution unknown.

caught err in thread :14 rollback err com.mysql.jdbc.exceptions.jdbc4.MySQLNonTransientConnectionException: No operations allowed after connection closed.

warn no connection in pool,create new one

03 18:22:09 finished records :5312400 failed:400 speed:970.1375871334042

caught err in  thread :11 com.mysql.jdbc.exceptions.jdbc4.MySQLNonTransientConnectionException: Communications link failure during commit(). Transaction resolution unknown.

caught err in thread :11 rollback err com.mysql.jdbc.exceptions.jdbc4.MySQLNonTransientConnectionException: No operations allowed after connection closed.

warn no connection in pool,create new one

caught err in  thread :17 com.mysql.jdbc.exceptions.jdbc4.MySQLNonTransientConnectionException: Communications link failure during commit(). Transaction resolution unknown.

caught err in thread :17 rollback err com.mysql.jdbc.exceptions.jdbc4.MySQLNonTransientConnectionException: No operations allowed after connection closed.

warn no connection in pool,create new one

caught err in  thread :10 com.mysql.jdbc.exceptions.jdbc4.MySQLNonTransientConnectionException: Communications link failure during commit(). Transaction resolution unknown.

caught err in thread :10 rollback err com.mysql.jdbc.exceptions.jdbc4.MySQLNonTransientConnectionException: No operations allowed after connection closed.

warn no connection in pool,create new one

caught err in  thread :18 com.mysql.jdbc.exceptions.jdbc4.MySQLNonTransientConnectionException: Communications link failure during commit(). Transaction resolution unknown.

caught err in  thread :13 com.mysql.jdbc.exceptions.jdbc4.MySQLNonTransientConnectionException: Communications link failure during commit(). Transaction resolution unknown.

caught err in thread :13 rollback err com.mysql.jdbc.exceptions.jdbc4.MySQLNonTransientConnectionException: No operations allowed after connection closed.

warn no connection in pool,create new one

caught err in thread :18 rollback err com.mysql.jdbc.exceptions.jdbc4.MySQLNonTransientConnectionException: No operations allowed after connection closed.

warn no connection in pool,create new one

caught err in  thread :12 com.mysql.jdbc.exceptions.jdbc4.MySQLNonTransientConnectionException: Communications link failure during commit(). Transaction resolution unknown.

caught err in thread :12 rollback err com.mysql.jdbc.exceptions.jdbc4.MySQLNonTransientConnectionException: No operations allowed after connection closed.

warn no connection in pool,create new one

03 18:22:10 finished records :5312400 failed:1000 speed:969.8507060971097

 

INFO   | jvm 1    | 2016/04/03 19:42:28 |  warn: bad line int autopartition-long.txt :

INFO   | jvm 1    | 2016/04/03 19:42:29 | log4j 2016-04-03 19:42:29 [./conf/log4j.xml] load completed.

INFO   | jvm 1    | 2016/04/03 19:42:30 | MyCAT Server startup successfully. see logs in logs/mycat.log

 

^C

[root@oracle_standby bin]#

 

再次执行报错:

[root@oracle_standby bin]#

[root@oracle_standby bin]# ./test_stand_insert_perf.sh jdbc:mysql://192.168.121.52:8066/TESTDB test test 10 file=mydata-create.sql

check JAVA_HOME & java

---------set HOME_DIR------------

Java HotSpot(TM) 64-Bit Server VM warning: ignoring option MaxPermSize=64M; support was removed in 8.0

create jobs ...

total record 10000000 batch size:100 autocomit false

success ful created connections ,total :10

create jobs finished ,begin run test...

success create job count: 10 teset threads: 10

03 19:43:30 finished records :0 failed:0 speed:0.0

 

问题原因是:压测过程中binlog太多导致mysql数据库节点的磁盘满了,无法写入造成的,解决办法是清理多余的binlog,加大磁盘空间,然后再执行就不会报错了。

你可能感兴趣的:(mycat)