London guy
London guy

Reputation: 28022

Getting a quick response for a REST request

I am sending REST based requests to a server. I would like to get the response as quickly as possible and would want to know the various optimizations that can be made.

One way is of course to send these requests in parallel in threads. What other options are available to optimize this?

On the server, part what configurations can be added?

Upvotes: 0

Views: 428

Answers (1)

ryan1234
ryan1234

Reputation: 7275

Optimizations for REST calls (or just HTTP calls):

  1. Like Brian Kelly said, cache the calls aggressively.
  2. You can minimize the payloads that are returned when doing a GET. If it's returning JSON, you can trim the names of the fields to make the total return object smaller.
  3. You can make sure you have compression turned on.
  4. You can batch calls. So if a user wants to go three GETs in a row, you might batch those server side (assuming a web application) and then make one HTTP call with the three requests.
  5. Again if it's a web application and you want to minimize load times for pages, you can load only essential data on page load and push the rest of the calls to AJAX calls.
  6. You can optimize your database queries that serve the REST calls.

The biggest bang for you buck will definitely be caching though.

Upvotes: 2

Related Questions