This is an automated email from the ASF dual-hosted git repository.
zhaoyanan pushed a commit to branch master
in repository
https://gitbox.apache.org/repos/asf/incubator-shardingsphere-benchmark.git
The following commit(s) were added to refs/heads/master by this push:
new 37cc045 add benchmark project
37cc045 is described below
commit 37cc045b4cdf6ee7a79e4ac93fc8f35de10c2fd8
Author: nancyzrh <[email protected]>
AuthorDate: Tue Oct 8 11:14:16 2019 +0800
add benchmark project
---
.../src/main/java/perfstmt/ShardingPerfStmt.java | 49 +++++
.../src/main/java/service/api/entity/Iou.java | 50 +++++
.../java/service/api/service/SJPerfService.java | 36 ++++
.../PreciseModuleShardingDatabaseAlgorithm.java | 46 +++++
.../PreciseModuleShardingTableAlgorithm.java | 46 +++++
.../RangeModuleShardingDatabaseAlgorithm.java | 63 ++++++
.../RangeModuleShardingTableAlgorithm.java | 54 +++++
.../java/service/util/config/SJDataSourceOp.java | 221 +++++++++++++++++++++
.../java/service/util/config/SJDataSourceUtil.java | 163 +++++++++++++++
.../java/service/util/config/SPDataSourceUtil.java | 200 +++++++++++++++++++
.../util/config/lastversion/SJDataSourceOp.java | 147 ++++++++++++++
.../sjmasterslave/SJMasterSlaveDelete.java | 81 ++++++++
.../sjmasterslave/SJMasterSlaveInsert.java | 81 ++++++++
.../sjmasterslave/SJMasterSlaveSelect.java | 81 ++++++++
.../sjmasterslave/SJMasterSlaveUpdate.java | 81 ++++++++
.../lastversion/sjsharding/SJShardingDelete.java | 81 ++++++++
.../lastversion/sjsharding/SJShardingInsert.java | 81 ++++++++
.../lastversion/sjsharding/SJShardingSelect.java | 80 ++++++++
.../lastversion/sjsharding/SJShardingUpdate.java | 81 ++++++++
.../perf/sjencrypt/SJEncryptDelete.java | 81 ++++++++
.../perf/sjencrypt/SJEncryptInsert.java | 81 ++++++++
.../perf/sjencrypt/SJEncryptSelect.java | 81 ++++++++
.../perf/sjencrypt/SJEncryptUpdate.java | 82 ++++++++
.../perf/sjmasterslave/SJMasterSlaveDelete.java | 82 ++++++++
.../perf/sjmasterslave/SJMasterSlaveInsert.java | 82 ++++++++
.../perf/sjmasterslave/SJMasterSlaveSelect.java | 82 ++++++++
.../perf/sjmasterslave/SJMasterSlaveUpdate.java | 82 ++++++++
.../perf/sjsharding/SJShardingDelete.java | 82 ++++++++
.../perf/sjsharding/SJShardingInsert.java | 81 ++++++++
.../perf/sjsharding/SJShardingSelect.java | 82 ++++++++
.../perf/sjsharding/SJShardingUpdate.java | 82 ++++++++
.../perf/spencrypt/SPEncryptDelete.java | 80 ++++++++
.../perf/spencrypt/SPEncryptInsert.java | 78 ++++++++
.../perf/spencrypt/SPEncryptSelect.java | 79 ++++++++
.../perf/spencrypt/SPEncryptUpdate.java | 80 ++++++++
35 files changed, 3019 insertions(+)
diff --git
a/shardingsphere-benchmark/src/main/java/perfstmt/ShardingPerfStmt.java
b/shardingsphere-benchmark/src/main/java/perfstmt/ShardingPerfStmt.java
new file mode 100644
index 0000000..c35c000
--- /dev/null
+++ b/shardingsphere-benchmark/src/main/java/perfstmt/ShardingPerfStmt.java
@@ -0,0 +1,49 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package perfstmt;
+
+import lombok.Getter;
+import lombok.RequiredArgsConstructor;
+
+/**
+ * sql statements used for performance.
+ *
+ * @author nancyzrh
+ */
+@RequiredArgsConstructor
+@Getter
+public enum ShardingPerfStmt {
+
+ /**
+ * stmt for perf.
+ */
+ CLEAN_ALL_STMT("delete from ssperf"),
+
+ DELETE_STMT("delete from ssperf where k=? and id=?"),
+
+ INSERT_STMT("INSERT INTO ssperf(k,c,pad) VALUES (?,?,?)"),
+
+ INSET_DEMO_STMT("INSERT INTO ssperf(id,k,c,pad) VALUES (?,?,?,?)"),
+
+ SELECT_STMT("SELECT id,k from ssperf where id=1 and k=1"),
+
+ UPDATE_STMT("update ssperf set c=?,pad=? where id=? and k=?");
+
+ private final String value;
+
+}
diff --git a/shardingsphere-benchmark/src/main/java/service/api/entity/Iou.java
b/shardingsphere-benchmark/src/main/java/service/api/entity/Iou.java
new file mode 100644
index 0000000..20ed67a
--- /dev/null
+++ b/shardingsphere-benchmark/src/main/java/service/api/entity/Iou.java
@@ -0,0 +1,50 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package service.api.entity;
+
+import lombok.Getter;
+import lombok.Setter;
+
+import java.io.Serializable;
+
+/**
+ * Iou entity.
+ * @author nancyzrh
+ */
+@Setter
+@Getter
+public class Iou implements Serializable {
+ private static final long serialVersionUID = -4245146895898370269L;
+
+ private int k;
+
+ private String c;
+
+ private String pad;
+
+ /**
+ * impliment to string.
+ * @return result string
+ */
+ @Override
+ public String toString() {
+ return String.format("k: %s, c: %s, pad: %s", k, c, pad);
+ }
+
+}
+
diff --git
a/shardingsphere-benchmark/src/main/java/service/api/service/SJPerfService.java
b/shardingsphere-benchmark/src/main/java/service/api/service/SJPerfService.java
new file mode 100644
index 0000000..343ce4b
--- /dev/null
+++
b/shardingsphere-benchmark/src/main/java/service/api/service/SJPerfService.java
@@ -0,0 +1,36 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package service.api.service;
+
+import lombok.Getter;
+
+import javax.sql.DataSource;
+import java.sql.SQLException;
+
+/**
+ * sj performance service.
+ * @author nancyzrh
+ */
+@Getter
+public class SJPerfService {
+ private final DataSource dataSource;
+
+ public SJPerfService(final DataSource dataSource) throws SQLException {
+ this.dataSource = dataSource;
+ }
+}
diff --git
a/shardingsphere-benchmark/src/main/java/service/util/algorithm/PreciseModuleShardingDatabaseAlgorithm.java
b/shardingsphere-benchmark/src/main/java/service/util/algorithm/PreciseModuleShardingDatabaseAlgorithm.java
new file mode 100644
index 0000000..64fd089
--- /dev/null
+++
b/shardingsphere-benchmark/src/main/java/service/util/algorithm/PreciseModuleShardingDatabaseAlgorithm.java
@@ -0,0 +1,46 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package service.util.algorithm;
+
+import
org.apache.shardingsphere.api.sharding.standard.PreciseShardingAlgorithm;
+import org.apache.shardingsphere.api.sharding.standard.PreciseShardingValue;
+
+import java.util.Collection;
+
+/**
+ * precise module sharding database algorithm.
+ * @author nancyzrh
+ */
+public class PreciseModuleShardingDatabaseAlgorithm implements
PreciseShardingAlgorithm<Integer> {
+
+ /**
+ * do sharding.
+ * @param databaseNames database names
+ * @param shardingValue sharding value
+ * @return string
+ */
+ @Override
+ public String doSharding(final Collection<String> databaseNames, final
PreciseShardingValue<Integer> shardingValue) {
+ for (String each : databaseNames) {
+ if (each.endsWith(shardingValue.getValue() % 2 + "")) {
+ return each;
+ }
+ }
+ throw new UnsupportedOperationException();
+ }
+}
diff --git
a/shardingsphere-benchmark/src/main/java/service/util/algorithm/PreciseModuleShardingTableAlgorithm.java
b/shardingsphere-benchmark/src/main/java/service/util/algorithm/PreciseModuleShardingTableAlgorithm.java
new file mode 100644
index 0000000..fd942ec
--- /dev/null
+++
b/shardingsphere-benchmark/src/main/java/service/util/algorithm/PreciseModuleShardingTableAlgorithm.java
@@ -0,0 +1,46 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package service.util.algorithm;
+
+import
org.apache.shardingsphere.api.sharding.standard.PreciseShardingAlgorithm;
+import org.apache.shardingsphere.api.sharding.standard.PreciseShardingValue;
+
+import java.util.Collection;
+
+/**
+ * precise module sharding table algorithm.
+ * @author nancyzrh
+ */
+public class PreciseModuleShardingTableAlgorithm implements
PreciseShardingAlgorithm<Integer> {
+
+ /**
+ * do sharding.
+ * @param tableNames table names
+ * @param shardingValue sharding value
+ * @return string
+ */
+ @Override
+ public String doSharding(final Collection<String> tableNames, final
PreciseShardingValue<Integer> shardingValue) {
+ for (String each : tableNames) {
+ if (each.endsWith(shardingValue.getValue() % 2 + "")) {
+ return each;
+ }
+ }
+ throw new UnsupportedOperationException();
+ }
+}
diff --git
a/shardingsphere-benchmark/src/main/java/service/util/algorithm/RangeModuleShardingDatabaseAlgorithm.java
b/shardingsphere-benchmark/src/main/java/service/util/algorithm/RangeModuleShardingDatabaseAlgorithm.java
new file mode 100644
index 0000000..f8dcccf
--- /dev/null
+++
b/shardingsphere-benchmark/src/main/java/service/util/algorithm/RangeModuleShardingDatabaseAlgorithm.java
@@ -0,0 +1,63 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package service.util.algorithm;
+
+import com.google.common.collect.Range;
+import org.apache.shardingsphere.api.sharding.standard.RangeShardingAlgorithm;
+import org.apache.shardingsphere.api.sharding.standard.RangeShardingValue;
+
+import java.util.Collection;
+import java.util.LinkedHashSet;
+import java.util.Set;
+
+/**
+ * range module sharding database algorithm.
+ * @author nancyzrh
+ */
+public class RangeModuleShardingDatabaseAlgorithm implements
RangeShardingAlgorithm<Integer> {
+
+ /**
+ * do sharding.
+ * @param databaseNames database names
+ * @param shardingValue sharding value
+ * @return collection result
+ */
+ @Override
+ public Collection<String> doSharding(final Collection<String>
databaseNames, final RangeShardingValue<Integer> shardingValue) {
+ Set<String> result = new LinkedHashSet<>();
+ if (Range.closed(1, 5).encloses(shardingValue.getValueRange())) {
+ for (String each : databaseNames) {
+ if (each.endsWith("0")) {
+ result.add(each);
+ }
+ }
+ } else if (Range.closed(6,
10).encloses(shardingValue.getValueRange())) {
+ for (String each : databaseNames) {
+ if (each.endsWith("1")) {
+ result.add(each);
+ }
+ }
+ } else if (Range.closed(1,
10).encloses(shardingValue.getValueRange())) {
+ result.addAll(databaseNames);
+ } else {
+ throw new UnsupportedOperationException();
+ }
+ return result;
+ }
+}
+
diff --git
a/shardingsphere-benchmark/src/main/java/service/util/algorithm/RangeModuleShardingTableAlgorithm.java
b/shardingsphere-benchmark/src/main/java/service/util/algorithm/RangeModuleShardingTableAlgorithm.java
new file mode 100644
index 0000000..cf0ffe9
--- /dev/null
+++
b/shardingsphere-benchmark/src/main/java/service/util/algorithm/RangeModuleShardingTableAlgorithm.java
@@ -0,0 +1,54 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package service.util.algorithm;
+
+import com.google.common.collect.Range;
+import org.apache.shardingsphere.api.sharding.standard.RangeShardingAlgorithm;
+import org.apache.shardingsphere.api.sharding.standard.RangeShardingValue;
+
+import java.util.Collection;
+import java.util.LinkedHashSet;
+import java.util.Set;
+
+/**
+ * range module sharding table algorithm.
+ * @author nancyzrh
+ */
+public class RangeModuleShardingTableAlgorithm implements
RangeShardingAlgorithm<Long> {
+
+ /**
+ * do sharding.
+ * @param tableNames table names
+ * @param shardingValue sharding value
+ * @return collection result
+ */
+ @Override
+ public Collection<String> doSharding(final Collection<String> tableNames,
final RangeShardingValue<Long> shardingValue) {
+ Set<String> result = new LinkedHashSet<>();
+ if (Range.closed(200000000000000000L,
400000000000000000L).encloses(shardingValue.getValueRange())) {
+ for (String each : tableNames) {
+ if (each.endsWith("0")) {
+ result.add(each);
+ }
+ }
+ } else {
+ throw new UnsupportedOperationException();
+ }
+ return result;
+ }
+}
diff --git
a/shardingsphere-benchmark/src/main/java/service/util/config/SJDataSourceOp.java
b/shardingsphere-benchmark/src/main/java/service/util/config/SJDataSourceOp.java
new file mode 100644
index 0000000..a3a1e01
--- /dev/null
+++
b/shardingsphere-benchmark/src/main/java/service/util/config/SJDataSourceOp.java
@@ -0,0 +1,221 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package service.util.config;
+
+import com.google.common.collect.Lists;
+import
org.apache.shardingsphere.api.config.encrypt.EncryptColumnRuleConfiguration;
+import org.apache.shardingsphere.api.config.encrypt.EncryptRuleConfiguration;
+import
org.apache.shardingsphere.api.config.encrypt.EncryptTableRuleConfiguration;
+import org.apache.shardingsphere.api.config.encrypt.EncryptorRuleConfiguration;
+import
org.apache.shardingsphere.api.config.masterslave.MasterSlaveRuleConfiguration;
+import org.apache.shardingsphere.api.config.sharding.KeyGeneratorConfiguration;
+import org.apache.shardingsphere.api.config.sharding.ShardingRuleConfiguration;
+import org.apache.shardingsphere.api.config.sharding.TableRuleConfiguration;
+import
org.apache.shardingsphere.api.config.sharding.strategy.InlineShardingStrategyConfiguration;
+
+import org.apache.shardingsphere.shardingjdbc.api.EncryptDataSourceFactory;
+import org.apache.shardingsphere.shardingjdbc.api.MasterSlaveDataSourceFactory;
+import org.apache.shardingsphere.shardingjdbc.api.ShardingDataSourceFactory;
+
+import javax.sql.DataSource;
+import java.sql.SQLException;
+import java.util.Map;
+import java.util.List;
+import java.util.Properties;
+import java.util.HashMap;
+import java.util.Collections;
+import java.util.Arrays;
+
+/**
+ * create datasource operation for sharding jdbc.
+ * @author nancyzrh
+ */
+public class SJDataSourceOp {
+
+ /**
+ * create datasource for master slave.
+ * @return datasource db
+ * @throws SQLException ex
+ */
+ public static DataSource createMSDataSource() throws SQLException {
+ Map<String, DataSource> dataSourceMap = new HashMap<>();
+ dataSourceMap.put("ds_master",
SJDataSourceUtil.createDataSource("###", "sharding_db", "####", 3306, "####"));
+ dataSourceMap.put("ds_slave0",
SJDataSourceUtil.createDataSource("###", "sharding_db", "####", 3306, "####"));
+ MasterSlaveRuleConfiguration masterSlaveRuleConfig = new
MasterSlaveRuleConfiguration("ds_master_slave", "ds_master",
Arrays.asList("ds_slave0"));
+ DataSource dataSource =
MasterSlaveDataSourceFactory.createDataSource(dataSourceMap,
masterSlaveRuleConfig, new Properties());
+ return dataSource;
+ }
+
+ /**
+ * create encrypt datasource.
+ * @return encrypt data source
+ * @throws SQLException ex
+ */
+ public static DataSource createEncryptDataSource() throws SQLException {
+ Properties props = new Properties();
+ props.setProperty("aes.key.value", "123456abc");
+ EncryptorRuleConfiguration encryptorConfig = new
EncryptorRuleConfiguration("AES", props);
+ EncryptColumnRuleConfiguration columnConfig = new
EncryptColumnRuleConfiguration("", "c", "", "aes");
+ EncryptTableRuleConfiguration tableConfig = new
EncryptTableRuleConfiguration(Collections.singletonMap("c", columnConfig));
+ EncryptRuleConfiguration encryptRuleConfig = new
EncryptRuleConfiguration();
+ encryptRuleConfig.getEncryptors().put("aes", encryptorConfig);
+ encryptRuleConfig.getTables().put("ssperf", tableConfig);
+ DataSource dataSource = SJDataSourceUtil.createDataSource("###",
"sharding_db", "####", 3306, "####");
+ DataSource encryptDatasource =
EncryptDataSourceFactory.createDataSource(dataSource, encryptRuleConfig, new
Properties());
+ return encryptDatasource;
+ }
+
+ /**
+ * create ms sharding datasource.
+ * @return datasource
+ * @throws SQLException ex
+ */
+ public static DataSource createMSShardingDataSource() throws SQLException {
+ ShardingRuleConfiguration shardingRuleConfig = new
ShardingRuleConfiguration();
+ TableRuleConfiguration tableRuleConfiguration = new
TableRuleConfiguration("ssperf", "ms_ds_${0..1}.ssperf${0..1023}");
+ shardingRuleConfig.getTableRuleConfigs().add(tableRuleConfiguration);
+ shardingRuleConfig.getBindingTableGroups().add("ssperf");
+
shardingRuleConfig.setDefaultKeyGeneratorConfig(getKeyGeneratorConfiguration());
+ shardingRuleConfig.setDefaultDatabaseShardingStrategyConfig(new
InlineShardingStrategyConfiguration("id", "ds_${id % 2}"));
+ shardingRuleConfig.setDefaultTableShardingStrategyConfig(new
InlineShardingStrategyConfiguration("k", "ssperf${k % 1024}"));
+
shardingRuleConfig.setMasterSlaveRuleConfigs(getMasterSlaveRuleConfigurations());
+ return
ShardingDataSourceFactory.createDataSource(createMSsharingDataSourceMap(),
shardingRuleConfig, new Properties());
+ }
+
+ /**
+ * get table rule config for master slave.
+ * @return res
+ */
+ private static TableRuleConfiguration getMSTableRuleConfiguration() {
+ TableRuleConfiguration result = new TableRuleConfiguration("ssperf",
"ms_ds_${0..1}.ssperf${0..1023}");
+ result.setKeyGeneratorConfig(getKeyGeneratorConfiguration());
+ return result;
+ }
+
+ /**
+ * get master slave rule config.
+ * @return res
+ */
+ private static List<MasterSlaveRuleConfiguration>
getMasterSlaveRuleConfigurations() {
+ MasterSlaveRuleConfiguration masterSlaveRuleConfig1 = new
MasterSlaveRuleConfiguration("ms_ds_0", "ds_0", Arrays.asList("ds_0_slave_0"));
+ MasterSlaveRuleConfiguration masterSlaveRuleConfig2 = new
MasterSlaveRuleConfiguration("ms_ds_1", "ds_1", Arrays.asList("ds_1_slave_0"));
+ return Lists.newArrayList(masterSlaveRuleConfig1,
masterSlaveRuleConfig2);
+ }
+
+ /**
+ * create master slave datasource map.
+ * @return datasource map
+ */
+ private static Map<String, DataSource> createMSsharingDataSourceMap() {
+ final Map<String, DataSource> result = new HashMap<>();
+ result.put("ds_0", SJDataSourceUtil.createDataSource("###",
"sharding_db", "####", 3306, "####"));
+ result.put("ds_0_slave_0", SJDataSourceUtil.createDataSource("###",
"sharding_db", "####", 3306, "####"));
+ result.put("ds_1", SJDataSourceUtil.createDataSource("###",
"sharding_db", "####", 3306, "####"));
+ result.put("ds_1_slave_0", SJDataSourceUtil.createDataSource("###",
"sharding_db", "####", 3306, "####"));
+ return result;
+ }
+
+ /**
+ * create sharding datasource.
+ * @return datasource db
+ * @throws SQLException ex
+ */
+ public static DataSource createShardingDataSource() throws SQLException {
+ TableRuleConfiguration tableRuleConfig = new
TableRuleConfiguration("ssperf", "ds_${0..3}.ssperf${0..1023}");
+ tableRuleConfig.setDatabaseShardingStrategyConfig(new
InlineShardingStrategyConfiguration("id", "ds_${id % 4}"));
+ tableRuleConfig.setTableShardingStrategyConfig(new
InlineShardingStrategyConfiguration("k", "ssperf${k % 1024}"));
+ tableRuleConfig.setKeyGeneratorConfig(getKeyGeneratorConfiguration());
+ ShardingRuleConfiguration shardingRuleConfig = new
ShardingRuleConfiguration();
+ shardingRuleConfig.getTableRuleConfigs().add(tableRuleConfig);
+ return
ShardingDataSourceFactory.createDataSource(createShardingDataSourceMap(),
shardingRuleConfig, new Properties());
+ }
+
+ /**
+ * create sharding datasource map.
+ * @return datasource map
+ */
+ private static Map<String, DataSource> createShardingDataSourceMap() {
+ Map<String, DataSource> result = new HashMap<>();
+ result.put("ds_0", SJDataSourceUtil.createDataSource("###",
"sharding_db", "####", 3306, "####"));
+ result.put("ds_1", SJDataSourceUtil.createDataSource("###",
"sharding_db", "####", 3306, "####"));
+ result.put("ds_2", SJDataSourceUtil.createDataSource("###",
"sharding_db", "####", 3306, "####"));
+ result.put("ds_3", SJDataSourceUtil.createDataSource("###",
"sharding_db", "####", 3306, "####"));
+ return result;
+ }
+
+ /**
+ * create encrypt sharding datasource.
+ * @return encrypt datasource
+ * @throws SQLException ex
+ */
+ public static DataSource createEncryptShardingDataSource() throws
SQLException {
+ ShardingRuleConfiguration shardingRuleConfig = new
ShardingRuleConfiguration();
+
shardingRuleConfig.getTableRuleConfigs().add(getTableRuleConfiguration());
+ shardingRuleConfig.getBindingTableGroups().add("ssperf");
+ shardingRuleConfig.setDefaultDatabaseShardingStrategyConfig(new
InlineShardingStrategyConfiguration("id", "ds_${id % 2}"));
+ shardingRuleConfig.setDefaultTableShardingStrategyConfig(new
InlineShardingStrategyConfiguration("k", "ssperf${k % 1024}"));
+ shardingRuleConfig.setEncryptRuleConfig(getEncryptRuleConfiguration());
+ return
ShardingDataSourceFactory.createDataSource(createDataSourceMap(),
shardingRuleConfig, new Properties());
+ }
+
+ /**
+ * get table rule config.
+ * @return table rule res
+ */
+ private static TableRuleConfiguration getTableRuleConfiguration() {
+ TableRuleConfiguration result = new TableRuleConfiguration("ssperf",
"ds_${0..1}.ssperf${0..1023}");
+ result.setKeyGeneratorConfig(getKeyGeneratorConfiguration());
+ return result;
+ }
+
+ /**
+ * get encrypt rule config.
+ * @return res
+ */
+ private static EncryptRuleConfiguration getEncryptRuleConfiguration() {
+ Properties props = new Properties();
+ props.setProperty("aes.key.value", "123456abc");
+ EncryptorRuleConfiguration encryptorConfig = new
EncryptorRuleConfiguration("AES", props);
+ EncryptColumnRuleConfiguration columnConfig = new
EncryptColumnRuleConfiguration("", "c", "", "aes");
+ EncryptTableRuleConfiguration tableConfig = new
EncryptTableRuleConfiguration(Collections.singletonMap("c", columnConfig));
+ EncryptRuleConfiguration encryptRuleConfig = new
EncryptRuleConfiguration();
+ encryptRuleConfig.getEncryptors().put("aes", encryptorConfig);
+ encryptRuleConfig.getTables().put("ssperf", tableConfig);
+ return encryptRuleConfig;
+ }
+
+ /**
+ * create datasource map.
+ * @return res
+ */
+ private static Map<String, DataSource> createDataSourceMap() {
+ Map<String, DataSource> result = new HashMap<>();
+ result.put("ds_0", SJDataSourceUtil.createDataSource("###",
"sharding_db", "####", 3306, "####"));
+ result.put("ds_1", SJDataSourceUtil.createDataSource("###",
"sharding_db", "####", 3306, "####"));
+ return result;
+ }
+
+ /**
+ * get key generator config.
+ * @return res
+ */
+ private static KeyGeneratorConfiguration getKeyGeneratorConfiguration() {
+ return new KeyGeneratorConfiguration("SNOWFLAKE", "id", new
Properties());
+ }
+}
+
diff --git
a/shardingsphere-benchmark/src/main/java/service/util/config/SJDataSourceUtil.java
b/shardingsphere-benchmark/src/main/java/service/util/config/SJDataSourceUtil.java
new file mode 100644
index 0000000..983849b
--- /dev/null
+++
b/shardingsphere-benchmark/src/main/java/service/util/config/SJDataSourceUtil.java
@@ -0,0 +1,163 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package service.util.config;
+
+import com.zaxxer.hikari.HikariConfig;
+import com.zaxxer.hikari.HikariDataSource;
+import service.api.entity.Iou;
+
+import javax.sql.DataSource;
+import java.sql.Connection;
+import java.sql.PreparedStatement;
+import java.sql.ResultSet;
+import java.sql.SQLException;
+import java.util.LinkedList;
+import java.util.List;
+
+/**
+ * datasource utils for sharding jdbc.
+ * @author nancyzrh
+ */
+public class SJDataSourceUtil {
+ private static final String DEFAULT_SCHEMA = "test";
+
+ public static DataSource createDataSource(final String usrName, final
String dataSourceName, final String host, final int port, final String
password) {
+ HikariConfig config = new HikariConfig();
+ config.setDriverClassName("com.mysql.jdbc.Driver");
+
config.setJdbcUrl(String.format("jdbc:mysql://%s:%s/%s?useSSL=false&serverTimezone=UTC",
host, port, dataSourceName));
+ config.setUsername(usrName);
+ config.setPassword(password);
+ config.setMaximumPoolSize(200);
+ config.addDataSourceProperty("useServerPrepStmts",
Boolean.TRUE.toString());
+ config.addDataSourceProperty("cachePrepStmts", "true");
+ config.addDataSourceProperty("prepStmtCacheSize", 250);
+ config.addDataSourceProperty("prepStmtCacheSqlLimit", 2048);
+ config.addDataSourceProperty("useLocalSessionState",
Boolean.TRUE.toString());
+ config.addDataSourceProperty("rewriteBatchedStatements",
Boolean.TRUE.toString());
+ config.addDataSourceProperty("cacheResultSetMetadata",
Boolean.TRUE.toString());
+ config.addDataSourceProperty("cacheServerConfiguration",
Boolean.TRUE.toString());
+ config.addDataSourceProperty("elideSetAutoCommits",
Boolean.TRUE.toString());
+ config.addDataSourceProperty("maintainTimeStats",
Boolean.FALSE.toString());
+ config.addDataSourceProperty("netTimeoutForStreamingResults", 0);
+ DataSource dataSource = new HikariDataSource(config);
+ return dataSource;
+ }
+
+ /**
+ * insert data for update.
+ * @param sql stmt
+ * @param datasource datasource from service
+ * @throws SQLException ex
+ */
+ public static void insertDemo(final String sql, final DataSource
datasource) throws SQLException {
+ try (Connection connection = datasource.getConnection();
+ PreparedStatement preparedStatement =
connection.prepareStatement(sql)) {
+ preparedStatement.setInt(1, 1);
+ preparedStatement.setInt(2, 1);
+ preparedStatement.setString(3, "##-####");
+ preparedStatement.setString(4, "##-####");
+ preparedStatement.execute();
+ } catch (final SQLException ignored) {
+ }
+ }
+
+ /**
+ * for select stmt.
+ * @param sql stmt
+ * @param dataSource datasource from service
+ * @throws SQLException ex
+ */
+ public static void getSelect(final String sql, final DataSource
dataSource) throws SQLException {
+ List<Iou> result = new LinkedList<>();
+ try (Connection connection = dataSource.getConnection();
+ PreparedStatement preparedStatement =
connection.prepareStatement(sql);
+ ResultSet resultSet = preparedStatement.executeQuery()) {
+ while (resultSet.next()) {
+ Iou iou = new Iou();
+ iou.setK(resultSet.getInt(2));
+ result.add(iou);
+ }
+ }
+ }
+
+ /**
+ * for update stmt.
+ * @param sql stmt
+ * @param datasource datasource from service
+ * @return res
+ * @throws SQLException ex
+ */
+ public static int updateStmt(final String sql, final DataSource
datasource) throws SQLException {
+ try (Connection connection = datasource.getConnection();
+ PreparedStatement preparedStatement =
connection.prepareStatement(sql)) {
+ preparedStatement.setString(1, "##-#####");
+ preparedStatement.setString(2, "##-#####");
+ preparedStatement.setInt(3, 1);
+ preparedStatement.setInt(4, 1);
+ return preparedStatement.executeUpdate();
+ }
+ }
+
+ /**
+ * for delete stmt.
+ * @param sql stmt
+ * @param datasource datasource from service
+ * @return res
+ * @throws SQLException ex
+ */
+ public static int delete(final String sql, final DataSource datasource)
throws SQLException {
+ try (Connection connection = datasource.getConnection();
+ PreparedStatement preparedStatement =
connection.prepareStatement(sql)) {
+ preparedStatement.setInt(1, 1);
+ preparedStatement.setInt(2, 1);
+ return preparedStatement.executeUpdate();
+ }
+ }
+
+ /**
+ * for clean up.
+ * @param sql stmt
+ * @param datasource datasource
+ * @throws SQLException ex
+ */
+ public static void clean(final String sql, final DataSource datasource)
throws SQLException {
+ try (Connection connection = datasource.getConnection();
+ PreparedStatement preparedStatement =
connection.prepareStatement(sql)) {
+ preparedStatement.executeUpdate();
+ }
+ }
+
+ /**
+ * for insert stmt.
+ * @param sql stmt
+ * @param datasource datasource
+ * @throws SQLException ex
+ */
+ public static void insert(final String sql, final DataSource datasource)
throws SQLException {
+ try (Connection connection = datasource.getConnection();
+ java.sql.PreparedStatement preparedStatement =
connection.prepareStatement(sql)) {
+ preparedStatement.setInt(1, 1);
+ preparedStatement.setString(2, "##-####");
+ preparedStatement.setString(3, "##-####");
+ preparedStatement.execute();
+ } catch (final SQLException ex) {
+ ex.printStackTrace();
+ }
+ }
+
+}
diff --git
a/shardingsphere-benchmark/src/main/java/service/util/config/SPDataSourceUtil.java
b/shardingsphere-benchmark/src/main/java/service/util/config/SPDataSourceUtil.java
new file mode 100644
index 0000000..40e8e56
--- /dev/null
+++
b/shardingsphere-benchmark/src/main/java/service/util/config/SPDataSourceUtil.java
@@ -0,0 +1,200 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package service.util.config;
+
+import com.zaxxer.hikari.HikariConfig;
+import com.zaxxer.hikari.HikariDataSource;
+
+import javax.sql.DataSource;
+import java.sql.PreparedStatement;
+import java.sql.Connection;
+import java.sql.SQLException;
+import java.sql.ResultSet;
+import java.sql.Statement;
+import java.util.HashMap;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Map;
+
+import service.api.entity.Iou;
+
+/**
+ * data source utils for sharding proxy.
+ * @author nancyzrh
+ */
+public class SPDataSourceUtil {
+ private static final String DEFAULT_SCHEMA = "test";
+
+ private static final Map<String, DataSource> DATA_SOURCE_MAP = new
HashMap<>();
+
+ /**
+ * create datasource.
+ * @param usrName user name
+ * @param dataSourceName datasource name
+ * @param host host ip
+ * @param port port
+ * @param password pwd
+ */
+ public static void createDataSource(final String usrName, final String
dataSourceName, final String host, final int port, final String password) {
+ HikariConfig config = new HikariConfig();
+ config.setDriverClassName("com.mysql.jdbc.Driver");
+
config.setJdbcUrl(String.format("jdbc:mysql://%s:%s/%s?useSSL=false&serverTimezone=UTC",
host, port, dataSourceName));
+ config.setUsername(usrName);
+ config.setPassword(password);
+ config.setMaximumPoolSize(200);
+ config.addDataSourceProperty("useServerPrepStmts",
Boolean.TRUE.toString());
+ config.addDataSourceProperty("cachePrepStmts", "true");
+ config.addDataSourceProperty("prepStmtCacheSize", 250);
+ config.addDataSourceProperty("prepStmtCacheSqlLimit", 2048);
+ config.addDataSourceProperty("useLocalSessionState",
Boolean.TRUE.toString());
+ config.addDataSourceProperty("rewriteBatchedStatements",
Boolean.TRUE.toString());
+ config.addDataSourceProperty("cacheResultSetMetadata",
Boolean.TRUE.toString());
+ config.addDataSourceProperty("cacheServerConfiguration",
Boolean.TRUE.toString());
+ config.addDataSourceProperty("elideSetAutoCommits",
Boolean.TRUE.toString());
+ config.addDataSourceProperty("maintainTimeStats",
Boolean.FALSE.toString());
+ config.addDataSourceProperty("netTimeoutForStreamingResults", 0);
+ DataSource dataSource = new HikariDataSource(config);
+ DATA_SOURCE_MAP.put(dataSourceName, dataSource);
+ }
+
+ /**
+ * get datasource from name.
+ * @param dataSourceName input name
+ * @return datasource
+ */
+ public static DataSource getDataSource(final String dataSourceName) {
+ return DATA_SOURCE_MAP.get(dataSourceName);
+ }
+
+ /**
+ * create schema if db don't exist.
+ * @param dataSourceName datasource name
+ */
+ public static void createSchema(final String dataSourceName) {
+ String sql = "CREATE DATABASE " + dataSourceName;
+ try (Connection connection =
getDataSource(DEFAULT_SCHEMA).getConnection();
+ Statement statement = connection.createStatement()) {
+ statement.execute(sql);
+ } catch (final SQLException ignored) {
+ }
+ }
+
+ /**
+ * insert data for update.
+ * @param sql input sql
+ * @param datasource datasource
+ * @throws SQLException sql exception
+ */
+ public static void insertDemo(final String sql, final String datasource)
throws SQLException {
+ try (Connection connection = getDataSource(datasource).getConnection();
+ PreparedStatement preparedStatement =
connection.prepareStatement(sql)) {
+ preparedStatement.setInt(1, 1);
+ preparedStatement.setInt(2, 2);
+ preparedStatement.setString(3, "##-####");
+ preparedStatement.setString(4, "##-####");
+ preparedStatement.execute();
+ } catch (final SQLException ignored) {
+ }
+ }
+
+ /**
+ * select result.
+ * @param sql input sql
+ * @param datasource datasource
+ * @return list result
+ * @throws SQLException ex
+ */
+ public static List<Iou> getIou(final String sql, final String datasource)
throws SQLException {
+ List<Iou> result = new LinkedList<>();
+ try (Connection connection = getDataSource(datasource).getConnection();
+ PreparedStatement preparedStatement =
connection.prepareStatement(sql);
+ ResultSet resultSet = preparedStatement.executeQuery()) {
+ while (resultSet.next()) {
+ Iou iou = new Iou();
+ iou.setK(resultSet.getInt(2));
+ result.add(iou);
+ }
+ }
+ return result;
+ }
+
+ /**
+ * update stmt.
+ * @param sql input stmt
+ * @param datasource datasource
+ * @return execute result
+ * @throws SQLException ex
+ */
+ public static int updateStmt(final String sql, final String datasource)
throws SQLException {
+ try (Connection connection = getDataSource(datasource).getConnection();
+ PreparedStatement preparedStatement =
connection.prepareStatement(sql)) {
+ preparedStatement.setString(1, "##-#####");
+ preparedStatement.setString(2, "##-#####");
+ preparedStatement.setInt(3, 1);
+ preparedStatement.setInt(4, 2);
+ return preparedStatement.executeUpdate();
+ }
+ }
+
+ /**
+ * insert data.
+ * @param sql input stmt
+ * @param datasource datasource
+ * @throws SQLException ex
+ */
+ public static void insertIou(final String sql, final String datasource)
throws SQLException {
+ try (Connection connection = getDataSource(datasource).getConnection();
+ PreparedStatement preparedStatement =
connection.prepareStatement(sql)) {
+ preparedStatement.setInt(1, 2);
+ preparedStatement.setString(2, "##-####");
+ preparedStatement.setString(3, "##-####");
+ preparedStatement.execute();
+ } catch (final SQLException ex) {
+ ex.printStackTrace();
+ }
+ }
+
+ /**
+ * clean up.
+ * @param sql input stmt
+ * @param datasource datasource
+ * @throws SQLException ex
+ */
+ public static void clean(final String sql, final String datasource) throws
SQLException {
+ try (Connection connection = getDataSource(datasource).getConnection();
+ PreparedStatement preparedStatement =
connection.prepareStatement(sql)) {
+ preparedStatement.executeUpdate();
+ }
+ }
+
+ /**
+ * delete target data.
+ * @param sql input stmt
+ * @param datasource datasource
+ * @return execute
+ * @throws SQLException ex
+ */
+ public static int deleteIou(final String sql, final String datasource)
throws SQLException {
+ try (Connection connection = getDataSource(datasource).getConnection();
+ PreparedStatement preparedStatement =
connection.prepareStatement(sql)) {
+ preparedStatement.setInt(1, 2);
+ preparedStatement.setInt(2, 1);
+ return preparedStatement.executeUpdate();
+ }
+ }
+}
diff --git
a/shardingsphere-benchmark/src/main/java/service/util/config/lastversion/SJDataSourceOp.java
b/shardingsphere-benchmark/src/main/java/service/util/config/lastversion/SJDataSourceOp.java
new file mode 100644
index 0000000..e8c9304
--- /dev/null
+++
b/shardingsphere-benchmark/src/main/java/service/util/config/lastversion/SJDataSourceOp.java
@@ -0,0 +1,147 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package service.util.config.lastversion;
+
+import com.google.common.collect.Lists;
+import io.shardingsphere.api.config.rule.MasterSlaveRuleConfiguration;
+import io.shardingsphere.api.config.rule.ShardingRuleConfiguration;
+import io.shardingsphere.api.config.rule.TableRuleConfiguration;
+import
io.shardingsphere.api.config.strategy.InlineShardingStrategyConfiguration;
+import io.shardingsphere.shardingjdbc.api.MasterSlaveDataSourceFactory;
+import io.shardingsphere.shardingjdbc.api.ShardingDataSourceFactory;
+import service.util.config.SJDataSourceUtil;
+
+import javax.sql.DataSource;
+import java.sql.SQLException;
+import java.util.Map;
+import java.util.List;
+import java.util.Properties;
+import java.util.HashMap;
+import java.util.Arrays;
+
+import java.util.concurrent.ConcurrentHashMap;
+
+/**
+ * create datasource for sharding jdbc version 3.1.0.
+ * @author nancyzrh
+ */
+public class SJDataSourceOp {
+
+ /**
+ * create sharding datasource.
+ * @return datasource
+ * @throws SQLException ex
+ */
+ public static DataSource createShardingDataSource() throws SQLException {
+ TableRuleConfiguration tableRuleConfig = new TableRuleConfiguration();
+ tableRuleConfig.setLogicTable("ssperf");
+ tableRuleConfig.setActualDataNodes("ds_${0..3}.ssperf${0..1023}");
+ tableRuleConfig.setDatabaseShardingStrategyConfig(new
InlineShardingStrategyConfiguration("id", "ds_${id % 4}"));
+ tableRuleConfig.setTableShardingStrategyConfig(new
InlineShardingStrategyConfiguration("k", "ssperf${k % 1024}"));
+ ShardingRuleConfiguration shardingRuleConfig = new
ShardingRuleConfiguration();
+ shardingRuleConfig.getTableRuleConfigs().add(tableRuleConfig);
+ return
ShardingDataSourceFactory.createDataSource(createShardingDataSourceMap(),
shardingRuleConfig, new HashMap<String, Object>(), new Properties());
+ }
+
+ /**
+ * create sharding datasource map.
+ * @return res
+ */
+ private static Map<String, DataSource> createShardingDataSourceMap() {
+ Map<String, DataSource> result = new HashMap<>();
+ result.put("ds_0", SJDataSourceUtil.createDataSource("###",
"sharding_db", "####", 3306, "####"));
+ result.put("ds_1", SJDataSourceUtil.createDataSource("###",
"sharding_db", "####", 3306, "####"));
+ result.put("ds_2", SJDataSourceUtil.createDataSource("###",
"sharding_db", "####", 3306, "####"));
+ result.put("ds_3", SJDataSourceUtil.createDataSource("###",
"sharding_db", "####", 3306, "####"));
+ return result;
+ }
+
+ /**
+ * create master slave sharding datasource.
+ * @return datasource
+ * @throws SQLException ex
+ */
+ public static DataSource createMSShardingDataSource() throws SQLException {
+ ShardingRuleConfiguration shardingRuleConfig = new
ShardingRuleConfiguration();
+
shardingRuleConfig.getTableRuleConfigs().add(getTableRuleConfiguration());
+ shardingRuleConfig.getBindingTableGroups().add("ssperf");
+ shardingRuleConfig.setDefaultDatabaseShardingStrategyConfig(new
InlineShardingStrategyConfiguration("id", "ds_${id % 2}"));
+ shardingRuleConfig.setDefaultTableShardingStrategyConfig(new
InlineShardingStrategyConfiguration("k", "ssperf${k % 1024}"));
+
shardingRuleConfig.setMasterSlaveRuleConfigs(getMasterSlaveRuleConfigurations());
+ return
ShardingDataSourceFactory.createDataSource(createMSsharingDataSourceMap(),
shardingRuleConfig, new HashMap<String, Object>(), new Properties());
+ }
+
+ /**
+ * get table rule.
+ * @return res
+ */
+ private static TableRuleConfiguration getTableRuleConfiguration() {
+ TableRuleConfiguration result = new TableRuleConfiguration();
+ result.setLogicTable("ssperf");
+ result.setActualDataNodes("ms_ds_${0..1}.ssperf${0..1023}");
+ result.setKeyGeneratorColumnName("id");
+ return result;
+ }
+
+ /**
+ * get master slave rule.
+ * @return res
+ */
+ private static List<MasterSlaveRuleConfiguration>
getMasterSlaveRuleConfigurations() {
+ MasterSlaveRuleConfiguration masterSlaveRuleConfig1 = new
MasterSlaveRuleConfiguration();
+ masterSlaveRuleConfig1.setName("ms_ds_0");
+ masterSlaveRuleConfig1.setMasterDataSourceName("ds_0");
+
masterSlaveRuleConfig1.setSlaveDataSourceNames(Arrays.asList("ds_0_slave_0"));
+ MasterSlaveRuleConfiguration masterSlaveRuleConfig2 = new
MasterSlaveRuleConfiguration();
+ masterSlaveRuleConfig2.setName("ms_ds_1");
+ masterSlaveRuleConfig2.setMasterDataSourceName("ds_1");
+
masterSlaveRuleConfig2.setSlaveDataSourceNames(Arrays.asList("ds_1_slave_0"));
+ return Lists.newArrayList(masterSlaveRuleConfig1,
masterSlaveRuleConfig2);
+ }
+
+ /**
+ * create ms sharding datasource map.
+ * @return res
+ */
+ private static Map<String, DataSource> createMSsharingDataSourceMap() {
+ final Map<String, DataSource> result = new HashMap<>();
+ result.put("ds_0", SJDataSourceUtil.createDataSource("###",
"sharding_db", "####", 3306, "####"));
+ result.put("ds_0_slave_0", SJDataSourceUtil.createDataSource("###",
"sharding_db", "####", 3306, "####"));
+ result.put("ds_1", SJDataSourceUtil.createDataSource("###",
"sharding_db", "####", 3306, "####"));
+ result.put("ds_1_slave_0", SJDataSourceUtil.createDataSource("###",
"sharding_db", "####", 3306, "####"));
+ return result;
+ }
+
+ /**
+ * create master slave datasource.
+ * @return master slave data source
+ * @throws SQLException ex
+ */
+ public static DataSource createMSDataSource() throws SQLException {
+ Map<String, DataSource> dataSourceMap = new HashMap<>();
+ dataSourceMap.put("ds_master",
SJDataSourceUtil.createDataSource("###", "sharding_db", "####", 3306, "####"));
+ dataSourceMap.put("ds_slave0",
SJDataSourceUtil.createDataSource("###", "sharding_db", "####", 3306, "####"));
+ MasterSlaveRuleConfiguration masterSlaveRuleConfig = new
MasterSlaveRuleConfiguration();
+ masterSlaveRuleConfig.setName("ds_master_slave");
+ masterSlaveRuleConfig.setMasterDataSourceName("ds_master");
+
masterSlaveRuleConfig.setSlaveDataSourceNames(Arrays.asList("ds_slave0"));
+ DataSource dataSource =
MasterSlaveDataSourceFactory.createDataSource(dataSourceMap,
masterSlaveRuleConfig, new ConcurrentHashMap(), new Properties());
+ return dataSource;
+ }
+
+}
diff --git
a/shardingsphere-benchmark/src/main/java/shardingjdbc/perf/lastversion/sjmasterslave/SJMasterSlaveDelete.java
b/shardingsphere-benchmark/src/main/java/shardingjdbc/perf/lastversion/sjmasterslave/SJMasterSlaveDelete.java
new file mode 100644
index 0000000..e954ea2
--- /dev/null
+++
b/shardingsphere-benchmark/src/main/java/shardingjdbc/perf/lastversion/sjmasterslave/SJMasterSlaveDelete.java
@@ -0,0 +1,81 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package shardingjdbc.perf.lastversion.sjmasterslave;
+
+import org.apache.jmeter.protocol.java.sampler.AbstractJavaSamplerClient;
+import org.apache.jmeter.protocol.java.sampler.JavaSamplerContext;
+import org.apache.jmeter.samplers.SampleResult;
+import perfstmt.ShardingPerfStmt;
+import service.api.service.SJPerfService;
+import service.util.config.lastversion.SJDataSourceOp;
+import service.util.config.SJDataSourceUtil;
+
+import javax.sql.DataSource;
+import java.sql.SQLException;
+
+/**
+ * for shardingjdbc master slave delete performance with version3.1.0.
+ * @author nancyzrh
+ */
+public class SJMasterSlaveDelete extends AbstractJavaSamplerClient {
+ private static final String DELETE_SQL_MASTER_SLAVE =
ShardingPerfStmt.DELETE_STMT.getValue();
+
+ private static SJPerfService sjPerfService;
+
+ private static DataSource dataSource;
+
+ static {
+ try {
+ sjPerfService = new
SJPerfService(SJDataSourceOp.createMSDataSource());
+ } catch (final SQLException ignore) {
+ }
+ }
+
+ /**
+ * setup prepare.
+ * @param context context
+ */
+ @Override
+ public void setupTest(JavaSamplerContext context) {
+ dataSource = sjPerfService.getDataSource();
+ }
+
+ /**
+ * run test.
+ * @param javaSamplerContext context
+ * @return sample result
+ */
+ @Override
+ public SampleResult runTest(JavaSamplerContext javaSamplerContext) {
+
+ SampleResult results = new SampleResult();
+ results.setSampleLabel("SJMasterSlaveDelete");
+ results.sampleStart();
+ try {
+ SJDataSourceUtil.delete(DELETE_SQL_MASTER_SLAVE, dataSource);
+ } catch (SQLException ex) {
+ results.setSuccessful(false);
+ return results;
+ } finally {
+ results.sampleEnd();
+ }
+ results.setSuccessful(true);
+ return results;
+ }
+}
+
diff --git
a/shardingsphere-benchmark/src/main/java/shardingjdbc/perf/lastversion/sjmasterslave/SJMasterSlaveInsert.java
b/shardingsphere-benchmark/src/main/java/shardingjdbc/perf/lastversion/sjmasterslave/SJMasterSlaveInsert.java
new file mode 100644
index 0000000..741649e
--- /dev/null
+++
b/shardingsphere-benchmark/src/main/java/shardingjdbc/perf/lastversion/sjmasterslave/SJMasterSlaveInsert.java
@@ -0,0 +1,81 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package shardingjdbc.perf.lastversion.sjmasterslave;
+
+import org.apache.jmeter.protocol.java.sampler.AbstractJavaSamplerClient;
+import org.apache.jmeter.protocol.java.sampler.JavaSamplerContext;
+import org.apache.jmeter.samplers.SampleResult;
+import perfstmt.ShardingPerfStmt;
+import service.api.service.SJPerfService;
+import service.util.config.lastversion.SJDataSourceOp;
+import service.util.config.SJDataSourceUtil;
+
+import javax.sql.DataSource;
+import java.sql.SQLException;
+
+/**
+ * for shardingjdbc master slave insert performance with version3.1.0.
+ * @author nancyzrh
+ */
+public class SJMasterSlaveInsert extends AbstractJavaSamplerClient {
+ private static final String INSERT_SQL_MASTER_SLAVE =
ShardingPerfStmt.INSERT_STMT.getValue();
+
+ private static SJPerfService sjPerfService;
+
+ private static DataSource dataSource;
+
+ static {
+ try {
+ sjPerfService = new
SJPerfService(SJDataSourceOp.createMSDataSource());
+ } catch (final SQLException ignore) {
+ }
+ }
+
+ /**
+ * prepare for setup.
+ * @param context context
+ */
+ @Override
+ public void setupTest(JavaSamplerContext context) {
+ dataSource = sjPerfService.getDataSource();
+ }
+
+ /**
+ * run test.
+ * @param javaSamplerContext context
+ * @return res
+ */
+ @Override
+ public SampleResult runTest(JavaSamplerContext javaSamplerContext) {
+
+ SampleResult results = new SampleResult();
+ results.setSampleLabel("SJMasterSlaveInsert");
+ results.sampleStart();
+ try {
+ SJDataSourceUtil.insert(INSERT_SQL_MASTER_SLAVE, dataSource);
+ } catch (SQLException ex) {
+ results.setSuccessful(false);
+ return results;
+ } finally {
+ results.sampleEnd();
+ }
+ results.setSuccessful(true);
+ return results;
+ }
+}
+
diff --git
a/shardingsphere-benchmark/src/main/java/shardingjdbc/perf/lastversion/sjmasterslave/SJMasterSlaveSelect.java
b/shardingsphere-benchmark/src/main/java/shardingjdbc/perf/lastversion/sjmasterslave/SJMasterSlaveSelect.java
new file mode 100644
index 0000000..bcf83bc
--- /dev/null
+++
b/shardingsphere-benchmark/src/main/java/shardingjdbc/perf/lastversion/sjmasterslave/SJMasterSlaveSelect.java
@@ -0,0 +1,81 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package shardingjdbc.perf.lastversion.sjmasterslave;
+
+import org.apache.jmeter.protocol.java.sampler.AbstractJavaSamplerClient;
+import org.apache.jmeter.protocol.java.sampler.JavaSamplerContext;
+import org.apache.jmeter.samplers.SampleResult;
+import perfstmt.ShardingPerfStmt;
+import service.api.service.SJPerfService;
+import service.util.config.lastversion.SJDataSourceOp;
+import service.util.config.SJDataSourceUtil;
+
+import javax.sql.DataSource;
+import java.sql.SQLException;
+
+/**
+ * for shardingjdbc master slave select performance with version3.1.0.
+ * @author nancyzrh
+ */
+public class SJMasterSlaveSelect extends AbstractJavaSamplerClient {
+ private static final String SELECT_SQL_MASTER_SLAVE =
ShardingPerfStmt.SELECT_STMT.getValue();
+
+ private static SJPerfService sjPerfService;
+
+ private static DataSource dataSource;
+
+ static {
+ try {
+ sjPerfService = new
SJPerfService(SJDataSourceOp.createMSDataSource());
+ } catch (final SQLException ignore) {
+ }
+ }
+
+ /**
+ * prepare setup.
+ * @param context context
+ */
+ @Override
+ public void setupTest(JavaSamplerContext context) {
+ dataSource = sjPerfService.getDataSource();
+ }
+
+ /**
+ * run test.
+ * @param javaSamplerContext context
+ * @return res
+ */
+ @Override
+ public SampleResult runTest(JavaSamplerContext javaSamplerContext) {
+
+ SampleResult results = new SampleResult();
+ results.setSampleLabel("SJPerformanceMSDelete");
+ results.sampleStart();
+ try {
+ SJDataSourceUtil.getSelect(SELECT_SQL_MASTER_SLAVE, dataSource);
+ } catch (SQLException ex) {
+ results.setSuccessful(false);
+ return results;
+ } finally {
+ results.sampleEnd();
+ }
+ results.setSuccessful(true);
+ return results;
+ }
+}
+
diff --git
a/shardingsphere-benchmark/src/main/java/shardingjdbc/perf/lastversion/sjmasterslave/SJMasterSlaveUpdate.java
b/shardingsphere-benchmark/src/main/java/shardingjdbc/perf/lastversion/sjmasterslave/SJMasterSlaveUpdate.java
new file mode 100644
index 0000000..1daadd7
--- /dev/null
+++
b/shardingsphere-benchmark/src/main/java/shardingjdbc/perf/lastversion/sjmasterslave/SJMasterSlaveUpdate.java
@@ -0,0 +1,81 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package shardingjdbc.perf.lastversion.sjmasterslave;
+
+import org.apache.jmeter.protocol.java.sampler.AbstractJavaSamplerClient;
+import org.apache.jmeter.protocol.java.sampler.JavaSamplerContext;
+import org.apache.jmeter.samplers.SampleResult;
+import perfstmt.ShardingPerfStmt;
+import service.api.service.SJPerfService;
+import service.util.config.lastversion.SJDataSourceOp;
+import service.util.config.SJDataSourceUtil;
+
+import javax.sql.DataSource;
+import java.sql.SQLException;
+
+/**
+ * for shardingjdbc master slave update performance with version3.1.0.
+ * @author nancyzrh
+ */
+public class SJMasterSlaveUpdate extends AbstractJavaSamplerClient {
+ private static final String UPDATE_SQL_MASTER_SLAVE =
ShardingPerfStmt.UPDATE_STMT.getValue();
+
+ private static SJPerfService sjPerfService;
+
+ private static DataSource dataSource;
+
+ static {
+ try {
+ sjPerfService = new
SJPerfService(SJDataSourceOp.createMSDataSource());
+ } catch (final SQLException ignore) {
+ }
+ }
+
+ /**
+ * prepare for setup.
+ * @param context context
+ */
+ @Override
+ public void setupTest(JavaSamplerContext context) {
+ dataSource = sjPerfService.getDataSource();
+ }
+
+ /**
+ * run test.
+ * @param javaSamplerContext context
+ * @return res
+ */
+ @Override
+ public SampleResult runTest(JavaSamplerContext javaSamplerContext) {
+
+ SampleResult results = new SampleResult();
+ results.setSampleLabel("SJPerformanceMSDelete");
+ results.sampleStart();
+ try {
+ SJDataSourceUtil.updateStmt(UPDATE_SQL_MASTER_SLAVE, dataSource);
+ } catch (SQLException ex) {
+ results.setSuccessful(false);
+ return results;
+ } finally {
+ results.sampleEnd();
+ }
+ results.setSuccessful(true);
+ return results;
+ }
+}
+
diff --git
a/shardingsphere-benchmark/src/main/java/shardingjdbc/perf/lastversion/sjsharding/SJShardingDelete.java
b/shardingsphere-benchmark/src/main/java/shardingjdbc/perf/lastversion/sjsharding/SJShardingDelete.java
new file mode 100644
index 0000000..ff26f09
--- /dev/null
+++
b/shardingsphere-benchmark/src/main/java/shardingjdbc/perf/lastversion/sjsharding/SJShardingDelete.java
@@ -0,0 +1,81 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package shardingjdbc.perf.lastversion.sjsharding;
+
+import org.apache.jmeter.protocol.java.sampler.AbstractJavaSamplerClient;
+import org.apache.jmeter.protocol.java.sampler.JavaSamplerContext;
+import org.apache.jmeter.samplers.SampleResult;
+import perfstmt.ShardingPerfStmt;
+import service.api.service.SJPerfService;
+import service.util.config.SJDataSourceUtil;
+import service.util.config.lastversion.SJDataSourceOp;
+
+import javax.sql.DataSource;
+import java.sql.SQLException;
+
+/**
+ * for shardingjdbc delete performace with version3.1.0.
+ * @author nancyzrh
+ */
+public class SJShardingDelete extends AbstractJavaSamplerClient {
+ private static final String DELETE_SHARDING_STMT =
ShardingPerfStmt.DELETE_STMT.getValue();
+
+ private static SJPerfService sjPerfService;
+
+ private static DataSource dataSource;
+
+ static {
+ try {
+ sjPerfService = new
SJPerfService(SJDataSourceOp.createMSDataSource());
+ } catch (final SQLException ignore) {
+ }
+ }
+
+ /**
+ * prepare for setup.
+ * @param context context
+ */
+ @Override
+ public void setupTest(JavaSamplerContext context) {
+ dataSource = sjPerfService.getDataSource();
+ }
+
+ /**
+ * run test.
+ * @param javaSamplerContext context
+ * @return res
+ */
+ @Override
+ public SampleResult runTest(JavaSamplerContext javaSamplerContext) {
+
+ SampleResult results = new SampleResult();
+ results.setSampleLabel("SJShardingDelete");
+ results.sampleStart();
+ try {
+ SJDataSourceUtil.delete(DELETE_SHARDING_STMT, dataSource);
+ } catch (SQLException ex) {
+ results.setSuccessful(false);
+ return results;
+ } finally {
+ results.sampleEnd();
+ }
+ results.setSuccessful(true);
+ return results;
+ }
+}
+
diff --git
a/shardingsphere-benchmark/src/main/java/shardingjdbc/perf/lastversion/sjsharding/SJShardingInsert.java
b/shardingsphere-benchmark/src/main/java/shardingjdbc/perf/lastversion/sjsharding/SJShardingInsert.java
new file mode 100644
index 0000000..6f68d89
--- /dev/null
+++
b/shardingsphere-benchmark/src/main/java/shardingjdbc/perf/lastversion/sjsharding/SJShardingInsert.java
@@ -0,0 +1,81 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package shardingjdbc.perf.lastversion.sjsharding;
+
+import org.apache.jmeter.protocol.java.sampler.AbstractJavaSamplerClient;
+import org.apache.jmeter.protocol.java.sampler.JavaSamplerContext;
+import org.apache.jmeter.samplers.SampleResult;
+import perfstmt.ShardingPerfStmt;
+import service.api.service.SJPerfService;
+import service.util.config.SJDataSourceUtil;
+import service.util.config.lastversion.SJDataSourceOp;
+
+import javax.sql.DataSource;
+import java.sql.SQLException;
+
+/**
+ * for shardingjdbc insert performance with version3.1.0.
+ * @author nancyzrh
+ */
+public class SJShardingInsert extends AbstractJavaSamplerClient {
+ private static final String INSERT_SHARDING_STMT =
ShardingPerfStmt.INSERT_STMT.getValue();
+
+ private static SJPerfService sjPerfService;
+
+ private static DataSource dataSource;
+
+ static {
+ try {
+ sjPerfService = new
SJPerfService(SJDataSourceOp.createMSDataSource());
+ } catch (final SQLException ignore) {
+ }
+ }
+
+ /**
+ * prepare for setup.
+ * @param context context
+ */
+ @Override
+ public void setupTest(JavaSamplerContext context) {
+ dataSource = sjPerfService.getDataSource();
+ }
+
+ /**
+ * run test.
+ * @param javaSamplerContext context
+ * @return res
+ */
+ @Override
+ public SampleResult runTest(JavaSamplerContext javaSamplerContext) {
+
+ SampleResult results = new SampleResult();
+ results.setSampleLabel("SJShardingInsert");
+ results.sampleStart();
+ try {
+ SJDataSourceUtil.insert(INSERT_SHARDING_STMT, dataSource);
+ } catch (SQLException ex) {
+ results.setSuccessful(false);
+ return results;
+ } finally {
+ results.sampleEnd();
+ }
+ results.setSuccessful(true);
+ return results;
+ }
+}
+
diff --git
a/shardingsphere-benchmark/src/main/java/shardingjdbc/perf/lastversion/sjsharding/SJShardingSelect.java
b/shardingsphere-benchmark/src/main/java/shardingjdbc/perf/lastversion/sjsharding/SJShardingSelect.java
new file mode 100644
index 0000000..56b612c
--- /dev/null
+++
b/shardingsphere-benchmark/src/main/java/shardingjdbc/perf/lastversion/sjsharding/SJShardingSelect.java
@@ -0,0 +1,80 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package shardingjdbc.perf.lastversion.sjsharding;
+
+import org.apache.jmeter.protocol.java.sampler.AbstractJavaSamplerClient;
+import org.apache.jmeter.protocol.java.sampler.JavaSamplerContext;
+import org.apache.jmeter.samplers.SampleResult;
+import perfstmt.ShardingPerfStmt;
+import service.api.service.SJPerfService;
+import service.util.config.SJDataSourceUtil;
+import service.util.config.lastversion.SJDataSourceOp;
+
+import javax.sql.DataSource;
+import java.sql.SQLException;
+
+/**
+ * for shardingjdbc select performance with version3.1.0.
+ * @author nancyzrh
+ */
+public class SJShardingSelect extends AbstractJavaSamplerClient {
+ private static final String INSERT_STMT =
ShardingPerfStmt.INSERT_STMT.getValue();
+
+ private static SJPerfService sjPerfService;
+
+ private static DataSource dataSource;
+
+ static {
+ try {
+ sjPerfService = new
SJPerfService(SJDataSourceOp.createMSDataSource());
+ } catch (final SQLException ignore) {
+ }
+ }
+
+ /**
+ * prepare setup.
+ * @param context context
+ */
+ @Override
+ public void setupTest(JavaSamplerContext context) {
+ dataSource = sjPerfService.getDataSource();
+ }
+
+ /**
+ * run test.
+ * @param javaSamplerContext context
+ * @return res
+ */
+ @Override
+ public SampleResult runTest(JavaSamplerContext javaSamplerContext) {
+ SampleResult results = new SampleResult();
+ results.setSampleLabel("SJShardingSelect");
+ results.sampleStart();
+ try {
+ SJDataSourceUtil.getSelect(INSERT_STMT, dataSource);
+ } catch (SQLException ex) {
+ results.setSuccessful(false);
+ return results;
+ } finally {
+ results.sampleEnd();
+ }
+ results.setSuccessful(true);
+ return results;
+ }
+}
+
diff --git
a/shardingsphere-benchmark/src/main/java/shardingjdbc/perf/lastversion/sjsharding/SJShardingUpdate.java
b/shardingsphere-benchmark/src/main/java/shardingjdbc/perf/lastversion/sjsharding/SJShardingUpdate.java
new file mode 100644
index 0000000..ffc9a24
--- /dev/null
+++
b/shardingsphere-benchmark/src/main/java/shardingjdbc/perf/lastversion/sjsharding/SJShardingUpdate.java
@@ -0,0 +1,81 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package shardingjdbc.perf.lastversion.sjsharding;
+
+import org.apache.jmeter.protocol.java.sampler.AbstractJavaSamplerClient;
+import org.apache.jmeter.protocol.java.sampler.JavaSamplerContext;
+import org.apache.jmeter.samplers.SampleResult;
+import perfstmt.ShardingPerfStmt;
+import service.api.service.SJPerfService;
+import service.util.config.SJDataSourceUtil;
+import service.util.config.lastversion.SJDataSourceOp;
+
+import javax.sql.DataSource;
+import java.sql.SQLException;
+
+/**
+ * for shardingjdbc update performance with version3.1.0.
+ * @author nancyzrh
+ */
+public class SJShardingUpdate extends AbstractJavaSamplerClient {
+ private static final String UPDATE_STMT =
ShardingPerfStmt.UPDATE_STMT.getValue();
+
+ private static SJPerfService sjPerfService;
+
+ private static DataSource dataSource;
+
+ static {
+ try {
+ sjPerfService = new
SJPerfService(SJDataSourceOp.createMSDataSource());
+ } catch (final SQLException ignore) {
+ }
+ }
+
+ /**
+ * prepare setup.
+ * @param context context
+ */
+ @Override
+ public void setupTest(JavaSamplerContext context) {
+ dataSource = sjPerfService.getDataSource();
+ }
+
+ /**
+ * run test.
+ * @param javaSamplerContext context
+ * @return res
+ */
+ @Override
+ public SampleResult runTest(JavaSamplerContext javaSamplerContext) {
+
+ SampleResult results = new SampleResult();
+ results.setSampleLabel("SJShardingUpdate");
+ results.sampleStart();
+ try {
+ SJDataSourceUtil.delete(UPDATE_STMT, dataSource);
+ } catch (SQLException ex) {
+ results.setSuccessful(false);
+ return results;
+ } finally {
+ results.sampleEnd();
+ }
+ results.setSuccessful(true);
+ return results;
+ }
+}
+
diff --git
a/shardingsphere-benchmark/src/main/java/shardingjdbc/perf/sjencrypt/SJEncryptDelete.java
b/shardingsphere-benchmark/src/main/java/shardingjdbc/perf/sjencrypt/SJEncryptDelete.java
new file mode 100644
index 0000000..b39b87b
--- /dev/null
+++
b/shardingsphere-benchmark/src/main/java/shardingjdbc/perf/sjencrypt/SJEncryptDelete.java
@@ -0,0 +1,81 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package shardingjdbc.perf.sjencrypt;
+
+import org.apache.jmeter.protocol.java.sampler.AbstractJavaSamplerClient;
+import org.apache.jmeter.protocol.java.sampler.JavaSamplerContext;
+import org.apache.jmeter.samplers.SampleResult;
+import perfstmt.ShardingPerfStmt;
+import service.api.service.SJPerfService;
+import service.util.config.SJDataSourceOp;
+import service.util.config.SJDataSourceUtil;
+
+import javax.sql.DataSource;
+import java.sql.SQLException;
+
+/**
+ * for shardingjdbc encrypt delete performance with ss dev branch.
+ * @author nancyzrh
+ */
+public class SJEncryptDelete extends AbstractJavaSamplerClient {
+ private static final String DELETE_ENC_STMT =
ShardingPerfStmt.DELETE_STMT.getValue();
+
+ private static SJPerfService sjPerfService;
+
+ private static DataSource dataSource;
+
+ static {
+ try {
+ sjPerfService = new
SJPerfService(SJDataSourceOp.createEncryptDataSource());
+ } catch (final SQLException ignore) {
+ }
+ }
+
+ /**
+ * prepare setup.
+ * @param context context
+ */
+ @Override
+ public void setupTest(JavaSamplerContext context) {
+ dataSource = sjPerfService.getDataSource();
+ }
+
+ /**
+ * run test.
+ * @param javaSamplerContext context
+ * @return res
+ */
+ @Override
+ public SampleResult runTest(JavaSamplerContext javaSamplerContext) {
+
+ SampleResult results = new SampleResult();
+ results.setSampleLabel("SJEncryptDelete");
+ results.sampleStart();
+ try {
+ SJDataSourceUtil.delete(DELETE_ENC_STMT, dataSource);
+ } catch (SQLException ex) {
+ results.setSuccessful(false);
+ return results;
+ } finally {
+ results.sampleEnd();
+ }
+ results.setSuccessful(true);
+ return results;
+ }
+}
+
diff --git
a/shardingsphere-benchmark/src/main/java/shardingjdbc/perf/sjencrypt/SJEncryptInsert.java
b/shardingsphere-benchmark/src/main/java/shardingjdbc/perf/sjencrypt/SJEncryptInsert.java
new file mode 100644
index 0000000..38c920a
--- /dev/null
+++
b/shardingsphere-benchmark/src/main/java/shardingjdbc/perf/sjencrypt/SJEncryptInsert.java
@@ -0,0 +1,81 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package shardingjdbc.perf.sjencrypt;
+
+import org.apache.jmeter.protocol.java.sampler.AbstractJavaSamplerClient;
+import org.apache.jmeter.protocol.java.sampler.JavaSamplerContext;
+import org.apache.jmeter.samplers.SampleResult;
+import perfstmt.ShardingPerfStmt;
+import service.api.service.SJPerfService;
+import service.util.config.SJDataSourceOp;
+import service.util.config.SJDataSourceUtil;
+
+import javax.sql.DataSource;
+import java.sql.SQLException;
+
+/**
+ * for shardingjdbc encrypt insert performance with ss dev branch.
+ */
+public class SJEncryptInsert extends AbstractJavaSamplerClient {
+ private static final String INSERT_ENC_STMT =
ShardingPerfStmt.INSERT_STMT.getValue();
+
+ private static SJPerfService sjPerfService;
+
+ private static DataSource dataSource;
+
+ static {
+ try {
+ sjPerfService = new
SJPerfService(SJDataSourceOp.createEncryptDataSource());
+ } catch (final SQLException ignore) {
+ }
+ }
+
+ /**
+ * prepare setup.
+ * @param context context
+ */
+ @Override
+ public void setupTest(JavaSamplerContext context) {
+ dataSource = sjPerfService.getDataSource();
+ }
+
+ /**
+ * run test.
+ * @param javaSamplerContext context
+ * @return res
+ */
+ @Override
+ public SampleResult runTest(JavaSamplerContext javaSamplerContext) {
+
+ SampleResult results = new SampleResult();
+ results.setSampleLabel("SJEncryptInsert");
+ results.sampleStart();
+ try {
+ SJDataSourceUtil.insert(INSERT_ENC_STMT, dataSource);
+ } catch (SQLException ex) {
+ results.setSuccessful(false);
+ return results;
+ } finally {
+ results.sampleEnd();
+ }
+ results.setSuccessful(true);
+ return results;
+ }
+}
+
+
diff --git
a/shardingsphere-benchmark/src/main/java/shardingjdbc/perf/sjencrypt/SJEncryptSelect.java
b/shardingsphere-benchmark/src/main/java/shardingjdbc/perf/sjencrypt/SJEncryptSelect.java
new file mode 100644
index 0000000..9bbc632
--- /dev/null
+++
b/shardingsphere-benchmark/src/main/java/shardingjdbc/perf/sjencrypt/SJEncryptSelect.java
@@ -0,0 +1,81 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package shardingjdbc.perf.sjencrypt;
+
+import org.apache.jmeter.protocol.java.sampler.AbstractJavaSamplerClient;
+import org.apache.jmeter.protocol.java.sampler.JavaSamplerContext;
+import org.apache.jmeter.samplers.SampleResult;
+import perfstmt.ShardingPerfStmt;
+import service.api.service.SJPerfService;
+import service.util.config.SJDataSourceOp;
+import service.util.config.SJDataSourceUtil;
+
+import javax.sql.DataSource;
+import java.sql.SQLException;
+
+/**
+ * for shardingjdbc encrypt select performance with ss dev branch.
+ * @author nancyzrh
+ */
+public class SJEncryptSelect extends AbstractJavaSamplerClient {
+ private static final String SELECT_ENC_STMT =
ShardingPerfStmt.SELECT_STMT.getValue();
+
+ private static SJPerfService sjPerfService;
+
+ private static DataSource dataSource;
+
+ static {
+ try {
+ sjPerfService = new
SJPerfService(SJDataSourceOp.createEncryptDataSource());
+ } catch (final SQLException ignore) {
+ }
+ }
+
+ /**
+ * prepare setup.
+ * @param context context
+ */
+ @Override
+ public void setupTest(JavaSamplerContext context) {
+ dataSource = sjPerfService.getDataSource();
+ }
+
+ /**
+ * run test.
+ * @param javaSamplerContext context
+ * @return res
+ */
+ @Override
+ public SampleResult runTest(JavaSamplerContext javaSamplerContext) {
+
+ SampleResult results = new SampleResult();
+ results.setSampleLabel("SJEncryptSelect");
+ results.sampleStart();
+ try {
+ SJDataSourceUtil.getSelect(SELECT_ENC_STMT, dataSource);
+ } catch (SQLException ex) {
+ results.setSuccessful(false);
+ return results;
+ } finally {
+ results.sampleEnd();
+ }
+ results.setSuccessful(true);
+ return results;
+ }
+}
+
diff --git
a/shardingsphere-benchmark/src/main/java/shardingjdbc/perf/sjencrypt/SJEncryptUpdate.java
b/shardingsphere-benchmark/src/main/java/shardingjdbc/perf/sjencrypt/SJEncryptUpdate.java
new file mode 100644
index 0000000..45777ef
--- /dev/null
+++
b/shardingsphere-benchmark/src/main/java/shardingjdbc/perf/sjencrypt/SJEncryptUpdate.java
@@ -0,0 +1,82 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package shardingjdbc.perf.sjencrypt;
+
+import org.apache.jmeter.protocol.java.sampler.AbstractJavaSamplerClient;
+import org.apache.jmeter.protocol.java.sampler.JavaSamplerContext;
+import org.apache.jmeter.samplers.SampleResult;
+import perfstmt.ShardingPerfStmt;
+import service.api.service.SJPerfService;
+import service.util.config.SJDataSourceOp;
+import service.util.config.SJDataSourceUtil;
+
+import javax.sql.DataSource;
+import java.sql.SQLException;
+
+/**
+ * for shardingjdbc encrypt update performance with ss dev branch.
+ * @author nancyzrh
+ */
+public class SJEncryptUpdate extends AbstractJavaSamplerClient {
+ private static final String UPDATE_ENC_STMT =
ShardingPerfStmt.UPDATE_STMT.getValue();
+
+ private static SJPerfService sjPerfService;
+
+ private static DataSource dataSource;
+
+ static {
+ try {
+ sjPerfService = new
SJPerfService(SJDataSourceOp.createEncryptDataSource());
+ } catch (final SQLException ignore) {
+ }
+ }
+
+ /**
+ * prepare setup.
+ * @param context context
+ */
+ @Override
+ public void setupTest(JavaSamplerContext context) {
+ dataSource = sjPerfService.getDataSource();
+ }
+
+ /**
+ * run test.
+ * @param javaSamplerContext context
+ * @return res
+ */
+ @Override
+ public SampleResult runTest(JavaSamplerContext javaSamplerContext) {
+
+ SampleResult results = new SampleResult();
+ results.setSampleLabel("SJEncryptUpdate");
+ results.sampleStart();
+ try {
+ SJDataSourceUtil.updateStmt(UPDATE_ENC_STMT, dataSource);
+ } catch (SQLException ex) {
+ results.setSuccessful(false);
+ return results;
+ } finally {
+ results.sampleEnd();
+ }
+ results.setSuccessful(true);
+ return results;
+ }
+}
+
+
diff --git
a/shardingsphere-benchmark/src/main/java/shardingjdbc/perf/sjmasterslave/SJMasterSlaveDelete.java
b/shardingsphere-benchmark/src/main/java/shardingjdbc/perf/sjmasterslave/SJMasterSlaveDelete.java
new file mode 100644
index 0000000..5a098b3
--- /dev/null
+++
b/shardingsphere-benchmark/src/main/java/shardingjdbc/perf/sjmasterslave/SJMasterSlaveDelete.java
@@ -0,0 +1,82 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package shardingjdbc.perf.sjmasterslave;
+
+import org.apache.jmeter.protocol.java.sampler.AbstractJavaSamplerClient;
+import org.apache.jmeter.protocol.java.sampler.JavaSamplerContext;
+import org.apache.jmeter.samplers.SampleResult;
+import perfstmt.ShardingPerfStmt;
+import service.api.service.SJPerfService;
+import service.util.config.SJDataSourceOp;
+import service.util.config.SJDataSourceUtil;
+
+import javax.sql.DataSource;
+import java.sql.SQLException;
+
+/**
+ * for shardingjdbc master slave delete performance with ss dev branch.
+ * @author nancyzrh
+ */
+public class SJMasterSlaveDelete extends AbstractJavaSamplerClient {
+ private static final String DELETE_SQL_MASTER_SLAVE =
ShardingPerfStmt.DELETE_STMT.getValue();
+
+ private static SJPerfService sjPerfService;
+
+ private static DataSource dataSource;
+
+ static {
+ try {
+ sjPerfService = new
SJPerfService(SJDataSourceOp.createEncryptDataSource());
+ } catch (final SQLException ignore) {
+ }
+ }
+
+ /**
+ * prepare setup.
+ * @param context context
+ */
+ @Override
+ public void setupTest(JavaSamplerContext context) {
+ dataSource = sjPerfService.getDataSource();
+ }
+
+ /**
+ * run test.
+ * @param javaSamplerContext context
+ * @return res
+ */
+ @Override
+ public SampleResult runTest(JavaSamplerContext javaSamplerContext) {
+
+ SampleResult results = new SampleResult();
+ results.setSampleLabel("SJMasterSlaveDelete");
+ results.sampleStart();
+ try {
+ SJDataSourceUtil.delete(DELETE_SQL_MASTER_SLAVE, dataSource);
+ } catch (SQLException ex) {
+ results.setSuccessful(false);
+ return results;
+ } finally {
+ results.sampleEnd();
+ }
+ results.setSuccessful(true);
+ return results;
+ }
+}
+
+
diff --git
a/shardingsphere-benchmark/src/main/java/shardingjdbc/perf/sjmasterslave/SJMasterSlaveInsert.java
b/shardingsphere-benchmark/src/main/java/shardingjdbc/perf/sjmasterslave/SJMasterSlaveInsert.java
new file mode 100644
index 0000000..ab0d40e
--- /dev/null
+++
b/shardingsphere-benchmark/src/main/java/shardingjdbc/perf/sjmasterslave/SJMasterSlaveInsert.java
@@ -0,0 +1,82 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package shardingjdbc.perf.sjmasterslave;
+
+import org.apache.jmeter.protocol.java.sampler.AbstractJavaSamplerClient;
+import org.apache.jmeter.protocol.java.sampler.JavaSamplerContext;
+import org.apache.jmeter.samplers.SampleResult;
+import perfstmt.ShardingPerfStmt;
+import service.api.service.SJPerfService;
+import service.util.config.SJDataSourceOp;
+import service.util.config.SJDataSourceUtil;
+
+import javax.sql.DataSource;
+import java.sql.SQLException;
+
+/**
+ * for shardingjdbc Master Slave insert performance with ss dev branch.
+ * @author nancyzrh
+ */
+public class SJMasterSlaveInsert extends AbstractJavaSamplerClient {
+ private static final String INSERT_SQL_MASTER_SLAVE =
ShardingPerfStmt.INSERT_STMT.getValue();
+
+ private static SJPerfService sjPerfService;
+
+ private static DataSource dataSource;
+
+ static {
+ try {
+ sjPerfService = new
SJPerfService(SJDataSourceOp.createEncryptDataSource());
+ } catch (final SQLException ignore) {
+ }
+ }
+
+ /**
+ * prepare setup.
+ * @param context context
+ */
+ @Override
+ public void setupTest(JavaSamplerContext context) {
+ dataSource = sjPerfService.getDataSource();
+ }
+
+ /**
+ * run test.
+ * @param javaSamplerContext context
+ * @return res
+ */
+ @Override
+ public SampleResult runTest(JavaSamplerContext javaSamplerContext) {
+
+ SampleResult results = new SampleResult();
+ results.setSampleLabel("SJMasterSlaveInsert");
+ results.sampleStart();
+ try {
+ SJDataSourceUtil.insert(INSERT_SQL_MASTER_SLAVE, dataSource);
+ } catch (SQLException ex) {
+ results.setSuccessful(false);
+ return results;
+ } finally {
+ results.sampleEnd();
+ }
+ results.setSuccessful(true);
+ return results;
+ }
+}
+
+
diff --git
a/shardingsphere-benchmark/src/main/java/shardingjdbc/perf/sjmasterslave/SJMasterSlaveSelect.java
b/shardingsphere-benchmark/src/main/java/shardingjdbc/perf/sjmasterslave/SJMasterSlaveSelect.java
new file mode 100644
index 0000000..8cabc88
--- /dev/null
+++
b/shardingsphere-benchmark/src/main/java/shardingjdbc/perf/sjmasterslave/SJMasterSlaveSelect.java
@@ -0,0 +1,82 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package shardingjdbc.perf.sjmasterslave;
+
+import org.apache.jmeter.protocol.java.sampler.AbstractJavaSamplerClient;
+import org.apache.jmeter.protocol.java.sampler.JavaSamplerContext;
+import org.apache.jmeter.samplers.SampleResult;
+import perfstmt.ShardingPerfStmt;
+import service.api.service.SJPerfService;
+import service.util.config.SJDataSourceOp;
+import service.util.config.SJDataSourceUtil;
+
+import javax.sql.DataSource;
+import java.sql.SQLException;
+
+/**
+ * for shardingjdbc master slave select performance with ss dev branch.
+ * @author nancyzrh
+ */
+public class SJMasterSlaveSelect extends AbstractJavaSamplerClient {
+ private static final String SELECT_SQL_MASTER_SLAVE =
ShardingPerfStmt.SELECT_STMT.getValue();
+
+ private static SJPerfService sjPerfService;
+
+ private static DataSource dataSource;
+
+ static {
+ try {
+ sjPerfService = new
SJPerfService(SJDataSourceOp.createEncryptDataSource());
+ } catch (final SQLException ignore) {
+ }
+ }
+
+ /**
+ * prepare setup.
+ * @param context context
+ */
+ @Override
+ public void setupTest(JavaSamplerContext context) {
+ dataSource = sjPerfService.getDataSource();
+ }
+
+ /**
+ * run test.
+ * @param javaSamplerContext
+ * @return
+ */
+ @Override
+ public SampleResult runTest(JavaSamplerContext javaSamplerContext) {
+
+ SampleResult results = new SampleResult();
+ results.setSampleLabel("SJMasterSlaveSelect");
+ results.sampleStart();
+ try {
+ SJDataSourceUtil.getSelect(SELECT_SQL_MASTER_SLAVE, dataSource);
+ } catch (SQLException ex) {
+ results.setSuccessful(false);
+ return results;
+ } finally {
+ results.sampleEnd();
+ }
+ results.setSuccessful(true);
+ return results;
+ }
+}
+
+
diff --git
a/shardingsphere-benchmark/src/main/java/shardingjdbc/perf/sjmasterslave/SJMasterSlaveUpdate.java
b/shardingsphere-benchmark/src/main/java/shardingjdbc/perf/sjmasterslave/SJMasterSlaveUpdate.java
new file mode 100644
index 0000000..bf04351
--- /dev/null
+++
b/shardingsphere-benchmark/src/main/java/shardingjdbc/perf/sjmasterslave/SJMasterSlaveUpdate.java
@@ -0,0 +1,82 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package shardingjdbc.perf.sjmasterslave;
+
+import org.apache.jmeter.protocol.java.sampler.AbstractJavaSamplerClient;
+import org.apache.jmeter.protocol.java.sampler.JavaSamplerContext;
+import org.apache.jmeter.samplers.SampleResult;
+import perfstmt.ShardingPerfStmt;
+import service.api.service.SJPerfService;
+import service.util.config.SJDataSourceOp;
+import service.util.config.SJDataSourceUtil;
+
+import javax.sql.DataSource;
+import java.sql.SQLException;
+
+/**
+ * for shardingjdbc master slave update performance with ss dev branch.
+ * @author nancyzrh
+ */
+public class SJMasterSlaveUpdate extends AbstractJavaSamplerClient {
+ private static final String UPDATE_SQL_MASTER_SLAVE =
ShardingPerfStmt.UPDATE_STMT.getValue();
+
+ private static SJPerfService sjPerfService;
+
+ private static DataSource dataSource;
+
+ static {
+ try {
+ sjPerfService = new
SJPerfService(SJDataSourceOp.createEncryptDataSource());
+ } catch (final SQLException ignore) {
+ }
+ }
+
+ /**
+ * prepare setup.
+ * @param context context
+ */
+ @Override
+ public void setupTest(JavaSamplerContext context) {
+ dataSource = sjPerfService.getDataSource();
+ }
+
+ /**
+ * run test.
+ * @param javaSamplerContext context
+ * @return res
+ */
+ @Override
+ public SampleResult runTest(JavaSamplerContext javaSamplerContext) {
+
+ SampleResult results = new SampleResult();
+ results.setSampleLabel("SJMasterSlaveUpdate");
+ results.sampleStart();
+ try {
+ SJDataSourceUtil.updateStmt(UPDATE_SQL_MASTER_SLAVE, dataSource);
+ } catch (SQLException ex) {
+ results.setSuccessful(false);
+ return results;
+ } finally {
+ results.sampleEnd();
+ }
+ results.setSuccessful(true);
+ return results;
+ }
+}
+
+
diff --git
a/shardingsphere-benchmark/src/main/java/shardingjdbc/perf/sjsharding/SJShardingDelete.java
b/shardingsphere-benchmark/src/main/java/shardingjdbc/perf/sjsharding/SJShardingDelete.java
new file mode 100644
index 0000000..109769b
--- /dev/null
+++
b/shardingsphere-benchmark/src/main/java/shardingjdbc/perf/sjsharding/SJShardingDelete.java
@@ -0,0 +1,82 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package shardingjdbc.perf.sjsharding;
+
+import org.apache.jmeter.protocol.java.sampler.AbstractJavaSamplerClient;
+import org.apache.jmeter.protocol.java.sampler.JavaSamplerContext;
+import org.apache.jmeter.samplers.SampleResult;
+import perfstmt.ShardingPerfStmt;
+import service.api.service.SJPerfService;
+import service.util.config.SJDataSourceOp;
+import service.util.config.SJDataSourceUtil;
+
+import javax.sql.DataSource;
+import java.sql.SQLException;
+
+/**
+ * for shardingjdbc delete performance with ss dev branch.
+ * @author nancyzrh
+ */
+public class SJShardingDelete extends AbstractJavaSamplerClient {
+ private static final String DELETE_SHARDING =
ShardingPerfStmt.DELETE_STMT.getValue();
+
+ private static SJPerfService sjPerfService;
+
+ private static DataSource dataSource;
+
+ static {
+ try {
+ sjPerfService = new
SJPerfService(SJDataSourceOp.createEncryptDataSource());
+ } catch (final SQLException ignore) {
+ }
+ }
+
+ /**
+ * prepare setup.
+ * @param context context
+ */
+ @Override
+ public void setupTest(JavaSamplerContext context) {
+ dataSource = sjPerfService.getDataSource();
+ }
+
+ /**
+ * run test.
+ * @param javaSamplerContext context
+ * @return res
+ */
+ @Override
+ public SampleResult runTest(JavaSamplerContext javaSamplerContext) {
+
+ SampleResult results = new SampleResult();
+ results.setSampleLabel("SJShardingDelete");
+ results.sampleStart();
+ try {
+ SJDataSourceUtil.delete(DELETE_SHARDING, dataSource);
+ } catch (SQLException ex) {
+ results.setSuccessful(false);
+ return results;
+ } finally {
+ results.sampleEnd();
+ }
+ results.setSuccessful(true);
+ return results;
+ }
+}
+
+
diff --git
a/shardingsphere-benchmark/src/main/java/shardingjdbc/perf/sjsharding/SJShardingInsert.java
b/shardingsphere-benchmark/src/main/java/shardingjdbc/perf/sjsharding/SJShardingInsert.java
new file mode 100644
index 0000000..8e79414
--- /dev/null
+++
b/shardingsphere-benchmark/src/main/java/shardingjdbc/perf/sjsharding/SJShardingInsert.java
@@ -0,0 +1,81 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package shardingjdbc.perf.sjsharding;
+
+import org.apache.jmeter.protocol.java.sampler.AbstractJavaSamplerClient;
+import org.apache.jmeter.protocol.java.sampler.JavaSamplerContext;
+import org.apache.jmeter.samplers.SampleResult;
+import perfstmt.ShardingPerfStmt;
+import service.api.service.SJPerfService;
+import service.util.config.SJDataSourceOp;
+import service.util.config.SJDataSourceUtil;
+
+import javax.sql.DataSource;
+import java.sql.SQLException;
+
+/**
+ * for shardingjdbc insert performance with ss dev branch.
+ * @author nancyzrh
+ */
+public class SJShardingInsert extends AbstractJavaSamplerClient {
+ private static final String INSERT_SHARDING =
ShardingPerfStmt.INSERT_STMT.getValue();
+
+ private static SJPerfService sjPerfService;
+
+ private static DataSource dataSource;
+
+ static {
+ try {
+ sjPerfService = new
SJPerfService(SJDataSourceOp.createEncryptDataSource());
+ } catch (final SQLException ignore) {
+ }
+ }
+
+ /**
+ * prepare setup.
+ * @param context context
+ */
+ @Override
+ public void setupTest(JavaSamplerContext context) {
+ dataSource = sjPerfService.getDataSource();
+ }
+
+ /**
+ * run test.
+ * @param javaSamplerContext context
+ * @return res
+ */
+ @Override
+ public SampleResult runTest(JavaSamplerContext javaSamplerContext) {
+
+ SampleResult results = new SampleResult();
+ results.setSampleLabel("SJShardingInsert");
+ results.sampleStart();
+ try {
+ SJDataSourceUtil.insert(INSERT_SHARDING, dataSource);
+ } catch (SQLException ex) {
+ results.setSuccessful(false);
+ return results;
+ } finally {
+ results.sampleEnd();
+ }
+ results.setSuccessful(true);
+ return results;
+ }
+}
+
diff --git
a/shardingsphere-benchmark/src/main/java/shardingjdbc/perf/sjsharding/SJShardingSelect.java
b/shardingsphere-benchmark/src/main/java/shardingjdbc/perf/sjsharding/SJShardingSelect.java
new file mode 100644
index 0000000..1571689
--- /dev/null
+++
b/shardingsphere-benchmark/src/main/java/shardingjdbc/perf/sjsharding/SJShardingSelect.java
@@ -0,0 +1,82 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package shardingjdbc.perf.sjsharding;
+
+import org.apache.jmeter.protocol.java.sampler.AbstractJavaSamplerClient;
+import org.apache.jmeter.protocol.java.sampler.JavaSamplerContext;
+import org.apache.jmeter.samplers.SampleResult;
+import perfstmt.ShardingPerfStmt;
+import service.api.service.SJPerfService;
+import service.util.config.SJDataSourceOp;
+import service.util.config.SJDataSourceUtil;
+
+import javax.sql.DataSource;
+import java.sql.SQLException;
+
+/**
+ * for shardingjdbc select performance with ss dev branch.
+ * @author nancyzrh
+ */
+public class SJShardingSelect extends AbstractJavaSamplerClient {
+ private static final String SELECT_SHARDING =
ShardingPerfStmt.SELECT_STMT.getValue();
+
+ private static SJPerfService sjPerfService;
+
+ private static DataSource dataSource;
+
+ static {
+ try {
+ sjPerfService = new
SJPerfService(SJDataSourceOp.createEncryptDataSource());
+ } catch (final SQLException ignore) {
+ }
+ }
+
+ /**
+ * prepare setup.
+ * @param context context
+ */
+ @Override
+ public void setupTest(JavaSamplerContext context) {
+ dataSource = sjPerfService.getDataSource();
+ }
+
+ /**
+ * run test.
+ * @param javaSamplerContext context
+ * @return res
+ */
+ @Override
+ public SampleResult runTest(JavaSamplerContext javaSamplerContext) {
+
+ SampleResult results = new SampleResult();
+ results.setSampleLabel("SJShardingSelect");
+ results.sampleStart();
+ try {
+ SJDataSourceUtil.getSelect(SELECT_SHARDING, dataSource);
+ } catch (SQLException ex) {
+ results.setSuccessful(false);
+ return results;
+ } finally {
+ results.sampleEnd();
+ }
+ results.setSuccessful(true);
+ return results;
+ }
+}
+
+
diff --git
a/shardingsphere-benchmark/src/main/java/shardingjdbc/perf/sjsharding/SJShardingUpdate.java
b/shardingsphere-benchmark/src/main/java/shardingjdbc/perf/sjsharding/SJShardingUpdate.java
new file mode 100644
index 0000000..a0050a6
--- /dev/null
+++
b/shardingsphere-benchmark/src/main/java/shardingjdbc/perf/sjsharding/SJShardingUpdate.java
@@ -0,0 +1,82 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package shardingjdbc.perf.sjsharding;
+
+import org.apache.jmeter.protocol.java.sampler.AbstractJavaSamplerClient;
+import org.apache.jmeter.protocol.java.sampler.JavaSamplerContext;
+import org.apache.jmeter.samplers.SampleResult;
+import perfstmt.ShardingPerfStmt;
+import service.api.service.SJPerfService;
+import service.util.config.SJDataSourceOp;
+import service.util.config.SJDataSourceUtil;
+
+import javax.sql.DataSource;
+import java.sql.SQLException;
+
+/**
+ * for shardingjdbc update performance with ss dev branch.
+ * @author nancyzrh
+ */
+public class SJShardingUpdate extends AbstractJavaSamplerClient {
+ private static final String UPDATE_SHARDING =
ShardingPerfStmt.UPDATE_STMT.getValue();
+
+ private static SJPerfService sjPerfService;
+
+ private static DataSource dataSource;
+
+ static {
+ try {
+ sjPerfService = new
SJPerfService(SJDataSourceOp.createEncryptDataSource());
+ } catch (final SQLException ignore) {
+ }
+ }
+
+ /**
+ * prepare setup.
+ * @param context context
+ */
+ @Override
+ public void setupTest(JavaSamplerContext context) {
+ dataSource = sjPerfService.getDataSource();
+ }
+
+ /**
+ * run test.
+ * @param javaSamplerContext context
+ * @return res
+ */
+ @Override
+ public SampleResult runTest(JavaSamplerContext javaSamplerContext) {
+
+ SampleResult results = new SampleResult();
+ results.setSampleLabel("SJShardingUpdate");
+ results.sampleStart();
+ try {
+ SJDataSourceUtil.updateStmt(UPDATE_SHARDING, dataSource);
+ } catch (SQLException ex) {
+ results.setSuccessful(false);
+ return results;
+ } finally {
+ results.sampleEnd();
+ }
+ results.setSuccessful(true);
+ return results;
+ }
+}
+
+
diff --git
a/shardingsphere-benchmark/src/main/java/shardingproxy/perf/spencrypt/SPEncryptDelete.java
b/shardingsphere-benchmark/src/main/java/shardingproxy/perf/spencrypt/SPEncryptDelete.java
new file mode 100644
index 0000000..bb6a06a
--- /dev/null
+++
b/shardingsphere-benchmark/src/main/java/shardingproxy/perf/spencrypt/SPEncryptDelete.java
@@ -0,0 +1,80 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package shardingproxy.perf.spencrypt;
+
+import org.apache.jmeter.config.Arguments;
+import org.apache.jmeter.protocol.java.sampler.AbstractJavaSamplerClient;
+import org.apache.jmeter.protocol.java.sampler.JavaSamplerContext;
+import org.apache.jmeter.samplers.SampleResult;
+import perfstmt.ShardingPerfStmt;
+import service.util.config.SPDataSourceUtil;
+
+import java.sql.SQLException;
+
+/**
+ * encrypt delete performance for sharding proxy.
+ * @author nancyzrh
+ */
+public class SPEncryptDelete extends AbstractJavaSamplerClient {
+ private static final String DELETE_STMT =
ShardingPerfStmt.DELETE_STMT.getValue();
+
+ static {
+ SPDataSourceUtil.createDataSource("###", "sharding_db", "###", 3307,
"###");
+ }
+
+ /**
+ * get default params.
+ * @return null
+ */
+ @Override
+ public Arguments getDefaultParameters() {
+ return null;
+ }
+
+ /**
+ * setup.
+ * @param context context
+ */
+ @Override
+ public void setupTest(JavaSamplerContext context) {
+ }
+
+ /**
+ * run test.
+ * @param context context
+ * @return sample res
+ */
+ @Override
+ public SampleResult runTest(JavaSamplerContext context) {
+ SampleResult results = new SampleResult();
+ results.setSampleLabel("SPEncryptDelete");
+ results.sampleStart();
+ try {
+ SPDataSourceUtil.deleteIou(DELETE_STMT, "sharding_db");
+ } catch (SQLException ex) {
+ results.setSuccessful(false);
+ return results;
+ } finally {
+ results.sampleEnd();
+ }
+ results.setSuccessful(true);
+ return results;
+ }
+}
+
+
diff --git
a/shardingsphere-benchmark/src/main/java/shardingproxy/perf/spencrypt/SPEncryptInsert.java
b/shardingsphere-benchmark/src/main/java/shardingproxy/perf/spencrypt/SPEncryptInsert.java
new file mode 100644
index 0000000..bd881a2
--- /dev/null
+++
b/shardingsphere-benchmark/src/main/java/shardingproxy/perf/spencrypt/SPEncryptInsert.java
@@ -0,0 +1,78 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package shardingproxy.perf.spencrypt;
+
+import org.apache.jmeter.config.Arguments;
+import org.apache.jmeter.protocol.java.sampler.AbstractJavaSamplerClient;
+import org.apache.jmeter.protocol.java.sampler.JavaSamplerContext;
+import org.apache.jmeter.samplers.SampleResult;
+import perfstmt.ShardingPerfStmt;
+import service.util.config.SPDataSourceUtil;
+
+import java.sql.SQLException;
+
+/**
+ * encrypt insert for sharding proxy.
+ * @author nancyzrh
+ */
+public class SPEncryptInsert extends AbstractJavaSamplerClient {
+ private static final String INSERT_STMT =
ShardingPerfStmt.INSERT_STMT.getValue();
+
+ static {
+ SPDataSourceUtil.createDataSource("###", "sharding_db", "###", 3307,
"###");
+ }
+
+ /**
+ * get default params.
+ * @return null
+ */
+ @Override
+ public Arguments getDefaultParameters() {
+ return null;
+ }
+
+ /**
+ * setup.
+ * @param context context
+ */
+ @Override
+ public void setupTest(JavaSamplerContext context) {
+ }
+
+ /**
+ * run test.
+ * @param context context
+ * @return sample res
+ */
+ @Override
+ public SampleResult runTest(JavaSamplerContext context) {
+ SampleResult results = new SampleResult();
+ results.setSampleLabel("SPEncryptInsert");
+ results.sampleStart();
+ try {
+ SPDataSourceUtil.insertIou(INSERT_STMT, "sharding_db");
+ } catch (SQLException ex) {
+ results.setSuccessful(false);
+ return results;
+ } finally {
+ results.sampleEnd();
+ }
+ results.setSuccessful(true);
+ return results;
+ }
+}
diff --git
a/shardingsphere-benchmark/src/main/java/shardingproxy/perf/spencrypt/SPEncryptSelect.java
b/shardingsphere-benchmark/src/main/java/shardingproxy/perf/spencrypt/SPEncryptSelect.java
new file mode 100644
index 0000000..c4faafa
--- /dev/null
+++
b/shardingsphere-benchmark/src/main/java/shardingproxy/perf/spencrypt/SPEncryptSelect.java
@@ -0,0 +1,79 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package shardingproxy.perf.spencrypt;
+
+import org.apache.jmeter.config.Arguments;
+import org.apache.jmeter.protocol.java.sampler.AbstractJavaSamplerClient;
+import org.apache.jmeter.protocol.java.sampler.JavaSamplerContext;
+import org.apache.jmeter.samplers.SampleResult;
+import perfstmt.ShardingPerfStmt;
+import service.util.config.SPDataSourceUtil;
+
+import java.sql.SQLException;
+
+/**
+ * encrypt select performance for sharding proxy.
+ * @author nancyzrh
+ */
+public class SPEncryptSelect extends AbstractJavaSamplerClient {
+ private static final String SELECT_STMT =
ShardingPerfStmt.SELECT_STMT.getValue();
+
+ static {
+ SPDataSourceUtil.createDataSource("###", "sharding_db", "###", 3307,
"###");
+ }
+
+ /**
+ * get default params.
+ * @return null
+ */
+ @Override
+ public Arguments getDefaultParameters() {
+ return null;
+ }
+
+ /**
+ * setup.
+ * @param context context
+ */
+ @Override
+ public void setupTest(JavaSamplerContext context) {
+ }
+
+ /**
+ * run test.
+ * @param context context
+ * @return sample res
+ */
+ @Override
+ public SampleResult runTest(JavaSamplerContext context) {
+ SampleResult results = new SampleResult();
+ results.setSampleLabel("SPEncryptSelect");
+ results.sampleStart();
+ try {
+ SPDataSourceUtil.getIou(SELECT_STMT, "sharding_db");
+ } catch (SQLException ex) {
+ results.setSuccessful(false);
+ return results;
+ } finally {
+ results.sampleEnd();
+ }
+ results.setSuccessful(true);
+ return results;
+ }
+}
+
diff --git
a/shardingsphere-benchmark/src/main/java/shardingproxy/perf/spencrypt/SPEncryptUpdate.java
b/shardingsphere-benchmark/src/main/java/shardingproxy/perf/spencrypt/SPEncryptUpdate.java
new file mode 100644
index 0000000..31b997d
--- /dev/null
+++
b/shardingsphere-benchmark/src/main/java/shardingproxy/perf/spencrypt/SPEncryptUpdate.java
@@ -0,0 +1,80 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package shardingproxy.perf.spencrypt;
+
+import org.apache.jmeter.config.Arguments;
+import org.apache.jmeter.protocol.java.sampler.AbstractJavaSamplerClient;
+import org.apache.jmeter.protocol.java.sampler.JavaSamplerContext;
+import org.apache.jmeter.samplers.SampleResult;
+import perfstmt.ShardingPerfStmt;
+import service.util.config.SPDataSourceUtil;
+
+import java.sql.SQLException;
+
+/**
+ * sharding proxy update for encrypt.
+ * @author nancyzrh
+ *
+ */
+public class SPEncryptUpdate extends AbstractJavaSamplerClient {
+ private static final String UPDATE_STMT =
ShardingPerfStmt.UPDATE_STMT.getValue();
+
+ static {
+ SPDataSourceUtil.createDataSource("###", "sharding_db", "###", 3307,
"###");
+ }
+
+ /**
+ * get default params.
+ * @return null
+ */
+ @Override
+ public Arguments getDefaultParameters() {
+ return null;
+ }
+
+ /**
+ * setup.
+ * @param context context
+ */
+ @Override
+ public void setupTest(JavaSamplerContext context) {
+ }
+
+ /**
+ * run test.
+ * @param context context
+ * @return sample res
+ */
+ @Override
+ public SampleResult runTest(JavaSamplerContext context) {
+ SampleResult results = new SampleResult();
+ results.setSampleLabel("SPEncryptUpdate");
+ results.sampleStart();
+ try {
+ SPDataSourceUtil.updateStmt(UPDATE_STMT, "sharding_db");
+ } catch (SQLException ex) {
+ results.setSuccessful(false);
+ return results;
+ } finally {
+ results.sampleEnd();
+ }
+ results.setSuccessful(true);
+ return results;
+ }
+}
+