Objective:
- Sessions and cookies are all designed to keep the interaction between the server and the client state. If a day's PV has hundreds of millions of, and a cookie is 200 bytes, but it also consumes a lot of bandwidth? Therefore, the large traffic is referred to the session, but there is no sharing session between the hundreds of server clusters.
Understanding Cookies
- In short, the user accesses the server via HTTP, and the server returns some Key/value data to the client, with some restrictions on the data, and when the user accesses the server again, it is returned to the server as soon as the condition is met. The design cookie was originally designed to deal with a stateless protocol such as HTTP to distinguish different users, and now cookies can be used as a basis for server data caching.
- Cookie attribute entries, currently divided into two versions of Version0 and Version1, commonly used are max-age, Domain,expires,path, etc., in the Javaweb servlet specification, We commonly use set-cookie:user-name= ' hakulamatata '; max-age= "1000".
Java Web in-depth analysis (9) Session and Cookie