am working on a E-commerce project which has internally four projects(parts).
1.) core -has users info
2.) cms-contents info
3.) oms-orders info
4.) wallet-payment info
Used:-
UI-AngularJs
Backend-java
we have multiple REST API calls one after other to same domain(with different path and query parameters).
What are the ways that I can optimize api response time.
Suggestions for java and AngularJs is welcome,rather than caching give me more suggestions that i can use to optimize response time of api's.
Appreciated!!!
I have found same question on stackoverflow How to Optimize REST API calls ,answer is helpul but found no best solution for me.
Generally, APIs that are considered high-performing have an average response time between 0.1 and one second. At this speed, end users will likely not experience any interruption. At around one to two seconds, users begin to notice some delay.
Another way to improve the performance of your API calls is by sending and receiving only the portion of the data that you're interested in. This lets your application avoid transferring, parsing, and storing unneeded fields, so it can use resources including network, CPU, and memory more efficiently.
Compress the Result of Web API In the Web, the data transfers through the network in packages (data packets), increasing the size of the data package, which will increase the size as well as increase the response time of the Web API. Thus, reducing the data packet size improves the load performance of Web API.
Try using the below configurations for Java-spring projects :
# 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
What is the current response time you have in ms and what you are aiming to?
A good cached Api should work at the java level around 1-30ms depends on the amount of content and the type of cachong you are using.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With