On the necessity of realizing serialization in the Cloud (Sina Cloud deployment session failed to get value)

Source: Internet
Author: User
Tags server memory value store

for The importance of the Java implementation serialization, in the single-machine program is not very easy to pay attention to, in local debugging, Tomacat automatically for the serialization of the program implemented serialization, and beans ( to implement the cache Java program ) too small to have any problems.


but once deployed to the cloud in Sina, trouble will appear, you will find why the session is not stored in the value?


For the Sina Cloud Server, the session information uses the distributed Memcache storage.


and Memcache Storage it?


Many sites that want to build heavy loads take memcache to share the pressure on the database.


Memcache first creates a space in the server-side memory and then builds a hash table.


Memcache runs as a daemon on the server side (one or more servers), accepts connection operations from clients at any time, and then accesses data, Memcache is a NoSQL memory database. A key value store is used, and each client has a unique key to the object. But objects are not persisted, and Redis, similar to memcache, can be persisted to the hard disk. The data that the client needs to cache is then stored in the server's memory in the form of Key-value, and the value is stored on a server corresponding to the hash conversion of the key value. When the value is taken, the request can be made on the responding server after the same conversion.


And what is the role of serialization in it?


When Memcache is cached to memory, it needs to be used to serialize the storage, so if the code in your bean package does not implement the serialization interface, it will not be cached in the server memory when the cache is cached, thus causing the session to have no value.


So the object that is stored in the session in the program that is deployed to Sina Cloud must implement the serialization interface before the session can be stored.





On the necessity of realizing serialization in the Cloud (Sina Cloud deployment session failed to get value)

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.