正在从事一个电子商务项目,该项目内部有四个项目(部分)。
1.) 核心 - 有用户信息
2.) cms-内容信息
3.) oms-订单信息
4.) 钱包-支付信息
用过:-
UI-AngularJs
后台-java
- 没有第三方 paty api 调用。
- 已使用缓存
- 以上四个项目中只有http调用。
我们有多个 REST API 调用一个接一个地指向同一个域(具有不同的路径和查询参数)。
What are the ways that I can optimize api response time.
欢迎提出有关 java 和 AngularJs 的建议,而不是缓存给我更多建议,我可以使用这些建议来优化 api 的响应时间。
感谢!!!
我在 stackoverflow 上发现了同样的问题 How to Optimize REST API calls ,答案很有帮助,但没有找到适合我的最佳解决方案。
最佳答案
尝试对 Java-spring 项目使用以下配置:
# Enable response compression
server.compression.enabled=true
# The comma-separated list of mime types that should be compressed
server.compression.mime-types=text/html,text/xml,text/plain,text/css,text/javascript,application/javascript,application/json
# Compress the response only if the response size is at least 1KB
server.compression.min-response-size=1024
# Enable HTTP/2 support, if the current environment supports it
server.http2.enabled=true
关于java - 如何优化 REST API 响应时间,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46986775/