perf(backend+frontend): 列表API响应体积优化 3.1MB→145KB (↓95.4%)
- 后端: JPQL构造器投影排除LONGTEXT大字段(uploadedImages/videoReferenceImages) - 后端: DTO层过滤非分镜图类型的base64内联resultUrl - 前端: 列表缩略图从video改为img loading=lazy,消除172并发请求 - 前端: download函数增加resultUrl懒加载(详情接口兜底) - 文档: 新增性能优化报告 docs/performance-optimization-report.md
This commit is contained in:
30
src/main/java/com/example/demo/DemoApplication.java
Normal file
30
src/main/java/com/example/demo/DemoApplication.java
Normal file
@@ -0,0 +1,30 @@
|
||||
package com.example.demo;
|
||||
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
import org.springframework.boot.autoconfigure.data.redis.RedisAutoConfiguration;
|
||||
import org.springframework.boot.autoconfigure.data.redis.RedisRepositoriesAutoConfiguration;
|
||||
import org.springframework.scheduling.annotation.EnableScheduling;
|
||||
|
||||
@SpringBootApplication(exclude = {RedisAutoConfiguration.class, RedisRepositoriesAutoConfiguration.class})
|
||||
@EnableScheduling
|
||||
public class DemoApplication {
|
||||
|
||||
public static void main(String[] args) {
|
||||
// 在应用启动时立即设置HTTP超时时间(支付宝API调用可能需要更长时间)
|
||||
// 连接超时:30秒,读取超时:120秒
|
||||
// 必须在SpringApplication.run()之前设置,确保在所有HTTP客户端创建之前生效
|
||||
System.setProperty("sun.net.client.defaultConnectTimeout", "30000");
|
||||
System.setProperty("sun.net.client.defaultReadTimeout", "120000");
|
||||
|
||||
// 增加HTTP缓冲区大小以支持大请求体(Base64编码的图片可能很大)
|
||||
// 设置Socket缓冲区大小为10MB
|
||||
System.setProperty("java.net.preferIPv4Stack", "true");
|
||||
// Apache HttpClient 使用系统属性
|
||||
System.setProperty("org.apache.http.client.connection.timeout", "30000");
|
||||
System.setProperty("org.apache.http.socket.timeout", "300000");
|
||||
|
||||
SpringApplication.run(DemoApplication.class, args);
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user