针对我的项目中性能调优总结有如下几条:

  1. 防止服务间的屡次调用,可将屡次批改为一次,对于查问业务,如业务不容许则可将业务数据进行缓存(代码或者redis进行缓存)。
  2. 服务间调用对于无需返回并且对数据准确性后果较弱的操作,尝试批改为异步,尽快开释连贯。
  3. 批改操作及删除操作条件必须明确,防止独自应用主键,例如加上区划,年度,单位等。
  4. 禁止应用new Runable(), 应用线程必须应用线程池明确最小,最大线程数。
  5. 单次插入数据量特地大,字段特地多,业务的使用量
    具体写法如下图:


@Autowiredprivate SqlSessionTemplate sqlSessionTemplate;public void test(List insertList){SqlSessionFactory sqlSessionFactory = sqlSessionTemplate.getSqlSessionFactory();SqlSession sqlSession = sqlSessionFactory.openSession(ExecutorType.BATCH);try {    GlaBalanceDao blDao = sqlSession.getMapper(GlaBalanceDao.class);    insertList.stream().forEach(bal->{        blDao.insert(bal);    });    sqlSession.clearCache();    sqlSession.commit();}catch(Exception e){    throw new RuntimeException(e);}finally {    sqlSession.close();}}

开启mybatis batch模式源码解析: