The problem you mentioned does not exist. When you talk about starting multiple instances, can I understand it as using multiple cores to start multiple processes? If so, then the processes on each core are independent of each other. As you said, nodejs is a single process. Each process on the core has its own map variable, which is independent of each other. A process can only access its own global variables and cannot access the map variables of a process on another core.
Not all instances can be accessed. An instance is equivalent to a container. If you put a variable in container a, the variable in a cannot be obtained in container b. Imagine two people ordering a milkshake. The milkshake is the same, but you add chocolate chips to your milkshake to make it taste better. So, can another person drink the chocolate beans? If you can please give me a Doraemon-like medicine
The problem you mentioned does not exist. When you talk about starting multiple instances, can I understand it as using multiple cores to start multiple processes? If so, then the processes on each core are independent of each other. As you said, nodejs is a single process. Each process on the core has its own map variable, which is independent of each other. A process can only access its own global variables and cannot access the map variables of a process on another core.
You can use redis or MemCached for data sharing
Not all instances can be accessed. An instance is equivalent to a container. If you put a variable in container a, the variable in a cannot be obtained in container b. Imagine two people ordering a milkshake. The milkshake is the same, but you add chocolate chips to your milkshake to make it taste better. So, can another person drink the chocolate beans? If you can please give me a Doraemon-like medicine