Mycat批量插入性能测试

本文采用mycat的values批量插入方式进行测试,连写的数据量达到8000左右事务提交可以达到每秒75000左右数据量,也证实了Mycat的效率是小于或等于Mysql的性能。在实际生产中,因为访问量和并发问题使得效率下降,这也是数据库底层IO无法避免的困境,所以实际生产中多采用主备-读写分离的方式进行分片处理,可以多设置几个Mycat的主备节点。本文采用的是一主一备,单个Mycat节点的读写分离之Mysql InnoDB的测试。

理想测试

何为理想测试,只是理想状态的下的测试数据,可能不是很准确。

Mycat数据分片

schema.xml

<table name="userinfo" primaryKey="id" type="global" dataNode="dn1,dn2" />

<table name="processtask" primaryKey="id" type="global" dataNode="dn1,dn2" />

dbBatch.sql

DROP TABLE IF EXISTS `userinfo`;
CREATE TABLE `userinfo` (
  `id` int(20) NOT NULL,
  `name` varchar(50) DEFAULT NULL,
  `phone` varchar(30) DEFAULT NULL,
  `address` varchar(100) DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;


DROP TABLE IF EXISTS `processtask`;
CREATE TABLE `processtask` (
  `id` int(12) NOT NULL AUTO_INCREMENT,
  `pmethod` varchar(50) DEFAULT NULL,
  `plimit` int(20) DEFAULT NULL,
  `ptime` int(20) DEFAULT NULL,
  `systime` timestamp NULL DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8;

Java测试类

BatchInsert

package demo.test;

import java.sql.DriverManager;
import java.sql.SQLException;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Random;

import org.junit.Before;
import org.junit.Test;

import com.mysql.jdbc.Connection;
import com.mysql.jdbc.PreparedStatement;
/**
 * 批量插入JDBC操作类
 * 
 * @author pengjunlin
 *
 */
public class BatchInsert {
	
	private String driver = "com.mysql.jdbc.Driver";

	private String url = "jdbc:mysql://192.168.178.128:8066/TESTDB";
	
	private String batch_url = "jdbc:mysql://192.168.178.128:8066/TESTDB?useUnicode=true&characterEncoding=utf-8&rewriteBatchedStatements=true";//要5.1.13以上版本的驱动包

	private String user = "root";

	private String password = "123456";
	
	private int limit=10;
	
	private String method="batchInsertWithTransaction";
	
	public String getMethod() {
		return method;
	}

	public void setMethod(String method) {
		this.method = method;
	}
	
	public int getLimit() {
		return limit;
	}

	public void setLimit(int limit) {
		this.limit = limit;
	}
	

	@Before
	public void deleteAll(){
		Connection conn = null;
		try {
			Class.forName(driver);
			conn = (Connection) DriverManager.getConnection(url, user, password);
			String sql = "DELETE FROM userinfo ;";
			conn.prepareStatement(sql).execute();
		
		} catch (Exception e) {
			e.printStackTrace();
			throw new RuntimeException(e);
		} finally {
			if (conn != null) {
				try {
					conn.close();
				} catch (SQLException e) {
					e.printStackTrace();
				}
			}
		}
	}
	
	/**
	 * 记录执行的时间
	 * 
	 * @MethodName: insertResult 
	 * @Description: 
	 * @param methodName
	 * @param limit
	 * @param timeStr
	 * @throws
	 */
	public void insertResult(String methodName,String limit,String timeStr) {
		Connection conn = null;
		PreparedStatement pstm = null;
		try {
			Class.forName(driver);
			conn = (Connection) DriverManager.getConnection(url, user, password);
			SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
			String sql = "/*#mycat:db_type=master*/INSERT INTO processtask (pmethod,plimit,ptime,systime) VALUES('"+methodName+"','"+limit+"','"+timeStr+"','"+sdf.format(new Date())+"')";
			System.out.println(sql);
			pstm = (PreparedStatement) conn.prepareStatement(sql);
			pstm.executeUpdate();
		} catch (Exception e) {
			e.printStackTrace();
		} finally {
			if (pstm != null) {
				try {
					pstm.close();
				} catch (SQLException e) {
					e.printStackTrace();
				}
			}
			if (conn != null) {
				try {
					conn.close();
				} catch (SQLException e) {
					e.printStackTrace();
				}
			}
		}
	}


	
	@Test
	public void batchInsertWithTransaction() {
		Connection conn = null;
		PreparedStatement pstm = null;
		try {
			Class.forName(driver);
			conn = (Connection) DriverManager.getConnection(batch_url, user, password);
			StringBuffer sql = new StringBuffer("/*#mycat:db_type=master*/INSERT INTO userinfo(id,name,phone,address) VALUES");
			conn.setAutoCommit(false);// 即手动提交
			Random rand = new Random();
			int a, b, c, d;
			int index=1;
			for (int i = 1; i <= limit; i++) {
				a = rand.nextInt(10);
				b = rand.nextInt(10);
				c = rand.nextInt(10);
				d = rand.nextInt(10);
				if(index==limit){
					sql.append("("+i+",'boonya',"+"'188" + a + "88" + b + c + "66" + d+"','"+"xxxxxxxxxx_" + "188" + a + "88" + b + c
							+ "66" + d+"');");
				}else{
					sql.append("("+i+",'boonya',"+"'188" + a + "88" + b + c + "66" + d+"','"+"xxxxxxxxxx_" + "188" + a + "88" + b + c
							+ "66" + d+"'),");
				}
				index++;
			}
			System.out.println(sql.toString()); 
			pstm = (PreparedStatement) conn.prepareStatement(sql.toString());
			Long startTime = System.currentTimeMillis();
			pstm.execute();
			conn.commit();// 手动提交
			Long endTime = System.currentTimeMillis();
			String timeStr=(endTime - startTime)+""; 
			System.out.println("OK,用时:" + timeStr);
			insertResult("batchInsertWithTransaction", limit+"", timeStr);
		} catch (Exception e) {
			e.printStackTrace();
		} finally {
			if (pstm != null) {
				try {
					pstm.close();
				} catch (SQLException e) {
					e.printStackTrace();
					throw new RuntimeException(e);
				}
			}
			if (conn != null) {
				try {
					conn.close();
				} catch (SQLException e) {
					e.printStackTrace();
					throw new RuntimeException(e);
				}
			}
		}
	}

}

BatchInsertThread

package demo.test;

import java.util.concurrent.Executor;
import java.util.concurrent.Executors;
/**
 * 批量插入线程类
 * 
 * @author pengjunlin
 *
 */
public class BatchInsertThread implements Runnable{
	
	BatchInsert batchInsert;
	
	static int loop=10;
	
	
	
	public BatchInsertThread(BatchInsert batchInsert){
		this.batchInsert=batchInsert;

	}

	
	public static void main(String[] args) {
		Executor executor=Executors.newSingleThreadExecutor();
		
		int limit=15630;
		
		for (int i = 0; i <= 50000; i++) {
			limit+=10;
			BatchInsert bi=new BatchInsert();
			bi.setLimit(limit);
			executor.execute(new BatchInsertThread(bi));
		}
		
	}

	public void run() { 
		synchronized (batchInsert) {
			try {
				for (int i = 0; i < loop; i++) {
					System.out.println("第--"+i+"---次---------------------开始");
					batchInsert.deleteAll();
					batchInsert.batchInsertWithTransaction();
					System.out.println("第--"+i+"---次---------------------结束");
				}
			} catch (Exception e) {
				e.printStackTrace();
			}finally{
			}
		}
	}
	

}

BatchInsertDataParsor

package demo.test;

import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.SQLException;
import org.junit.Test;
import com.mysql.jdbc.Connection;
import com.mysql.jdbc.ResultSetMetaData;
/**
 * 测试数据分析类
 * 
 * @author pengjunlin
 *
 */
public class BatchInsertDataParsor {
	
	private String driver = "com.mysql.jdbc.Driver";

	private String url = "jdbc:mysql://192.168.178.128:8066/TESTDB?useUnicode=true&characterEncoding=utf-8&rewriteBatchedStatements=true";//要5.1.13以上版本的驱动包

	private String user = "root";

	private String password = "123456";
	
	
	@Test
	public void queryData(){
		Connection conn = null;
		ResultSet rs=null;
		try {
			Class.forName(driver);
			conn = (Connection) DriverManager.getConnection(url, user, password);
			String sql = "/*#mycat:db_type=slave*/SELECT id,pmethod,plimit,ptime,systime FROM processtask ;";
			long startTime=System.currentTimeMillis();
			rs=conn.prepareStatement(sql).executeQuery(sql);
			if(rs==null){
				throw new RuntimeException("ResultSet is null。。。。");
			}
			long endTime=System.currentTimeMillis();
			long cost=endTime-startTime;
			System.out.println("Totoal rows:"+rs.getRow()+" cost:"+cost+"ms");
		} catch (Exception e) {
			e.printStackTrace();
			throw new RuntimeException(e);
		} finally {
			if (conn != null) {
				try {
					conn.close();
				} catch (SQLException e) {
					e.printStackTrace();
				}
			}
			try {
				if(rs!=null&&!rs.isClosed()){
					rs.close();
				}
			} catch (SQLException e) {
				e.printStackTrace();
			}
		}
	}
	

	
	@Test
	public void parseTimeTest(){
		Connection conn = null;
		ResultSet rs=null;
		try {
			Class.forName(driver);
			conn = (Connection) DriverManager.getConnection(url, user, password);
			String sql = "/*#mycat:db_type=slave*/SELECT avg(ptime) avg,max(ptime) max,min(ptime) min FROM processtask;";
			rs=conn.prepareStatement(sql).executeQuery(sql);
			if(rs==null){
				throw new RuntimeException("ResultSet is null。。。。");
			}
			ResultSetMetaData md = (ResultSetMetaData) rs.getMetaData();//获取键名
			int columnCount = md.getColumnCount();//获取行的数量
			while (rs.next()) {
			   for (int i = 1; i <= columnCount; i++) {
			     System.out.println(md.getColumnName(i)+": "+rs.getString(i));//获取键名及值
			   }
			}
		} catch (Exception e) {
			e.printStackTrace();
			throw new RuntimeException(e);
		} finally {
			if (conn != null) {
				try {
					conn.close();
				} catch (SQLException e) {
					e.printStackTrace();
				}
			}
			try {
				if(rs!=null&&!rs.isClosed()){
					rs.close();
				}
			} catch (SQLException e) {
				e.printStackTrace();
			}
		}
	}
	

	@Test
	public void parseLimitAndTimeTest(){
		Connection conn = null;
		ResultSet rs=null;
		try {
			Class.forName(driver);
			conn = (Connection) DriverManager.getConnection(url, user, password);
			String sql = "/*#mycat:db_type=slave*/SELECT plimit,avg(ptime) avg FROM processtask group by plimit;";
			rs=conn.prepareStatement(sql).executeQuery(sql);
			if(rs==null){
				throw new RuntimeException("ResultSet is null。。。。");
			}
			ResultSetMetaData md = (ResultSetMetaData) rs.getMetaData();//获取键名
			int columnCount = md.getColumnCount();//获取字段的数量
			while (rs.next()) {
			   float limit=0,avg=0;
			   for (int i = 1; i <= columnCount; i++) {
				 float result=rs.getFloat(i);
			     //System.out.println(md.getColumnName(i)+": "+result+"");//获取键名及值
			     if(i==1){
			    	 limit=result;
			     }else{
			    	 avg=result;
			     }
			   }
			   System.out.println("limit="+limit+"\t\t估算1s大概的批量插入量:"+(1000*limit)/avg); 
			}
		} catch (Exception e) {
			e.printStackTrace();
			throw new RuntimeException(e);
		} finally {
			if (conn != null) {
				try {
					conn.close();
				} catch (SQLException e) {
					e.printStackTrace();
				}
			}
			try {
				if(rs!=null&&!rs.isClosed()){
					rs.close();
				}
			} catch (SQLException e) {
				e.printStackTrace();
			}
		}
	}

}

测试数据


样本(limit)-每组10个实例样本批量插入平均耗时(avg)ms估算一秒内批量插入可插入的数量
SELECT plimit as '样本(limit)-每组10个实例样本',avg(ptime) as  '批量插入平均耗时(avg)ms' ,(1000*plimit/avg(ptime)) as '估算一秒内批量插入可插入的数量' FROM processtask group by plimit;
1011.6862.069
768097.878527.6074
7790100.677435.3877
973012677222.2222
8050105.676231.0606
1042013776058.3942
728095.875991.6493
9740128.775679.8757
7700101.875638.5069
9520125.975615.5679
10430139.174982.0273
9410126.174623.3148
8180109.774567.0009
575077.574193.5484
659089.473713.6465
10600143.873713.491
9130123.973688.4584
579078.873477.1574
8620117.573361.7021
664090.773208.3793
672091.873202.6144
9810134.173154.3624
7820106.973152.479
616084.572899.4083
8850121.972600.4922
9140125.972597.2994
711098.272403.2587
9470130.872400.6116
996013872173.913
9440130.972116.1192
1262017572114.2857
1563021772027.6498
623086.572023.1214
10630147.672018.9702
8980124.871955.1282
10360144.171894.5177
10050139.971837.0264
1056014771836.7347
696096.971826.6254
649090.471792.0354
954013371729.3233
666093.171535.9828
8110113.471516.7549
8400117.571489.3617
9710135.971449.5953
1250017571428.5714
473066.371342.3831
683095.871294.3633
8060113.471075.8377
7450104.971020.0191
7440104.870992.3664
7520106.170876.5316
467065.970864.9469
7570106.970813.8447
7650108.170767.8076
10260145.270661.157
12200172.770642.7331
7490106.170593.7795
1058015070533.3333
692098.270468.4318
8680123.370397.4047
7360104.670363.2887
594084.670212.766
9290132.570113.2075
9970142.270112.5176
7760110.770099.3677
11180159.570094.0439
953013670073.5294
9770139.669985.6734
436062.369983.9486
7380105.669886.3636
675096.669875.7764
9160131.369763.8995
498071.469747.8992
10120145.169745.0034
14870213.369714.0178
8370120.169691.9234
625089.869599.1091
66809669583.3333
9500136.669546.1201
45206569538.4615
10080145.269421.4876
9050130.469401.8405
55508069375
10270148.269298.2456
13320192.569194.8052
10220147.969100.7437
1050015269078.9474
7420107.569023.2558
7530109.169019.2484
15000217.468997.2401
9080131.668996.9605
15420223.568993.2886
10140147.268885.8696
10700155.468854.5689
9240134.268852.459
11900173.268706.6975
8140118.568691.9831
7090103.368635.0436
14620213.168606.2881
7260105.968555.2408
15610227.768555.1164
12520182.768527.6409
10110147.668495.935
10010146.268467.8523
601087.868451.0251
1054015468441.5584
12300179.868409.3437
493072.168377.2538
10410152.368351.937
10900159.768252.9743
455066.768215.8921
10720157.568063.4921
55808268048.7805
7750113.968042.1422
6840100.667992.0477
12330181.467971.3341
693010267941.1765
7500110.567873.3032
657096.867871.9008
8760129.267801.8576
8630127.367792.6159
6900101.867779.9607
7400109.267765.5678
724010767663.5514
13370197.667661.9433
11690172.867650.463
15460228.867569.9301
13120194.267559.2173
597088.467533.9367
12680187.967482.7036
7980118.367455.6213
9720144.167453.1575
439065.167434.7158
9620142.867366.9468
578085.867365.9674
9760144.967356.7978
577085.767327.888
7780115.667301.0381
8820131.167276.8879
975014567241.3793
14920222.167176.9473
7340109.467093.2358
9490141.567067.1378
8950133.567041.1985
494073.767028.4939
14810221.366922.7293
7540112.766903.2831
8900133.166867.0173
9640144.266851.595
362054.266789.6679
613091.866775.5991
655098.166768.6035
437065.566717.5573
11280169.266666.6667
7690115.466637.7816
407061.166612.1113
7740116.266609.2943
13260199.166599.6986
7020105.566540.2844
497074.866443.8503
10590159.466436.6374
10170153.266383.812
9910149.366376.4233
430064.866358.0247
1327020066350
11680176.166325.9512
11410172.266260.1626
10520158.866246.8514
12660191.366178.7768
11600175.466134.5496
9670146.366097.0608
9860149.266085.7909
6910104.666061.1855
9800148.466037.7358
917013965971.223
451068.465935.6725
14430218.965920.5116
9660146.665893.588
458069.665804.5977
10200155.165764.0232
10100153.665755.2083
8410127.965754.4957
13300202.365743.9446
619094.265711.2527
1228018765668.4492
8430128.765501.1655
12320188.365427.5093
35305465370.3704
8030122.965337.6729
8480129.865331.2789
921014165319.1489
395060.565289.2562
15100231.365283.182
576088.365232.1631
9510145.865226.3374
6940106.465225.5639
8290127.265172.956
7310112.265151.5152
628096.465145.2282
13680210.165111.8515
12180187.464994.6638
12490192.264984.3913
12060185.764943.4572
12100186.564879.3566
567087.464874.1419
387059.764824.1206
15290235.964815.5998
15560240.364752.3928
14860229.564749.4553
8200126.764719.8106
1488023064695.6522
11370175.864675.7679
14280220.964644.6356
382059.164636.2098
6740104.364621.2848
11460177.464599.7745
15210235.564585.9873
12370191.764527.9082
553085.764527.4212
8230127.664498.4326
11330175.764484.9175
14010217.564413.7931
392060.964367.8161
10960170.364357.017
12050187.364335.291
56608864318.1818
10470162.864312.0393
14070218.864305.3016
448069.764275.4663
61709664270.8333
1478023064260.8696
9230143.764231.0369
6730104.864217.5573
14680228.664216.9729
12240190.764184.5831
9920154.664165.5886
7230112.764152.6176
15050234.864097.1039
614095.864091.858
10180158.964065.45
8220128.563968.8716
15440241.463960.232
14690229.863925.1523
1048016463902.439
12550196.463900.2037
12410194.363870.3037
475074.463844.086
1098017263837.2093
7580118.863804.7138
13430210.563800.4751
13480211.363795.5513
56108863750
13360209.663740.458
9790153.663736.9792
8700136.563736.2637
11960187.763718.7001
12160191.163631.6065
14520228.263628.3961
6770106.463627.8195
11260177.163579.8984
11010173.363531.4484
13570213.663529.9625
13110206.563486.6828
14550229.463426.3296
61509763402.0619
10390163.963392.3124
7720121.963330.5989
559088.363306.9083
6880108.763293.4683
10760170.163256.9077
11800186.663236.8703
942014963221.4765
13940220.563219.9546
10650168.563204.7478
14830234.963133.2482
7860124.563132.5301
13950221.363036.6019
9310147.862990.5277
434068.962989.8403
8010127.262971.6981
11380180.862942.4779
13730218.362895.0985
12360196.862804.878
1016016262716.0494
11430182.362698.8481
10090161.162631.9056
14730235.262627.551
378060.462582.7815
11070176.962577.7275
8670138.662554.1126
14960239.362515.6707
1031016562484.8485
14890238.462458.0537
14560233.662328.7671
13530217.162321.5108
15550249.662299.6795
602096.862190.0826
13880223.362158.5311
13030209.862106.7684
15250245.662092.8339
1260020362068.9655
478077.161997.406
9030145.761976.6644
1295020961961.7225
11980193.461944.1572
485078.361941.2516
12770206.361900.1454
6620107.161811.3912
9840159.261809.0452
12790207.161757.605
11390184.661700.9751
359058.261683.8488
7270117.961662.4258
9900160.661643.8356
10070163.661552.5672
1045017061470.5882
513083.561437.1257
428069.761406.0258
12630205.861370.2624
54608961348.3146
14450235.661332.7674
13140214.361315.9123
11140181.761309.8514
9000146.961266.1675
13550221.361229.1008
15150247.561212.1212
12890210.661206.0779
11570189.161184.5584
11630190.161178.3272
37906261129.0323
13580222.261116.1116
15010245.861065.9072
6890112.961027.4579
15260250.161015.5938
8450138.561010.8303
8150133.661002.994
14120231.660967.1848
56009260869.5652
43207160845.0704
12020197.760799.1907
11530189.760780.1792
11610191.160753.5322
14050231.460717.3725
7880129.860708.7827
10750177.160700.1694
14610240.760697.9643
7150117.860696.0951
593097.760696.0082
12040198.660624.3706
10400171.760570.763
14260235.560552.017
11920196.960538.3443
12260202.660513.3268
519085.860489.5105
12170201.660367.0635
8960148.560336.7003
1285021360328.6385
12700210.660303.8936
12080200.560249.3766
10570175.560227.9202
15130251.360206.924
15490257.460178.7102
11030183.360174.5772
6240103.760173.5776
8690144.660096.8188
12750212.260084.8256
468077.960077.0218
14300238.260033.5852
7630127.160031.4713
389064.860030.8642
12940215.660018.5529
15040250.660015.9617
46207760000
15570259.560000
11500191.759989.567
13510225.359964.4918
14190236.759949.3029
8170136.459897.3607
445074.359892.3284
12780213.459887.5351
15120252.559881.1881
982016459878.0488
10380173.459861.5917
9190153.659830.7292
11540192.959823.7429
366061.259803.9216
12090202.259792.2849
15450258.759721.6853
15580260.959716.3664
11580194.159659.9691
12860215.759619.8424
9980167.559582.0896
13780231.459550.5618
474079.659547.7387
10000168.159488.3998
12480210.259372.0266
8540143.959346.7686
9700163.559327.2171
13070220.459301.2704
6090102.759298.9289
10880183.659259.2593
11290190.659233.9979
15270257.859231.9628
12440210.159209.9
13890235.159081.242
7320123.959079.9031
8710147.559050.8475
968016459024.3902
11620196.959014.7283
11550195.858988.764
12350209.458978.0325
12450211.158976.7883
10250173.858975.8343
13310225.758972.0868
14390244.158951.2495
11560196.158949.5156
13090222.358884.3905
484082.258880.7786
13800234.558848.6141
10460177.958797.077
1264021558790.6977
1310022358744.3946
12510213.158704.8334
12220208.258693.5639
564096.158688.8658
12670215.958684.5762
6290107.258675.3731
9340159.358631.5129
13600232.158595.433
446076.258530.1837
416071.158509.1421
530090.658498.8962
813013958489.2086
10040171.758474.0827
9430161.358462.4923
14650250.658459.6967
14600249.858446.7574
12740218.158413.5718
12130207.758401.5407
6450110.558371.0407
11090190.158337.717
488083.758303.4648
1148019758274.1117
12290210.958274.0635
7610130.658269.5253
8380143.958234.8853
12540215.558190.2552
11880204.258178.2566
453077.958151.4763
13380230.158148.631
1459025158127.49
11220193.158104.609
15620268.958088.5087
10850186.958052.4345
13810237.958049.6007
11520198.558035.2645
376064.858024.6914
6600113.857996.4851
40006957971.0145
369063.757927.7865
14080243.257894.7368
12470215.557865.4292
11470198.357841.6541
14130244.357838.7229
11200193.857791.5377
417072.357676.3485
14480251.157666.2684
14740255.757645.6785
7920137.457641.9214
15140263.157544.6598
7410128.857531.0559
367063.857523.511
476082.857487.9227
8260143.857440.8901
11240195.757434.8493
13400233.457412.168
11780205.257407.4074
1435025057400
10130176.557393.7677
6210108.257393.7153
431075.257313.8298
9870172.457250.58
5810101.557241.3793
13340233.157228.6572
1379024157219.917
9550166.957219.8922
565098.857186.2348
13450235.257185.3741
12730222.757162.1015
6510113.957155.3995
14150247.657148.6268
1554027257132.3529
15520271.757121.8255
10790188.957120.1694
9590167.957117.3317
6340111.157065.7066
510089.457046.9799
1077018956984.127
7990140.356949.3942
11230197.256947.2617
13060229.556906.3181
1341023656822.0339
12560221.156806.8747
512090.256762.7494
554097.656762.2951
15600274.956747.9083
12710224.156715.7519
15500273.356714.2334
1349023856680.6723
13010229.656663.7631
10030177.156634.6697
14950264.156607.3457
425075.156591.2117
10020177.156578.2044
13870245.356543.0086
718012756535.4331
13500238.856532.6633
9120161.456505.5762
6560116.156503.0146
1214021556465.1163
14760261.656422.0183
1193021256273.5849
8930158.756269.6912
11860210.856261.8596
11060196.856199.187
12930230.156192.9596
14250253.856146.5721
1033018456141.3043
500089.156116.7228
13230235.856106.8702
9580170.856088.993
410073.156087.5513
12270218.856078.6106
5920105.656060.6061
13930248.756011.2585
14460258.256003.0984
8520152.255978.975
15510277.155972.5731
8810157.455972.0457
8590153.555960.9121
8340149.155935.6137
13720245.355931.5124
15190271.655927.8351
13190235.955913.5227
1135020355911.33
495088.655869.0745
14000250.755843.6378
13170235.955828.741
11970214.755752.2124
11050198.355723.651
8000143.655710.3064
13240237.755700.4628
349062.755661.882
15200273.155657.2684
14180254.855651.4914
13920250.355613.2641
13690246.455560.0649
7370132.755538.8093
12980233.855517.5364
13860249.855484.3875
8910160.955376.0099
15160273.955348.6674
1450026255343.5115
9060163.855311.3553
8460153.155258.0013
15240275.955237.4049
1491027055222.2222
15110273.755206.4304
14750267.755098.9914
433078.655089.0585
11110201.755081.8047
9380170.654982.415
1484027054962.963
8360152.354891.6612
14270260.354821.36
14040256.354779.5552
10510192.254682.6223
14440264.254655.564
9460173.254618.9376
8280151.754581.4107
884016254567.9012
7480137.154558.7163
10740196.954545.4545
1194021954520.5479
714013154503.8168
459084.354448.3986
9260170.154438.5655
375068.954426.7054
9690178.254377.1044
11450210.754342.6673
989018254340.6593
12910237.754312.1582
11300208.154300.8169
9100167.654295.9427
13000239.554279.7495
10290189.654272.1519
406074.954205.6075
5700105.254182.5095
15230281.154180.0071
6700123.754163.2983
639011854152.5424
14370265.454144.6873
12810236.654142.0118
9220170.354139.7534
7620140.854119.3182
8500157.154105.6652
1438026654060.1504
1346024954056.2249
374069.254046.2428
8890164.554042.5532
53509954040.404
7060130.754016.8324
956017754011.2994
13040241.553995.8592
13290246.253980.5037
10240189.753979.9684
5480101.653937.0079
272050.553861.3861
13420249.453809.1419
8650160.853793.5323
9940184.853787.8788
7050131.153775.7437
463086.153774.6806
14720273.853761.87
12690236.153748.4117
531098.853744.9393
5490102.253718.1996
5830108.653683.2413
10830202.153587.333
8610160.753578.0958
11100207.553493.9759
6980130.553486.59
12000224.553452.1158
11950223.753419.7586
12400232.253402.2394
11130208.553381.295
6430120.553360.9959
13830259.753253.7543
15030282.453222.3796
5390101.453155.8185
13960262.853120.2435
13620256.753058.0444
14410271.952997.4255
11440215.952987.4942
507095.752978.0564
5820109.952957.2338
14640276.652928.4165
6530123.452917.342
429081.152897.6572
46008752873.5632
7850148.552861.9529
10490198.652819.7382
13540256.552787.5244
5340101.252766.7984
13180249.952741.0964
9830186.452736.0515
383072.752682.2558
13250251.752642.0342
12920245.552627.2912
413078.652544.5293
14100268.752474.879
14660279.652432.0458
14170270.452403.8462
11890226.952401.9392
13610259.852386.4511
14670280.252355.4604
7660146.452322.4044
12900246.752290.231
11120212.852255.6391
8920170.752255.4189
14770282.852227.7228
9270177.552225.3521
1081020752222.2222
9320178.652183.6506
14700281.752183.1736
491094.152178.5335
14630280.552156.8627
419080.452114.4279
11740225.352108.3
7300140.751883.4399
14220274.351841.0499
5720110.451811.5942
13280256.551773.8791
15060291.451681.5374
386074.751673.3601
13210255.751662.104
14930289.451589.4955
11870230.151586.2668
15590302.651520.1586
12430241.351512.6399
14360278.851506.4562
14060273.151482.9733
13820268.751432.8247
5440105.851417.7694
6380124.251368.7601
9570186.351368.7601
1402027351355.3114
7940154.751325.1454
5710111.351302.7853
14570284.251266.7136
9880193.251138.7164
456089.251121.0762
14940292.351111.8714
10870212.851080.8271
15380301.351045.4696
13520264.951038.1276
7390144.851035.9116
6100119.651003.3445
466091.450984.6827
10680209.650954.1985
1416027850935.2518
14140277.750918.2571
1532030150897.01
461090.650883.0022
14980294.950796.8803
15090297.150790.9795
8100159.550783.6991
13740270.650776.0532
10840213.550772.8337
7900155.750738.5999
6610130.450690.184
14540286.950679.6793
11650230.150630.1608
14510286.750610.3941
15020296.850606.469
11210221.650586.6426
6040119.450586.2647
7040139.250574.7126
12030238.250503.7783
13330264.250454.2014
14790293.250443.3834
14320284.350369.3282
15310304.250328.7311
254050.550297.0297
10660212.250235.6268
8240164.450121.6545
9650192.650103.8422
12110241.750103.434
6780135.450073.8552
14580291.350051.4933
6710134.250000
10610212.549929.4118
12610252.949861.6054
7190144.249861.3037
7000140.449857.5499
15430309.549854.6042
10060201.949826.6469
14330287.749808.8286
8080162.349784.35
10710215.249767.658
13020262.349637.8193
340068.549635.0365
14820298.649631.6142
12880259.749595.6873
6630133.749588.6313
8090163.349540.7226
911018449510.8696
7010141.649505.6497
648013149465.6489
223045.149445.6763
10280208.349351.8963
12970262.949334.3477
7550153.149314.1737
13710278.449245.6897
14210288.849203.6011
14030285.249193.5484
348070.849152.5424
15300311.449132.948
356072.549103.4483
7250147.749085.9851
14290291.249072.8022
226046.149023.8612
10210208.349015.8425
268054.748994.5155
384078.548917.1975
480098.248879.8371
233047.748846.9602
11360232.748818.2209
14470296.548802.6981
1547031748801.2618
12760261.548795.4111
13640279.648783.9771
9010184.848755.4113
10550216.548729.7921
10530216.248704.9029
182037.448663.1016
7870161.848640.2967
10890223.948637.7847
15170312.348575.0881
8320171.348569.7607
1272026248549.6183
454093.648504.2735
7930163.548501.5291
11160230.248479.583
9850203.348450.5657
358073.948443.843
5900121.848440.0657
12340254.948411.1416
441091.148408.3425
14800305.848397.6455
13200273.548263.2541
14340297.648185.4839
14530301.648176.3926
368076.448167.5393
6330131.548136.8821
14850308.648120.5444
260054.148059.1497
438091.248026.3158
15530323.947946.8972
11420238.347922.7864
7210150.547906.9767
1365028547894.7368
9930207.447878.4957
13980292.647778.5373
13390280.447753.2097
7810163.847680.0977
1363028647657.3427
6970146.547576.7918
7590159.647556.391
14200298.647555.2579
11770247.647536.3489
9610202.347503.7074
5030105.947497.6393
12990273.947426.0679
904019147329.8429
12580265.947311.0192
12230258.647293.1168
165034.947277.937
7960168.447268.4086
1095023247198.2759
409086.747174.1638
12190258.747120.2165
11910253.546982.2485
11660248.246978.2434
13080279.546797.8533
9090194.346783.3248
8440180.546759.0028
13910297.546756.3025
15370328.946731.5293
13050279.346723.9527
784016846666.6667
527011346637.1681
8350179.346569.9944
6000128.946547.7114
4990107.346505.1258
12800275.446477.8504
263056.646466.4311
8790189.346434.2314
11720252.646397.4663
225048.546391.7526
8740188.446390.6582
11670251.846346.3066
10920235.746330.0806
14970323.446289.4249
11640251.546282.3062
15480334.846236.5591
5240113.446208.1129
11190242.346182.4185
14400312.246124.2793
8390181.946124.2441
12070261.746121.5132
266057.746100.5199
5690123.546072.8745
10990238.746041.0557
385083.745997.6105
12120263.645978.7557
14310311.345968.5191
13350290.545955.2496
119025.945945.9459
8600187.345915.6434
7460162.645879.4588
294064.145865.8346
10370226.145864.6617
194042.345862.8842
1315028745818.8153
15350335.345779.8986
10350226.145776.2052
360078.745743.3291
15180331.945736.6677
6410140.345687.8118
237051.945664.7399
14230311.945623.5973
11400250.145581.7673
12380271.645581.7378
405088.945556.8054
8730191.745539.9061
10730235.745523.9711
8250181.345504.6884
6810149.845460.6142
15360337.945457.2359
12590277.145434.8611
164036.145429.3629
8420185.445415.3182
8510187.445410.8858
5570122.745395.273
4650102.545365.8537
9400207.345344.9108
12530276.445332.8509
1019022545288.8889
245054.145286.5065
37108245243.9024
550012245081.9672
8940198.545037.7834
13470299.245020.0535
8530189.545013.1926
344076.544967.3203
930020744927.5362
6800151.544884.4884
7830174.644845.3608
11710261.244831.5467
11700261.544741.8738
11040246.844732.577
8020179.444704.5708
13670305.844702.4199
710015944654.0881
346077.544645.1613
373083.844510.7399
5010112.644493.7833
5410121.644490.1316
10940245.944489.6299
12650284.644448.3486
12870289.744425.2675
5520124.344408.6887
15280345.344251.3756
4490101.544236.4532
5840132.144208.9326
831018844202.1277
11310256.144162.4365
195044.244117.6471
341077.444056.8475
8870201.444041.708
6300143.243994.4134
265060.343946.932
5320121.143930.6358
4690106.843913.8577
6860156.443861.8926
9250210.943859.6491
4440101.343830.2073
5180118.243824.0271
8830201.643799.6032
14990342.343791.9953
8780200.843725.0996
5080116.243717.7281
20104643695.6522
247056.643639.576
5620128.843633.5404
5380123.343633.4144
7170164.543586.6261
6580151.343489.7555
687015843481.0127
12460286.743460.0628
11590266.843440.7796
122028.143416.3701
11810272.143403.1606
4470103.243313.9535
10800249.443303.9294
6790156.943275.972
25105843275.8621
5420125.343256.1852
13130303.743233.4541
5330123.343227.8994
5260121.743221.0353
241055.843189.9642
5230121.243151.8152
381088.343148.3579
9070210.643067.4264
4720109.743026.4357
6690155.742967.2447
12210284.442932.4895
10690249.342880.0642
10970256.142834.8301
420098.142813.4557
8660202.642744.3238
11490268.942729.6393
816019142722.5131
13990327.642704.5177
361084.642671.3948
13850325.242589.1759
6050142.242545.7103
13750323.242543.3168
8210193.142516.8307
11340267.242440.1198
286067.442433.2344
9780230.642411.1015
13560319.842401.5009
12310290.642360.6332
370087.442334.0961
1082025642265.625
183043.342263.2794
11270266.942225.5526
414098.242158.8595
14900353.842114.1888
10780256.142092.9324
9280220.842028.9855
13970332.542015.0376
15220362.641974.6277
11990286.341879.1477
281067.141877.7943
4920117.641836.7347
10300246.541784.9899
10860260.141753.1719
15080361.341738.1677
14420345.641724.537
10230245.541670.0611
7950190.941644.8402
307073.841598.916
7290175.441562.1437
4820116.141515.9345
198047.741509.434
11750283.241490.113
11760283.841437.6321
7890190.541417.3228
7350177.541408.4507
9180221.941369.9865
11840286.341355.2218
521012641349.2063
14710355.841343.4514
258062.741148.3254
9020219.441112.124
10910265.741061.3474
5630137.241034.9854
8860216.340961.6274
95023.240948.2759
197048.240871.3693
351085.940861.4668
393096.240852.3909
243059.540840.3361
10150248.740812.2236
13760338.440661.9385
394096.940660.4747
622015340653.5948
626015440649.3506
106026.140613.0268
9370231.240527.6817
6670164.640522.4787
13160324.940504.7707
8560211.440491.9584
204050.440476.1905
6180152.740471.5128
9302340434.7826
399098.840384.6154
1201029840302.0134
5450135.540221.4022
12250305.240137.6147
4810119.940116.764
13700341.940070.196
131032.740061.1621
292073.339836.2892
12570316.339740.7525
13900349.939725.6359
4030101.639665.3543
391098.639655.1724
11102839642.8571
352088.839639.6396
5280133.239639.6396
5360135.439586.4106
17804539555.5556
5860148.339514.4976
1409035739467.7871
277070.239458.6895
4240107.639405.2045
239060.839309.2105
12960331.839059.6745
11820303.238984.1689
23005938983.0508
12390318.938852.3048
188048.438842.9752
7730199.138824.7112
191049.238821.1382
180046.438793.1034
9600247.538787.8788
319082.338760.6318
298076.938751.6255
10640274.638747.2688
222057.338743.4555
252065.138709.6774
9990258.138705.9279
12420321.138679.5391
297076.838671.875
262067.838643.0678
14490375.138629.6987
167043.338568.1293
11150289.238554.6335
4430115.238454.8611
15070392.138434.0729
176045.838427.9476
116030.238410.596
287074.838368.984
11000287.238300.8357
10670278.638298.636
10340270.138282.1177
5370140.538220.6406
8300217.438178.4729
301078.938149.5564
6350166.538138.1381
13840363.438084.7551
5880154.738009.0498
11510303.137974.2659
1032027237941.1765
14110372.837848.7124
343090.837775.3304
13590360.137739.5168
4020106.637711.0694
135035.937604.4568
253067.437537.092
8970239.737421.7772
144038.537402.5974
120032.137383.1776
7330196.237359.8369
8570229.637325.784
11020295.437305.3487
347093.137271.7508
4150111.737153.0886
6400172.337144.5154
186050.137125.7485
7130192.237096.7742
12840346.237088.3882
6420173.237066.9746
7430200.936983.5739
136036.836956.5217
123033.336936.9369
130035.236931.8182
6320171.336894.3374
323087.636872.1461
310084.136860.8799
169045.936819.1721
185050.436706.3492
7120194.336644.3644
11170305.236598.9515
849023236594.8276
8640236.336563.6902
11830324.136501.0799
94025.836434.1085
5150141.436421.4993
242066.636336.3363
256070.736209.3352
3640100.636182.9026
12830354.936151.0285
9480262.336141.8223
8720242.335988.4441
244067.835988.2006
4010111.835867.6208
288080.335865.5044
13220368.635865.4368
124034.635838.1503
5730159.935834.8968
1125031435828.0255
6760188.935786.1302
156043.635779.8165
3770105.435768.5009
13440375.935754.1899
14240398.735716.0773
13770385.635710.5809
8580240.435690.5158
279078.235677.7494
12150340.835651.4085
4890137.635537.7907
15330431.735510.7714
200056.435460.9929
9450266.635446.3616
4260120.535352.6971
289082.135200.9744
5290150.535149.5017
224063.835109.7179
5040144.234951.4563
8070231.434874.6759
574016534787.8788
88025.334782.6087
284081.734761.3219
6470186.334728.9318
6440185.934642.2808
5680164.534528.8754
228066.134493.1921
6120177.634459.4595
8040234.334314.9808
11080323.334271.5744
6500190.234174.5531
6070177.734158.6944
4120120.734134.2171
16004734042.5532
145042.634037.5587
229067.433976.2611
19005633928.5714
875025833914.7287
8990265.733835.1524
9360276.933802.8169
99029.333788.3959
7070209.733714.8307
159047.233686.4407
995029633614.8649
6460192.233610.8221
3980118.833501.6835
11850354.333446.232
15410460.833441.8403
4900146.733401.4997
8470253.833372.7344
11320339.533343.1517
15390462.533275.6757
7670230.833232.2357
10930329.133211.7897
12820386.433178.0538
7910238.833123.9531
127038.433072.9167
216065.433027.5229
299090.633002.2075
6650201.632986.1111
8550259.632935.2851
31609632916.6667
139042.332860.5201
133040.532839.5062
486014832837.8378
11790359.832768.2046
9630294.332721.7125
172052.632699.6198
118036.132686.9806
5160157.932678.9107
9200282.332589.4439
7800239.932513.5473
5050155.732434.1683
259079.932415.5194
7770240.832267.4419
77023.932217.5732
157048.832172.1311
5400167.932162.0012
320099.732096.2889
4830150.532093.0233
143044.632062.7803
248077.432041.3437
246076.832031.25
8770275.831798.4046
179056.431737.5887
278087.631735.1598
4700148.431671.159
173054.831569.3431
4790151.931533.9039
5170164.231485.9927
6310200.831424.3028
15400490.431402.9364
269085.931315.4831
7970254.931267.1636
7030225.531175.1663
291093.531122.9947
98031.531111.1111
3900125.531075.6972
13660439.931052.5119
283091.530928.9617
9150296.230891.2897
29309530842.1053
7220234.430802.0478
107034.830747.1264
6080198.730598.8928
72023.630508.4746
153050.230478.0876
6950229.430296.4255
7600251.230254.7771
6990231.330220.4929
5890195.830081.716
9390312.930009.5877
6540218.629917.6578
85028.529824.5614
274092.129750.2714
3220108.729622.8151
10620358.629615.1701
276093.229613.7339
147049.829518.0723
17706029500
3000101.729498.5251
8120275.329495.0963
5870199.929364.6823
264090.429203.5398
203069.629166.6667
5110175.429133.4094
13404629130.4348
5560191.729003.6515
11303928974.359
270093.328938.9068
3040105.128924.8335
3500121.228877.8878
3110107.828849.7217
109037.828835.9788
5980207.928763.8288
162056.528672.5664
207072.528551.7241
126044.228506.7873
7470262.228489.7025
720025328458.498
6270220.828396.7391
5990211.128375.1776
236083.228365.3846
2900102.328347.9961
193068.428216.3743
4870172.828182.8704
96034.228070.1754
218077.927984.5956
82029.427891.1565
137049.227845.5285
189067.927835.0515
261094.127736.4506
170061.627597.4026
6360230.727568.2705
163059.327487.3524
5800211.527423.1678
3020110.227404.7187
108039.627272.7273
15340562.827256.5743
148054.327255.9853
354013027230.7692
7080261.127116.0475
161059.427104.3771
267098.926996.9666
2820105.526729.8578
217081.226724.1379
73027.426642.3358
175065.726636.2253
11730440.726616.7461
8800330.826602.1765
4710177.326565.1438
155058.826360.5442
181068.926269.9565
210080.226184.5387
199076.126149.8029
3390130.425996.9325
2208.525882.3529
257099.525829.1457
7640295.925819.5336
19607625789.4737
202078.525732.4841
7160278.325727.6321
128049.825702.8112
3080120.625538.9718
6060237.425526.5375
4230165.825512.6659
97038.225392.6702
141055.825268.8172
102040.525185.1852
5470217.425160.9936
321012825078.125
86034.325072.8863
221088.724915.4453
5910237.524884.2105
421017124619.883
9330379.724572.0306
6520265.624548.1928
112045.724507.6586
682028024357.1429
2550104.724355.3009
6370263.124211.3265
100041.424154.5894
132054.824087.5912
4220177.123828.3456
5850245.723809.5238
457019223802.0833
2380100.123776.2238
6200262.523619.0476
5060214.723567.769
2960125.923510.7228
7510319.923476.0863
5220222.523460.6742
168071.823398.3287
5950254.523379.1749
6110261.423374.1393
6030259.223263.8889
5960256.423244.9298
2500107.723212.6277
158068.123201.1747
5140221.623194.9458
2109.123076.9231
363015822974.6835
8190359.322794.3223
4110180.622757.4751
76033.622619.0476
23010.222549.0196
4420196.222528.0326
24010.722429.9065
78035.122222.2222
5430245.222145.1876
372016822142.8571
8330380.421898.0021
184084.121878.7158
46021.221698.1132
7710356.721614.8024
2270105.821455.5766
4500209.921438.7804
240011221428.5714
4960232.421342.5129
2710127.821205.0078
2190104.320997.1237
4770228.420884.4133
212010220784.3137
70033.720771.5134
8270403.820480.4359
2730133.420464.7676
5510269.720430.1075
174085.520350.8772
2140105.920207.7432
4270211.720170.052
90044.720134.2282
2800139.120129.4033
2340116.820034.2466
2320115.920017.2563
31015.520000
2110105.719962.157
2080104.819847.3282
80040.519753.0864
3650184.819751.0823
47023.819747.8992
187094.819725.7384
5090260.519539.3474
3050156.919439.1332
8904619347.8261
129067.119225.0373
3180167.119030.5206
42022.119004.5249
30015.918867.9245
104055.218840.5797
114060.718780.8896
3880208.318626.9803
2090112.618561.2789
440023818487.395
888048118461.5385
103056.118360.0713
48026.218320.6107
3570195.418270.2149
152083.218269.2308
36019.818181.8182
1709.418085.1064
138076.717992.1773
3550201.717600.3966
3340189.917588.2043
115066.317345.3997
146084.417298.5782
3970229.917268.3776
101058.717206.1329
166096.617184.265
151089.716833.8907
3030180.616777.4086
105062.816719.7452
45027.316483.5165
6850420.616286.2577
84051.816216.2162
1509.316129.0323
79049.415991.9028
3420215.515870.0696
5250330.915865.8205
1901215833.3333
2150135.915820.4562
5020317.915791.1293
3060194.315748.842
231014815608.1081
3090198.815543.2596
4040260.415514.5929
7560498.415168.5393
121080.115106.1174
142094.115090.3294
11007315068.4932
3150209.315050.1672
313020815048.0769
20013.414925.3731
34022.914847.1616
2950201.214662.0278
3120217.314358.0304
91063.514330.7087
28019.614285.7143
4180296.314107.3237
51036.713896.4578
1500108.913774.1047
1208.813636.3636
2050152.113477.975
7105313396.2264
4640352.713155.6564
2850216.713151.8228
3280249.713135.7629
10440799.113064.6978
2200169.712964.0542
18013.912949.6403
3290256.112846.5443
1108.612790.6977
335026312737.6426
4350343.312671.1331
1400111.512556.0538
1920156.312284.0691
3800312.312167.7874
87071.912100.1391
74061.811974.11
16013.511851.8519
5200440.911794.0576
3360287.111703.2393
41036.211325.9669
2350210.211179.8287
13011.811016.9492
3960367.410778.4431
75069.710760.4017
3140295.310633.2543
1250117.710620.2209
43040.610591.133
807.710389.6104
33032.410185.1852
2130211.610066.1626
1170124.19427.8807
44048.39109.7308
390439069.7674
3260362.19003.0378
40804558967.033
29032.68895.7055
2750309.38891.0443
81094.88544.3038
68079.98510.6383
35042.18313.5392
830100.58258.7065
34504527632.7434
49065.47492.3547
14902067233.0097
93501305.37163.1043
3250456.67117.8274
32045.37064.0177
3320473.87007.176
2490357.76961.1406
1540230.46684.0278
609.26521.7391
1710265.96430.9891
27042.16413.3017
3300519.56352.2618
37058.76303.2368
9201506133.3333
3330546.86089.9781
3380560.96026.0296
50084.25938.2423
26043.85936.0731
14023.65932.2034
406.85882.3529
7011.95882.3529
690119.75764.411
3170563.55625.5546
2060369.35578.1208
52095.45450.7338
40074.45376.3441
509.55263.1579
25047.85230.1255
530101.85206.2868
3270657.44974.1406
570114.94960.8355
3310701.14721.1525
610152.34005.2528
630164.13839.1225
560147.93786.3421
3083750
600167.13590.6643
620174.43555.0459
6701983383.8384
550164.23349.5737
380119.13190.5961
540181.32978.4887
640218.52929.0618
660248.92651.6673
590236.12498.9411
9041.22184.466
580289.32004.8393
33701797.11875.2434
32401745.71855.989
10062.41602.5641
650543.31196.3924
2027.4729.927

客观测试

客观测试是考虑多种情况下的测试,更接近实际情况。

GitHub测试工具

https://github.com/boonyachengdu/SQLTools

Mysql与Mycat插入性能测试

单线程读写性能测试

1W测试数据

批次数量

数据样本

MySQL(s)

Mycat(s)

1

10000

0.835

 

2

5000

0.954

1.344

3

3333

1.067

1.619

4

2500

0.096

0.736

5

2000

0.829

0.863

6

1666

0.842

0.771

7

1428

0.816

0.963

8

1250

0.84

0.785

9

1111

0.854

0.988

10

1000

0.816

0.748

15

666

0.823

1.043

20

500

0.878

0.745

25

400

0.834

0.753

30

333

0.814

1.467

40

250

0.897

0.772

50

200

0.827

0.787

100

100

0.985

0.859

 

10W测试数据

批次数量

数据样本

MySQL(s)

Mycat(s)

1

100000

7.856

-

2

50000

7.969

7.484

3

33333

7.953

15.285

4

25000

8.856

20.125

5

20000

7.808

8.353

6

16666

7.508

8.977

7

14280

7.712

7.129

8

12500

7.275

7.214

9

11110

7.328

7.202

10

10000

7.166

6.993

15

6666

7.14

7.133

20

5000

6.984

7.132

25

4000

7.228

7.101

30

3333

7.017

7.381

40

2500

6.556

7.583

50

2000

7.242

7.579

100

1000

6.823

8.451

 

 

多线程读写性能测试

1W测试数据

线程数量

数据样本

MySQL(s)

Mycat(s)

1

10000

1.517

-

2

5000

1.637

1.343

3

3333

1.569

1.797

4

2500

1.609

1.457

5

2000

1.551

1.002

6

1666

1.554

0.859

7

1428

1.593

0.868

8

1250

1.563

0.847

9

1111

1.556

0.851

10

1000

1.6

0.882

15

666

1.633

0.657

20

500

1.677

1.11

25

400

1.622

0.877

30

333

1.62

0.92

40

250

1.705

0.915

50

200

1.699

0.947

100

100

2.109

1.094

 

 10W测试数据

线程数量

数据样本

MySQL(s)

Mycat(s)

1

100000

 8.949

-

2

50000

 8.969

-

3

33333

 9.101

-

4

25000

 8.951

-

5

20000

 9.094

-

6

16666

 8.353

-

7

14280

 8.471

-

8

12500

 8.8

-

9

11111

 8.798

-

10

10000

 8.784

-

15

6666

 8.828

7.86

20

5000

 8.636

7.807

25

4000

 8.928

14.183

30

3333

 8.558

15.309

40

2500

 8.375

7.493

50

2000

 8.995

8.991

100

1000

 9.243

7.376

 

测试对比和结论

测试数据对比

测试属性

MySQL-InnoDB(v)

MYCAT(v)

多线程插入1w

6000/s左右

 10000/s左右

多线程读写10w

11000/s左右

 13000/s左右

单线程读取1w

10000/s左右

 10000/s左右

单线程读写10w

15000/s左右

 13000/s左右

 

测试结论

1、 Mysql单线程写入和Mycat性能相当Mycat批量插入数据的时候不能一次超过9500条,需分批次插入。

2、 多线程读写性能Mycat优于MySQL。

3、 Mycat批量处理大于10000可能产生插入异常。

4、总体来看Mycat性能与Mysql性能相差无几。



  • 1
    点赞
  • 7
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值