search

Home  >  Q&A  >  body text

node.js - NodeJS启动多实例问题

PHP中文网PHP中文网2876 days ago353

reply all(3)I'll reply

  • 大家讲道理

    大家讲道理2017-04-17 16:16:21

    • 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.

    reply
    0
  • 怪我咯

    怪我咯2017-04-17 16:16:21

    You can use redis or MemCached for data sharing

    reply
    0
  • 大家讲道理

    大家讲道理2017-04-17 16:16:21

    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

    reply
    0
  • Cancelreply