当前位置:网站首页>优化接口性能
优化接口性能
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>二、耗时操作考虑异步处理</
边栏推荐
- Based on MCU, how to realize OTA differential upgrade with zero code and no development?
- P3250 [hnoi2016] Network + [necpc2022] f.tree path tree section + segment tree maintenance heap
- Execute kubectl on Tencent cloud container service node
- Xml的(DTD,xml解析,xml建模)
- Oracle withdraw permission & create role
- PHP server interacts with redis with a large number of close_ Wait analysis
- LeetCode 46:全排列
- 并发编程-单例
- How to mix embedded MCU, arm and DSP?
- ASP.NET-酒店管理系统
猜你喜欢

用了这么久线程池,你真的知道如何合理配置线程数吗?

Excel快速跨表复制粘贴

活动预告 | 直播行业“内卷”,以产品力拉动新的数据增长点

Redis things

Leetcode 46: full arrangement

Machine learning 3.2 decision tree model learning notes (to be supplemented)

Event preview | the live broadcast industry "rolled in" to drive new data growth points with product power

Hongmeng third training (project training)

2022 东北四省赛 VP记录/补题

软考中级软件设计师该怎么备考
随机推荐
Matlab extracts numerical data from irregular txt files (simple and practical)
Mmc5603nj geomagnetic sensor (Compass example)
2022 东北四省赛 VP记录/补题
Reading notes: heart like Bodhi, Cao Dewang
This article explains the complex relationship between MCU, arm, MCU, DSP, FPGA and embedded system
How to become a senior digital IC Design Engineer (1-4) Verilog coding syntax: expression
ORACLE进阶(一) 通过EXPDP IMPDP命令实现导dmp
Touch and screen automatic rotation debugging
Numpy np.max和np.maximum实现relu函数
Key switch: press FN when pressing F1-F12
[vtk] interpretation of source code comments of vtkwindowedsincpolydatafilter
C language AES encryption and decryption
Phpcms prompt message page Jump showmessage
DS90UB949
R语言使用aggregate函数计算dataframe数据分组聚合的均值(sum)、不设置na.rm计算的结果、如果分组中包含缺失值NA则计算结果也为NA
Web security summary
Repo ~ common commands
多维度监控:智能监控的数据基础
00后抛弃互联网: 毕业不想进大厂,要去搞最潮Web3
How to make others fear you