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)