Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why are RESTful Applications easier to scale

I always read that one reason to chose a RESTful architecture is (among others) better scalability for Webapplications with a high load.

Why is that? One reason I can think of is that because of the defined resources which are the same for every client, caching is made easier. After the first request, subsequent requests are served from a memcached instance which also scales well horizontally.

But couldn't you also accomplish this with a traditional approach where actions are encoded in the url, e.g. (booking.php/userid=123&travelid=456&foobar=789).

like image 986
Nicolas Avatar asked Jul 02 '12 16:07

Nicolas


People also ask

Why REST is more scalable than SOAP?

REST also makes efficient use of bandwidth, as it's much less verbose than SOAP. Unlike SOAP, REST is designed to be stateless, and REST reads can be cached for better performance and scalability. REST supports many data formats, but the predominant use of JSON means better support for browser clients.

How or why RESTful web services are more reliable and scalable?

RESTful systems identify data as cacheable and respect cache tags. Cacheable data reduces network traffic and reduces the load on the back-end system. Intermediate nodes may return cached data in favor of back-end servers, increasing scalability, availability, reliability, and performance.

Does REST API provide scalability?

There are many advantages of relying on REST APIs. Some of them include scalability, flexibility, independence, and security. The details of how each of these is beneficial are below.


1 Answers

The main reason behind saying a rest application is scalable is, Its built upon a HTTP protocol. Because HTTP is stateless. Stateless means it wont share anything between other request. So any request can go to any Server in a load balanced cluster. There is nothing forcing this user request go to this server. We can overcome this by using token.

Because of this statelessness,All REST application are very easy to scale. But if you want get high throughput(number of request capable in one second) in each server, then you should optimize blocking things from the application. Follow the following tips

  • Make each REST resource is a small entity. Don't read data from join of many tables.
  • Read data from near by databases
  • Use caches (Redis) instead of databases(You can save DISK I/O)
  • Always keep data sources as much as near by because these blocks will make server resources (CPU) ideal and it no other request can use that resource while it is ideal.
like image 63
Namjith Aravind Avatar answered Nov 15 '22 11:11

Namjith Aravind