Can a js object be serialized?

  node.js, question

In fact, the original question is:

How many attributes can a js object have to guarantee good performance?

According to the discussion, the actual problem has become the current one.

The code is as follows

var People = function(){
 this.a, this.b, this.c;
 this.say = function(){console.log(a)}
 this.setA = function(a){this.a = a;  bracket
 this.otherFunc = function(){
 xxxx this.b xxxx
 bracket
 this.anotherFunction = function(){xxxxxxxxxxx}
 this.xxx = function(){..........}
 .............
 bracket
 
 var p = new People();
 
 p.setA(2)
 
 How to serialize p can ensure that the property value in p remains the same as before when p is deserialized and taken out?
 Pickle in Python can persist storage objects, like and in  node?

Original question dividing line-

The problem scenario is as follows: I need to do a message queue to store the callback function containing response. Now I use object object as Hash data structure to save the message, as follows:
message.js:

var obj = {};
 var Message = function(){
 this.push = function(uuid, callback){
 obj[uuid] = cb;
 bracket
 this.pop = function(uuid){
 var callback = obj[uuid]
 delete obj[uuid]
 return callback;
 bracket
 bracket
 module.exports = new Message()

index.coffee:

message = require './message'
 uuid = require xxxx
 http = require xxx
 socket_io = require xxxx
 ......
 
 server = http.createServer((req, resp)->
 mid = uuid.v1()
 message.push(mid, (data)-> resp.send(data))
 socket_io.emit("xxx", {xxxx:xx})
 )
 
 io.on("connection", (socket)->
 socket.on("xxxx", (mid, data)->
 cb = message.pop(mid)
 cb(data)
 )
 )

I want to know.obj = {}Is there an upper limit on the number of attributes? Under the condition that the program can run correctly, is there a theoretical value and an actual value to determine the upper limit of the number of this attribute? Is this actual and theoretical value related to memory size? In addition, is there a better implementation?

If redis or mongo is recommended for persistent storage, the existence of memory inside is not safe after all, in case of crash. . .