当前位置:网站首页>Summary of actual business optimization scheme - main directory - continuous update
Summary of actual business optimization scheme - main directory - continuous update
2022-04-23 18:36:00 【Yin Zhen GRD_ Zhipeng】
Summarize the interesting problems encountered in the work , And corresponding solutions . Encountered a record .
The business is big , There are often inexplicable problems . For example, good plug-ins , Somehow it doesn't work . You cannot change the business code at this time , Or modify a little , We have to solve the problem .
List of articles
One 、Mybatis Climb a pit
1. mybatis-plus Auto fill failure 、 The paging plug-in does not pass down the interception chain
The question is shown in the title ,mybatis Auto fill does not take effect , Using the paging plug-in, it is found that the plug-in does not pass down the interception chain .
Solution
- Choose to use Mybatis-plus Pagination plug-in for , Meet the requirements of passing down the interception chain .
- imitation MyBatis-plus Auto fill using , Custom auto fill plug-in . solve Mybatis-plus Auto fill is sometimes valid and sometimes invalid .
For reasons of length , Put it in this article :https://blog.csdn.net/grd_java/article/details/124349094 |
---|
2. Use Spring AOP monitor mapper execution time
The company lets you optimize the query of the report ( A query is said to be close to 20s, An interface 15 Seconds will time out , So the worst thing is to let the query in 15s within ), These reports have a large amount of data ,IO A lot , A query involves dozens of sql and IO
So you want to optimize , You have to know which operations are more time-consuming , Direct use AOP It's a good choice , Print every... Accurately IO Time for , To optimize
import lombok.extern.slf4j.Slf4j;
import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.Around;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Pointcut;
import org.springframework.stereotype.Component;
import java.util.Arrays;
/** * 2022-04-14===>>>yinzhipeng * Used to get mapper execution time */
@Component
@Aspect
@Slf4j
public class MapperExecutionTimeAspect {
@Pointcut("execution(* cn.xxx.mapper.*.*(..))")
public void pointcut() {
}
@Around("pointcut()")
public Object doAround(ProceedingJoinPoint pjp) throws Throwable {
long begin = System.nanoTime();
Object obj = pjp.proceed();
long end = System.nanoTime();
log.info(" call Mapper Method : Execution time consuming :{} nanosecond , Time consuming :{} millisecond ,{}, Parameters :{}",
(end - begin), (end - begin) / 1000000,
pjp.getSignature().toString(), Arrays.toString(pjp.getArgs()));
return obj;
}
}
Two 、 Query optimization
1. A lot of mapper IO Optimize
When querying large reports , also sql Without much optimization space , How to improve efficiency ?
- That is to say, now IO Too much , But there's no way , Business really needs so much IO
- Single IO Efficiency optimization of , There is not much room for optimization , That is, optimize sql Our plan is not desirable
- So the question is how to make these IO Can you hurry up
In general, this is the case , You can consider multithreading , And large reports generally do not need to consider high concurrency . So write everything directly into the method , Not defined in a class , There's no thread safety issue . Because there is no high concurrency , There is no need to consider the problem of stack overflow ( Each thread execution will have a , Thread private , Life cycle is the same as thread , yes Java The thread memory model of method execution , When each method is executed ,Java All virtual machines will create a stack frame synchronously (Stack Frame) Used to store local variables 、 The stack of operands 、 Dynamic connection 、 Method exit information )
For reasons of length , Put it in this article :https://blog.csdn.net/grd_java/article/details/124348962 |
---|
版权声明
本文为[Yin Zhen GRD_ Zhipeng]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/04/202204231833296538.html
边栏推荐
- Kettle paoding jieniu Chapter 17 text file output
- Chondroitin sulfate in vitreous
- iptables初探
- Excel intercept text
- Introduction to quantexa CDI syneo platform
- 多功能工具箱微信小程序源码
- ctfshow-web362(SSTI)
- 回路-通路
- Daily CISSP certification common mistakes (April 12, 2022)
- Setting up keil environment of GD single chip microcomputer
猜你喜欢
Query the logistics update quantity according to the express order number
ctfshow-web361(SSTI)
os_authent_prefix
Nodejs installation
The vivado project corresponding to the board is generated by TCL script
Use bitnami / PostgreSQL repmgr image to quickly set up PostgreSQL ha
listener. log
Résolution: cnpm: impossible de charger le fichier... Cnpm. PS1 parce que l'exécution de scripts est désactivée sur ce système
iptables初探
WIN1 remote "this may be due to credssp encryption Oracle correction" solution
随机推荐
Résolution: cnpm: impossible de charger le fichier... Cnpm. PS1 parce que l'exécution de scripts est désactivée sur ce système
Keil RVMDK compiled data type
QT error: no matching member function for call to ‘connect‘
Linux installs MySQL in RPM (super simple)
Mysqldump backup database
使用晨曦记账本,分析某个时间段每个账户收支结余
Quantexa CDI(场景决策智能)Syneo平台介绍
Resolution: cnpm: unable to load file \cnpm. PS1, because running scripts is prohibited on this system
SQL database syntax learning notes
From introduction to mastery of MATLAB (2)
QT add external font ttf
Creation and use of QT dynamic link library
CANopen STM32 transplantation
Configure iptables
kettle庖丁解牛第17篇之文本文件输出
Daily CISSP certification common mistakes (April 12, 2022)
Differences between SSD hard disk SATA interface and m.2 interface (detailed summary)
The connection of imx6 network port is unstable after power on
【科普】CRC校验(一)什么是CRC校验?
Daily CISSP certification common mistakes (April 18, 2022)