In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-25 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/02 Report--
This article introduces what web stateless means to you, the content is very detailed, interested friends can refer to, hope to be helpful to you.
REST architecture design is a very hot concept at present, and it has become the de facto standard that should be followed when building web services. A very important rule in REST constraints is "stateless"
What is the concept of "state"
The "state" of an Web application protocol usually refers to some common information reserved for two interrelated user interactions, which are often used to store data such as workflow or user state information. This information can be specified in different scopes such as page,request,session or global scope, and the responsibility for storing them can also lie with the Client side or the Server side.
There are two "states" during service invocation: application state (Application State) and resource state (Resource State). The application status refers to the status information related to a specific request, while the resource state reflects the specific state of a resource stored on the server at a certain time, which will not change because of the user's request. Any user's request for the resource at the same time will get the Representation of this state. The RESTful architecture requires that the server side does not keep any resources related to a particular HTTP request, so the application status must be provided by the requester during the request process.
For example, a session ID can be thought of as a Key that identifies the state of a session, and passing it to the server means a request: "Please help me get this status information," that is, the request assumes that the responder is guaranteed to have state information. Because the state associated with a particular request belongs to the application state, and the RESTful architecture requires that any such state be provided by the requester, it is considered the practice of unRESTful to pass Session ID. The user's identity credential information, as an application status, is expected to be provided by the requester, so passing the user's identity credential information in the request conforms to the RESTful architecture specification.
Why use a stateless architecture
Although storage state brings a lot of convenience to enterprise software development, it also brings many limitations to other aspects of distributed systems, such as load balancing, in stateful mode, a user's request must be submitted to the server that holds its relevant state information, otherwise these requests may not be understood. This means that the server cannot schedule user requests freely in this mode. Another related problem here is fault tolerance. If the server that holds the user information goes down, all recent interactions of that user cannot be transparently transferred to the standby server, unless the server synchronizes the status information of all users with the primary server at all times. In addition, because HTTP itself is not a stateful protocol, developers must achieve state passivation and activation through simulation. Therefore, in order to overcome these shortcomings, the Statelessness architecture style attribute has received widespread attention.
Stateless means that each maintains its own state, such as the session information is on the client, and the server does not keep the state information, then we can say that the server is stateless. The benefit of this is obvious. The stateless part can be easily replaced (or clustering, scale-out) without state reconstruction (or synchronization), which greatly improves the scalability (scalability). Usually, the session of J2EE is considered to be a bad design, and most J2EE middleware requires session synchronization when clustering, while Play! If it is not designed based on the J2EE system, there is no worry!
About what web stateless means to share here, I hope the above content can be of some help to you, can learn more knowledge. If you think the article is good, you can share it for more people to see.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.