[关闭]
@aloxc 2017-12-05T06:20:59.000000Z 字数 16436 阅读 788

ignite的cache性能测试

ignite cache


如题,这段时间在研究ignite,看样子ignite还是挺好的一东西,但是做这几天做了cache功能的性能测试,发现一些问题,
1、嵌入式(clientMode=false,且只在java中使用start方法内嵌启动ignite)性能还行吧
2、本地模式(clientMode=true,且在测试机器上独立的启动一个ignite服务,windows执行bin/ignite.bat,linux执行bin/ignite.sh,并且在此测试机器上运行性能测试的java代码)性能差很多。
3、集群模式(clientMode=true,独立在两台机器上启动ignite服务,在第三台机器上运行性能测试代码)性能一样的差。

这些测试对应的其它配置为
1. 缓存配置:关闭备注backups=0
2. 缓存配置:不限制堆外内存大小OffHeapMaxMemory=0
3. 缓存配置:初始化缓存容量大小 StartSize = 300 * 1024 *1024
4. 缓存配置:禁用交换存储空间swapEnabled=false
5. 部署模式设置为DeploymentMode=SHARED
6. 对等类加载PeerClassLoadingEnabled=true

每次每项测试完毕后清空缓存,每项做20次测试后取平均值,测试数据量分别为5000,10000,20000,50000,100000,测试线程分别为1线程,10线程,20线程,50线程,100线程,200线程。测试方法为总数据量除以线程数就是每线程需要测试的数据量,测试开始时间为startTime,每项操作的所有线程执行完毕的时间为endTime,spendTime=endTime-startTime,所有20次测试的spendTime相加后除以20,得到平均操作时间avgSpendTime,再用总数据量除以avgSpendTime得出每秒能执行的次数。

经过几论测试下来,得到下面这些数据,从数据看出,ignite的cache功能根本无法用于线上服务(嵌入式基本上没什么用),无法做OLTP的补充。

本地windows机器配置:
intel 奔腾 G2030,win7 64bit,8GB ram,180G intel 320 ssd with sata2,
linux机器配置(3台):
intel 至强 E5606,centos release 6.2 final 64bit 2.6.32内核,4GB ram,xxG sas,

以下测试结果的数字是指每秒能执行的次数,

1.本地嵌入式模式(windows7下面,不启动独立服务,设置clientMode=false)

本地嵌入式
config.txt

  1. thread_count=1,10,20,50,100,200
  2. data_count=5000,10000,20000,50000,100000
  3. show_log=false
  4. test_count=20
  5. client_mode=0
  6. is_avg_time=false
  7. spi_windows=127.0.0.1:47500..47509
  8. spi_linux=172.31.16.68:47500..47509,172.31.16.69:47500..47509

2.本地模式(windows7下面,启动一个独立的ignite服务并在当前机器上启动测试代码)

本地
config.txt

  1. thread_count=1,10,20,50,100,200
  2. data_count=5000,10000,20000,50000,100000
  3. show_log=false
  4. test_count=20
  5. client_mode=1
  6. is_avg_time=false
  7. spi_windows=127.0.0.1:47500..47509
  8. spi_linux=172.31.16.68:47500..47509,172.31.16.69:47500..47509

3.linux嵌入式模式(linux下,不启动独立服务,设置clientMode=false)

linux嵌入式
config.txt

  1. thread_count=1,10,20,50,100,200
  2. data_count=5000,10000,20000,50000,100000
  3. show_log=false
  4. test_count=20
  5. client_mode=0
  6. is_avg_time=false
  7. spi_windows=127.0.0.1:47500..47509
  8. spi_linux=172.31.16.68:47500..47509,172.31.16.69:47500..47509

4.linux本地模式(linux下,启动一个独立的ignite服务并在当前机器上启动测试代码)

linux本地
config.txt

  1. thread_count=1,10,20,50,100,200
  2. data_count=5000,10000,20000,50000,100000
  3. show_log=false
  4. test_count=20
  5. client_mode=1
  6. is_avg_time=false
  7. spi_windows=127.0.0.1:47500..47509
  8. spi_linux=172.31.16.68:47500..47509,172.31.16.69:47500..47509

5.linux集群2服务节点模式(linux下,分别在两台linux服务器上启动一个独立的ignite服务,在第三台上启动测试代码)

linux集群2服务节点
config.txt

  1. thread_count=1,10,20,50,100,200
  2. data_count=5000,10000,20000,50000,100000
  3. show_log=false
  4. test_count=20
  5. client_mode=2
  6. is_avg_time=false
  7. spi_windows=127.0.0.1:47500..47509
  8. spi_linux=172.31.16.68:47500..47509,172.31.16.69:47500..47509

6.linux集群1服务节点模式(linux下,在一台linux服务器上启动一个独立的ignite服务,在第二台上启动测试代码)

linux集群1服务节点
config.txt

  1. thread_count=1,10,20,50,100,200
  2. data_count=5000,10000,20000,50000,100000
  3. show_log=false
  4. test_count=20
  5. client_mode=2
  6. is_avg_time=false
  7. spi_windows=127.0.0.1:47500..47509
  8. spi_linux=172.31.16.68:47500..47509

补充下:测试的缓存类型key为Integer,value为下面这个bean的实例。每次操作的key和value都不一样,下面是所有测试代码,
IgniteBenchmark2.java

  1. package com.github.aloxc.ignite.benchmark;
  2. import org.apache.commons.logging.Log;
  3. import org.apache.commons.logging.LogFactory;
  4. import org.apache.ignite.Ignite;
  5. import org.apache.ignite.IgniteCache;
  6. import org.apache.ignite.Ignition;
  7. import org.apache.ignite.cache.CacheMode;
  8. import org.apache.ignite.configuration.CacheConfiguration;
  9. import org.apache.ignite.configuration.DeploymentMode;
  10. import org.apache.ignite.configuration.IgniteConfiguration;
  11. import org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi;
  12. import org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder;
  13. import org.apache.poi.hssf.usermodel.*;
  14. import org.apache.poi.ss.usermodel.CellStyle;
  15. import org.apache.poi.ss.usermodel.IndexedColors;
  16. import java.io.File;
  17. import java.io.FileInputStream;
  18. import java.io.FileOutputStream;
  19. import java.sql.Timestamp;
  20. import java.util.*;
  21. import java.util.concurrent.CountDownLatch;
  22. /**
  23. * Created by Administrator on 2016/12/9.
  24. */
  25. public class IgniteBenchmark2 {
  26. private static Log logger = LogFactory.getLog(IgniteBenchmark2.class);
  27. //测试的数据行数
  28. private static int[] DATA_COUNT_ARRAY;
  29. private static int[] THREAD_COUNT_ARRAY;
  30. private static boolean isWindows = false;
  31. private static final String CACHE_NAME = "benchmark2";
  32. private static Ignite IGNITE;
  33. private static IgniteCache<Integer, BenchmarkUser> CACHE;
  34. private Map<Integer, Set<Integer>> keyMap = null;
  35. private Map<Integer, Map<Integer, BenchmarkUser>> valueMap = null;
  36. private static int TEST_COUNT = 0;
  37. private static int CLIENT_MODE = 0;//0:嵌入式,1:本地,2,集群
  38. private static boolean IS_AVG_TIME = false;
  39. private static List<String> IP_LIST = null;
  40. private static String outPath;
  41. private static boolean SHOW_LOG = false;
  42. static {
  43. Properties props = System.getProperties(); //获得系统属性集
  44. String osName = props.getProperty("os.name"); //操作系统名称
  45. if (osName.toLowerCase().contains("windows")) {
  46. isWindows = true;
  47. }
  48. }
  49. public static void main(String[] args) {
  50. logger.error("开始测试benchmark2");
  51. try {
  52. File file;
  53. if (isWindows) {
  54. file = new File("D:\\ideaprojects\\ignite-examples\\config\\config.txt");
  55. outPath = "D:/log/ignite-benchmark-windows";
  56. } else {
  57. file = new File("/usr/java/ignitebenchmark/config.txt");
  58. outPath = "/usr/java/ignitebenchmark/ignite-benchmark-linux";
  59. }
  60. if (!file.exists()) {
  61. logger.error("config文件不存在,退出程序 " + file.getAbsolutePath());
  62. System.exit(1);
  63. } else {
  64. Properties properties = new Properties();
  65. properties.load(new FileInputStream(file));
  66. String[] infos = properties.getProperty("data_count").split(",");
  67. DATA_COUNT_ARRAY = new int[infos.length];
  68. for (int i = 0; i < infos.length; i++) {
  69. DATA_COUNT_ARRAY[i] = Integer.parseInt(infos[i]);
  70. }
  71. CLIENT_MODE = Integer.parseInt(properties.getProperty("client_mode"));
  72. infos = properties.getProperty("thread_count").split(",");
  73. THREAD_COUNT_ARRAY = new int[infos.length];
  74. for (int i = 0; i < infos.length; i++) {
  75. THREAD_COUNT_ARRAY[i] = Integer.parseInt(infos[i]);
  76. }
  77. IgniteConfiguration cfg = new IgniteConfiguration();
  78. if(CLIENT_MODE == 0 ) {
  79. cfg.setClientMode(false);
  80. outPath += "-嵌入式";
  81. }else{
  82. cfg.setClientMode(true);
  83. TcpDiscoverySpi spi = new TcpDiscoverySpi();
  84. TcpDiscoveryVmIpFinder ipFinder = new TcpDiscoveryVmIpFinder();
  85. if(CLIENT_MODE == 1){
  86. ipFinder.setAddresses(Arrays.asList("127.0.0.1:47500..47509".split(",")));
  87. outPath += "-本地";
  88. }else if(CLIENT_MODE == 2){
  89. outPath += "-集群";
  90. if (isWindows) {
  91. ipFinder.setAddresses(Arrays.asList(properties.getProperty("spi_windows").split(",")));
  92. } else {
  93. ipFinder.setAddresses(Arrays.asList(properties.getProperty("spi_linux").split(",")));
  94. }
  95. }
  96. spi.setIpFinder(ipFinder);
  97. cfg.setDiscoverySpi(spi);
  98. }
  99. CacheConfiguration cacheConfiguration = new CacheConfiguration<String, DataClass>();
  100. cacheConfiguration.setCacheMode(CacheMode.PARTITIONED);//分区
  101. cacheConfiguration.setBackups(0);//关闭备份
  102. //cacheConfiguration.setOffHeapMaxMemory(0);//不限制堆外内存大小
  103. cacheConfiguration.setStartSize(3 * 1024 *1024);//初始化缓存容量大小,类似于hashmap的size
  104. cacheConfiguration.setSwapEnabled(false);//禁用交换存储
  105. cfg.setCacheConfiguration(cacheConfiguration);
  106. cfg.setDeploymentMode(DeploymentMode.SHARED);
  107. cfg.setPeerClassLoadingEnabled(true);
  108. TEST_COUNT = Integer.parseInt(properties.getProperty("test_count"));
  109. SHOW_LOG = Boolean.parseBoolean(properties.getProperty("show_log"));
  110. IS_AVG_TIME = Boolean.parseBoolean(properties.getProperty("is_avg_time"));
  111. if(IS_AVG_TIME){
  112. outPath += "-取平均时间";
  113. }else{
  114. outPath += "-取总时间";
  115. }
  116. outPath += ".xls";
  117. IGNITE = Ignition.start(cfg);
  118. CACHE = IGNITE.getOrCreateCache(CACHE_NAME);
  119. }
  120. logger.error("资源初始化完毕" + CLIENT_MODE);
  121. new IgniteBenchmark2().test();
  122. } catch (Exception e) {
  123. e.printStackTrace();
  124. } finally {
  125. logger.error("程序运行完毕,删除缓存");
  126. IGNITE.destroyCache(CACHE_NAME);
  127. System.exit(1);
  128. }
  129. }
  130. private void test() throws Exception {
  131. HSSFWorkbook wb = new HSSFWorkbook();
  132. HSSFSheet sheet = wb.createSheet();
  133. HSSFRow row = null;
  134. HSSFCell cell = null;
  135. int rowIndex = 0;
  136. int cellIndex = 0;
  137. HSSFCellStyle threadActionStyle = wb.createCellStyle();
  138. threadActionStyle.setFillForegroundColor(IndexedColors.LIGHT_CORNFLOWER_BLUE.getIndex());
  139. threadActionStyle.setFillPattern(CellStyle.SOLID_FOREGROUND);
  140. HSSFCellStyle dataCountStyle = wb.createCellStyle();
  141. dataCountStyle.setFillForegroundColor(IndexedColors.LIGHT_ORANGE.getIndex());
  142. dataCountStyle.setFillPattern(CellStyle.SOLID_FOREGROUND);
  143. for (int dataIndex = 0; dataIndex < DATA_COUNT_ARRAY.length; dataIndex++) {
  144. int cellI = 0;
  145. int dataCount = DATA_COUNT_ARRAY[dataIndex];
  146. row = sheet.createRow(rowIndex++);//数据量和线程行
  147. cell = row.createCell(0);
  148. cell.setCellValue("总数据量" + dataCount);
  149. cell.setCellStyle(dataCountStyle);
  150. cellIndex = 0;
  151. for (int threadIndex = 0; threadIndex < THREAD_COUNT_ARRAY.length; threadIndex++) {
  152. int threadCount = THREAD_COUNT_ARRAY[threadIndex];
  153. cellIndex++;
  154. cell = row.createCell(cellIndex);
  155. cell.setCellValue(threadCount + "线程");
  156. cell.setCellStyle(threadActionStyle);
  157. }
  158. row = sheet.createRow(rowIndex++);//写入行
  159. cell = row.createCell(0);
  160. cell.setCellValue("写入");
  161. cell.setCellStyle(threadActionStyle);
  162. row = sheet.createRow(rowIndex++);//读取行
  163. cell = row.createCell(0);
  164. cell.setCellValue("读取");
  165. cell.setCellStyle(threadActionStyle);
  166. row = sheet.createRow(rowIndex++);//批量写入行
  167. cell = row.createCell(0);
  168. cell.setCellValue("批量写入");
  169. cell.setCellStyle(threadActionStyle);
  170. row = sheet.createRow(rowIndex++);//批量读取行
  171. cell = row.createCell(0);
  172. cell.setCellValue("批量读取");
  173. cell.setCellStyle(threadActionStyle);
  174. rowIndex++;
  175. }
  176. for (int i = 0; i < THREAD_COUNT_ARRAY.length + 1; i++) {
  177. sheet.setColumnWidth(i, 256 * 15);
  178. }
  179. int preThreadCount = 1;
  180. int preDataCount = 50000;
  181. keyMap = new HashMap<>(preThreadCount);
  182. valueMap = new HashMap<>(preThreadCount);
  183. genObject(preThreadCount, preDataCount);
  184. new WriteThread(0, null, false, valueMap.get(0),"测试写").run();
  185. new ReadThread(0, null, false, keyMap.get(0),"测试读").run();
  186. Thread.sleep(5000);
  187. for (int dataIndex = 0; dataIndex < DATA_COUNT_ARRAY.length; dataIndex++) {
  188. int dataCount = DATA_COUNT_ARRAY[dataIndex];
  189. final int baseRowIndex = dataIndex * 6;//
  190. for (int threadIndex = 0; threadIndex < THREAD_COUNT_ARRAY.length; threadIndex++) {
  191. int threadCount = THREAD_COUNT_ARRAY[threadIndex];
  192. keyMap = new HashMap<>(threadCount);
  193. valueMap = new HashMap<>(threadCount);
  194. genObject(threadCount, dataCount);
  195. logger.error("开始benchmark测试,threadCount=" + threadCount + "\tdataCount=" + dataCount);
  196. float[] spends = new float[4];
  197. for (int ti = 0; ti < TEST_COUNT; ti++) {
  198. CACHE.removeAll();
  199. float avgSpend = 0f;
  200. WriteThread[] writeThreads = new WriteThread[threadCount];
  201. CountDownLatch latch = new CountDownLatch(threadCount);
  202. float interval;
  203. float tpms;
  204. long start = System.currentTimeMillis();
  205. for (int i = 0; i < writeThreads.length; i++) {
  206. writeThreads[i] = new WriteThread(i, latch, false, valueMap.get(i),"[写线程-" + i + "]");
  207. writeThreads[i].start();
  208. }
  209. latch.await();
  210. long end = System.currentTimeMillis();
  211. if (IS_AVG_TIME) {
  212. avgSpend = 0f;
  213. for (int i = 0; i < writeThreads.length; i++) {
  214. avgSpend += writeThreads[i].getSpend();
  215. }
  216. avgSpend = avgSpend / writeThreads.length;
  217. spends[0] += avgSpend;
  218. } else {
  219. spends[0] += end - start;
  220. }
  221. Thread.sleep(50);
  222. ReadThread[] readThreads = new ReadThread[threadCount];
  223. latch = new CountDownLatch(threadCount);
  224. start = System.currentTimeMillis();
  225. for (int i = 0; i < readThreads.length; i++) {
  226. readThreads[i] = new ReadThread(i, latch, false, keyMap.get(i),"[读线程-" + i + "]");
  227. readThreads[i].start();
  228. }
  229. latch.await();
  230. end = System.currentTimeMillis();
  231. if (IS_AVG_TIME) {
  232. avgSpend = 0f;
  233. for (int i = 0; i < readThreads.length; i++) {
  234. avgSpend += readThreads[i].getSpend();
  235. }
  236. avgSpend = avgSpend / writeThreads.length;
  237. spends[1] += avgSpend;
  238. } else {
  239. spends[1] += end - start;
  240. }
  241. CACHE.removeAll();
  242. Thread.sleep(50);
  243. latch = new CountDownLatch(threadCount);
  244. start = System.currentTimeMillis();
  245. for (int i = 0; i < writeThreads.length; i++) {
  246. writeThreads[i] = new WriteThread(i, latch, true, valueMap.get(i),"[批量写线程-" + i + "]");
  247. writeThreads[i].start();
  248. }
  249. latch.await();
  250. end = System.currentTimeMillis();
  251. if (IS_AVG_TIME) {
  252. avgSpend = 0f;
  253. for (int i = 0; i < writeThreads.length; i++) {
  254. avgSpend += writeThreads[i].getSpend();
  255. }
  256. avgSpend = avgSpend / writeThreads.length;
  257. spends[2] += avgSpend;
  258. } else {
  259. spends[2] += end - start;
  260. }
  261. Thread.sleep(50);
  262. latch = new CountDownLatch(threadCount);
  263. start = System.currentTimeMillis();
  264. for (int i = 0; i < readThreads.length; i++) {
  265. readThreads[i] = new ReadThread(i, latch, true, keyMap.get(i),"[批量读线程-" + i + "]");
  266. readThreads[i].start();
  267. }
  268. latch.await();
  269. end = System.currentTimeMillis();
  270. if (IS_AVG_TIME) {
  271. avgSpend = 0f;
  272. for (int i = 0; i < readThreads.length; i++) {
  273. avgSpend += readThreads[i].getSpend();
  274. }
  275. avgSpend = avgSpend / writeThreads.length;
  276. spends[3] += avgSpend;
  277. } else {
  278. spends[3] += end - start;
  279. }
  280. }
  281. rowIndex = baseRowIndex + 1;
  282. cellIndex = threadIndex + 1;
  283. for (int i = 0; i < spends.length; i++) {
  284. row = sheet.getRow(rowIndex++);
  285. cell = row.createCell(cellIndex);
  286. float avgSpend = spends[i] / 1000L;
  287. avgSpend /= TEST_COUNT;
  288. cell.setCellValue(Math.ceil(dataCount / avgSpend));
  289. }
  290. }
  291. }
  292. logger.error("测试完毕,准备输出测试结果到[" + outPath + "]");
  293. FileOutputStream out = new FileOutputStream(outPath);
  294. wb.write(out);
  295. out.close();
  296. }
  297. /**
  298. * 产生测试数据
  299. */
  300. private void genObject(int threadCount, int dataCount) {
  301. long start = System.currentTimeMillis();
  302. Random r = new Random();
  303. int perCount = dataCount / threadCount;
  304. for (int i = 0; i < threadCount; i++) {
  305. Map<Integer, BenchmarkUser> map = new HashMap<>(dataCount);
  306. Set<Integer> keyset = new HashSet<>(dataCount);
  307. int id = 0;
  308. for (int j = 0; j < perCount; j++) {
  309. BenchmarkUser user = new BenchmarkUser();
  310. id = i * perCount + j;
  311. user.setId(id);
  312. user.setName("user-" + id);
  313. user.setCommentCount(id);
  314. user.setComposeCount(id);
  315. user.setReplyCount(id);
  316. user.setIp("ip" + id);
  317. user.setLoginCount(id);
  318. user.setPermission(r.nextBoolean());
  319. user.setLoginTime(new Timestamp(System.currentTimeMillis()));
  320. user.setRegisterTime(new Timestamp(System.currentTimeMillis()));
  321. map.put(id, user);
  322. keyset.add(id);
  323. }
  324. keyMap.put(i, keyset);
  325. valueMap.put(i, map);
  326. }
  327. // logger.error("生成测试数据花费" + (System.currentTimeMillis() - start) + "毫秒,线程数 = " + threadCount + ",每线程数据量 = " + (dataCount / threadCount));
  328. }
  329. static class ReadThread extends Thread {
  330. private final int index;
  331. private final CountDownLatch latch;
  332. private Set<Integer> keySet;
  333. private final boolean bBatch;
  334. private long spend = 0;
  335. public ReadThread(int index, CountDownLatch latch, boolean bBatch, Set<Integer> keySet,String threadName) {
  336. super(threadName);
  337. this.index = index;
  338. this.latch = latch;
  339. this.keySet = keySet;
  340. this.bBatch = false;
  341. }
  342. public long getSpend() {
  343. return spend;
  344. }
  345. @Override
  346. public void run() {
  347. long start = System.currentTimeMillis();
  348. if (bBatch) {
  349. CACHE.getAll(keySet);
  350. } else {
  351. long spend1 = System.currentTimeMillis();
  352. for (Integer key : keySet) {
  353. CACHE.get(key);
  354. }
  355. // logger.error("读取线程[" + index + "]花费" + (keySet.size() / (System.currentTimeMillis() - spend1)) + "毫秒");
  356. }
  357. spend = System.currentTimeMillis() - start;
  358. if (SHOW_LOG) {
  359. logger.error(this.getName() + "花费" + (spend) + "毫秒");
  360. }
  361. if (latch != null) {
  362. latch.countDown();
  363. }
  364. }
  365. }
  366. static class WriteThread extends Thread {
  367. private final int index;
  368. private final CountDownLatch latch;
  369. private final boolean bBatch;
  370. private Map<Integer, BenchmarkUser> valueMap;
  371. private long spend = 0;
  372. public WriteThread(int index, CountDownLatch latch, boolean bBatch, Map<Integer, BenchmarkUser> valueMap,String threadName) {
  373. super(threadName);
  374. this.index = index;
  375. this.latch = latch;
  376. this.bBatch = bBatch;
  377. this.valueMap = valueMap;
  378. }
  379. public long getSpend() {
  380. return spend;
  381. }
  382. @Override
  383. public void run() {
  384. long start = System.currentTimeMillis();
  385. if (bBatch) {
  386. CACHE.putAll(valueMap);
  387. } else {
  388. long spend1 = System.currentTimeMillis();
  389. for (Map.Entry<Integer, BenchmarkUser> entry : valueMap.entrySet()) {
  390. CACHE.put(entry.getKey(), entry.getValue());
  391. }
  392. // logger.error("写入线程[" + index + "]花费" + (valueMap.size() / (System.currentTimeMillis() - spend1)) + "毫秒");
  393. }
  394. spend = System.currentTimeMillis() - start;
  395. if (SHOW_LOG) {
  396. logger.error(this.getName() + "花费" + spend + "毫秒");
  397. }
  398. if (latch != null) {
  399. latch.countDown();
  400. }
  401. }
  402. }
  403. }

BenchmarkUser.java

  1. package com.github.aloxc.ignite.benchmark;
  2. import com.github.aloxc.fw.util.JsonUtil;
  3. import java.io.Serializable;
  4. import java.sql.Timestamp;
  5. /**
  6. * Created by Administrator on 2016/12/15.
  7. */
  8. public class BenchmarkUser implements Serializable{
  9. private int id; // 自增长ID[回复ID]
  10. private String name; // 用户名
  11. private String ip; // 用户IP
  12. private int loginCount; // 登录次数
  13. private int composeCount; // 发表主题数
  14. private int replyCount; // 回复数
  15. private int commentCount; // 评论数
  16. private boolean permission; // [没有注销=true][已被注销=false]
  17. private Timestamp loginTime; // 最新上站时间
  18. private Timestamp registerTime; // 注册时间
  19. @Override
  20. public int hashCode() {
  21. final int prime = 31;
  22. int result = 1;
  23. result = prime * result + id;
  24. return result;
  25. }
  26. @Override
  27. public boolean equals(Object obj) {
  28. if (this == obj)
  29. return true;
  30. if (obj == null)
  31. return false;
  32. if (getClass() != obj.getClass())
  33. return false;
  34. BenchmarkUser other = (BenchmarkUser) obj;
  35. if (id != other.id)
  36. return false;
  37. return true;
  38. }
  39. @Override
  40. public String toString() {
  41. return JsonUtil.toJson(this);
  42. }
  43. public int getId() {
  44. return id;
  45. }
  46. public void setId(int id) {
  47. this.id = id;
  48. }
  49. public String getName() {
  50. return name;
  51. }
  52. public void setName(String name) {
  53. this.name = name;
  54. }
  55. public String getIp() {
  56. return ip;
  57. }
  58. public void setIp(String ip) {
  59. this.ip = ip;
  60. }
  61. public int getLoginCount() {
  62. return loginCount;
  63. }
  64. public void setLoginCount(int loginCount) {
  65. this.loginCount = loginCount;
  66. }
  67. public int getComposeCount() {
  68. return composeCount;
  69. }
  70. public void setComposeCount(int composeCount) {
  71. this.composeCount = composeCount;
  72. }
  73. public int getReplyCount() {
  74. return replyCount;
  75. }
  76. public void setReplyCount(int replyCount) {
  77. this.replyCount = replyCount;
  78. }
  79. public int getCommentCount() {
  80. return commentCount;
  81. }
  82. public void setCommentCount(int commentCount) {
  83. this.commentCount = commentCount;
  84. }
  85. public boolean isPermission() {
  86. return permission;
  87. }
  88. public void setPermission(boolean permission) {
  89. this.permission = permission;
  90. }
  91. public Timestamp getLoginTime() {
  92. return loginTime;
  93. }
  94. public void setLoginTime(Timestamp loginTime) {
  95. this.loginTime = loginTime;
  96. }
  97. public Timestamp getRegisterTime() {
  98. return registerTime;
  99. }
  100. public void setRegisterTime(Timestamp registerTime) {
  101. this.registerTime = registerTime;
  102. }
  103. }

x

添加新批注
在作者公开此批注前,只有你和作者可见。
回复批注