Application Scenario:
1. Generally speaking, after the server is started, will not shut down again, but if forced to need to restart, and the user session is still in the corresponding operation, then need to use serialization to save sessions to put on the hard disk, the server restart, and reload. This ensures that the user information is not lost and that the permanent save is implemented
2. Taobao every year there will be regularly snapped activities, many users will be in advance login waiting, long time does not operate, consistent save in memory, and to reach the specified moment, hundreds of thousands of users concurrent access, there may be hundreds of thousands of sessions, memory may be too much, then need to be activated, passivation of the object, Let it leave the memory at idle time, save the information to the hard disk, etc., when it is used, reload into the memory
Serialization and deserialization of a session
What is serialization.
The process of converting an object's state information into a form that can be stored or transmitted, simply by converting an object into a byte-form store is called an object serialization
What is deserialization.
The process of converting a byte sequence into an object