Does saving in cookies improve performance?

Source: Internet
Author: User

Just read the article today, the general meaning is that G elder brother and other sites put a lot of things stored in the session cookie, can reduce the burden of various servers. Then I found my memory of the request to application a little blurred, which is on the server, which is the client, back and forth to read so convenient and what to do with Ajax? Sparked a thought of me. In fact, when learning too focused on practical, too much attention to the implementation of the project function, some concepts but did not really understand, it seems to learn good, is too much pit. This really can not blame me, floating for so long, to this age only want to fast and stable down, inevitably some impatient.

By convention, the first paragraph is over.

If the request is on the client, then how to have the GetSession method? If the browser is not on the client, it should not be read in the request when it is passed to parameter. So the request must be in the client, but the meaning of this client is still to be re-understood, it should be said from the client, in the server read, so the client is still invisible, so the El expression can read, and JS cannot read. This means that each time a request is initiated, a call is sent, a cookie is attached, and the session and application are resident services, so in the same reply, request,session,application can communicate freely with each other. It's not that you can communicate with clients and servers at will, everything happens on the server, and then the response generates html,html is the real client. Ajax is the JS level of things, belonging to the HTML, so is also the client browser category. In each script, the number of El expression is the most special, he is actually in the server-side compiled execution, so can read the request, that is, in return to the browser when the El expression is not visible, only see the results. When using the request to save data from the server, it is the meaning of this time to generate HTML with this data, on the JSP servers, everything is in the response output stream out to complete, when this process occurs, the life cycle of the request is over, So the request essentially does not store any data for you, and all of the javabean that are transmitted with the request can actually be replaced with more than one field on the servlet, and there is no transfer process, is it? Do not forget that there is a request redirection mechanism, which can be passed at a level. This is the true meaning of the request. A layer of data from the servlet is set to the same request object, which is eventually reflected in the response output stream by the El expression. The session and application seem to be out of the discussion, even if you can call the JDK jar package, not to mention the two things.

So, the question is back, if we put things in a lot of cookies, it is bound to send a large amount of data each request, and has a repetition, as long as not to clear the cookie, each time will be the same data more than once, so it is not as direct as the session life cycle to shorten a point.

Does saving in cookies improve performance?

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.