当前位置:网站首页>优化接口性能
优化接口性能
2022-07-03 10:58:00 【inexaustible】
接口优化的八个要点
数据量比较大,批量操作数据入库
耗时操作考虑异步处理
恰当使用缓存
优化程序逻辑、代码
SQL优化
压缩传输内容
考虑使用文件/MQ等其他方式暂存,异步再落地DB
跟产品讨论需求最恰当,最舒服的实现方式
一、数据量比较大,批量操作数据入库
优化前:
//for循环单笔入库
for(TransDetail detail:list){
insert(detail);
}
优化后:
// 批量入库,mybatis demo实现
<insert id="insertBatch" parameterType="java.util.List">
insert into trans_detail( id,amount,payer,payee) values
<foreach collection="list" item="item" index="index" separator=",">(
#{item.id}, #{item.amount},
#{item.payer},#{item.payee}
)
</foreach>
</insert>
二、耗时操作考虑异步处理</
边栏推荐
- Multi dimensional monitoring: the data base of intelligent monitoring
- Kubernetes 三打探针及探针方式
- 基于I2C协议的驱动开发
- [vtk] source code interpretation of vtkpolydatatoimagestencil
- [vtk] interpretation of source code comments of vtkwindowedsincpolydatafilter
- Key switch: press FN when pressing F1-F12
- Web安全总结
- Excel表格转到Word中,表格不超边缘纸张范围
- The manuscript will be revised for release tonight. But, still stuck here, maybe what you need is a paragraph.
- Hongmeng fourth training
猜你喜欢
Arctangent entropy: the latest SCI paper in July 2022
Solve undefined reference to`__ aeabi_ Uidivmod 'and undefined reference to`__ aeabi_ Uidiv 'error
Kibana~Kibana的安装和配置
Driver development based on I2C protocol
Application of high-precision indoor positioning technology in safety management of smart factory
Based on MCU, how to realize OTA differential upgrade with zero code and no development?
Multi dimensional monitoring: the data base of intelligent monitoring
The uniapp scroll view solves the problems of high adaptability and bullet frame rolling penetration.
How to clean up v$rman_ backup_ job_ Details view reports error ora-02030
PHP server interacts with redis with a large number of close_ Wait analysis
随机推荐
MATLAB提取不規則txt文件中的數值數據(簡單且實用)
Abandon the Internet after 00: don't want to enter a big factory after graduation, but go to the most fashionable Web3
Some common terms
Matlab extracts numerical data from irregular txt files (simple and practical)
Multi dimensional monitoring: the data base of intelligent monitoring
C language utf8toutf16 (UTF-8 characters are converted to hexadecimal encoding)
How PHP solves the problem of high concurrency
基于turtlebot3实现SLAM建图及自主导航仿真
C语言二维数组
How to become a senior digital IC Design Engineer (1-4) Verilog coding syntax: expression
Uniapp implementation Click to load more
Illustrated network: what is virtual router redundancy protocol VRRP?
R language ggplot2 visualization: gganimate package creates dynamic line graph animation (GIF) and uses transition_ The reveal function displays data step by step along a given dimension in the animat
Event preview | the live broadcast industry "rolled in" to drive new data growth points with product power
抓包整理外篇fiddler———— 会话栏与过滤器[二]
Incremental database backup - DB incr DB full
R language uses grid of gridextra package The array function combines multiple visual images of the lattice package horizontally, and the ncol parameter defines the number of columns of the combined g
2022 东北四省赛 VP记录/补题
Excel quick cross table copy and paste
Driver development based on I2C protocol