Why are RESTful Applications easier to scale

前端 未结 5 1391
半阙折子戏
半阙折子戏 2020-12-30 06:58

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 ca

5条回答
  •  醉梦人生
    2020-12-30 07:44

    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.

提交回复
热议问题