官术网_书友最值得收藏!

HTTP is a stateless protocol

The HTTP protocol is a stateless one. This means that every HTTP request the server receives is independent and does not relate to requests that came prior to it. For example, imagine the following scenario: a request is made for the first ten user records, then another request is made for the next ten records.

On a stateful protocol, the server remembers each client position inside the result-set, and therefore the requests will be similar to:

  • Give me the first ten user records
  • Give me the next ten records

On a stateless protocol, the requests will be a bit different. The server doesn't hold the state of its client, and therefore the client's position in the result-set needs to be sent as part of the requests:

  • Give me user records on index 1 to 10
  • Give me user records on index 11 to 20

The slight difference between these examples represents the different approaches. On stateful protocols, you assume that the server knows everything about the previous requests, while on a stateless protocol you assume the opposite—the server doesn't know anything about the previous requests, which is why you send all the necessary information with each and every request.

On the one hand, this makes web service development more challenging, since creating fast, stateless service is not an easy task. On the other hand, this enables services to scale out quickly and support millions of users rather easily.

主站蜘蛛池模板: 濉溪县| 桑日县| 兴文县| 信宜市| 康定县| 谷城县| 枣庄市| 漳平市| 勃利县| 松江区| 寻甸| 正安县| 亳州市| 沧源| 云阳县| 鹤峰县| 柳河县| 改则县| 建德市| 永寿县| 苍山县| 年辖:市辖区| 华亭县| 宝应县| 石渠县| 霸州市| 宁陵县| 河间市| 镇原县| 宿松县| 新郑市| 江油市| 和静县| 响水县| 兴文县| 冕宁县| 浮山县| 临邑县| 阳东县| 余庆县| 彭泽县|