What are the differences between stateless and stateful systems, and how do they impact parallelism?

前端 未结 2 1766
一个人的身影
一个人的身影 2021-01-29 21:03

Explain the differences between stateless and stateful systems, and impacts of state on parallelism.

2条回答
  •  夕颜
    夕颜 (楼主)
    2021-01-29 21:48

    A stateful server keeps state between connections. A stateless server does not.

    So, when you send a request to a stateful server, it may create some kind of connection object that tracks what information you request. When you send another request, that request operates on the state from the previous request. So you can send a request to "open" something. And then you can send a request to "close" it later. In-between the two requests, that thing is "open" on the server.

    When you send a request to a stateless server, it does not create any objects that track information regarding your requests. If you "open" something on the server, the server retains no information at all that you have something open. A "close" operation would make no sense, since there would be nothing to close.

    HTTP and NFS are stateless protocols. Each request stands on its own.

    Sometimes cookies are used to add some state to a stateless protocol. In HTTP (web pages), the server sends you a cookie and then the browser holds the state, only to send it back to the server on a subsequent request.

    SMB is a stateful protocol. A client can open a file on the server, and the server may deny other clients access to that file until the client closes it.

提交回复
热议问题