I'm going to implement a server side program, and I'm curious if the following two implementations have the same effect:
我将实现一个服务器端程序,我很好奇以下两个实现是否具有相同的效果:
- one server process listening on 10 ports with 1000 threads
- 10 server processes with each one having 100 threads and listening on 1 port
一个服务器进程在10个端口上侦听1000个线程
10个服务器进程,每个进程有100个线程并监听1个端口
Thanks
1 个解决方案
#1
1
Option 1 will use less memory, especially for java variant. Stability of option 1 will be less, since one process is the one point of failure here - everything you do to crash process will affect the whole server. Option 1 allows you to use in-memory interoperability between different connections (unless you make server cluster). Restart and service management for option 1 is much easier.
选项1将使用更少的内存,尤其是对于java变体。选项1的稳定性会更低,因为一个进程是此处的一个故障点 - 您对崩溃进程所做的一切都将影响整个服务器。选项1允许您在不同连接之间使用内存中的互操作性(除非您创建服务器群集)。选项1的重启和服务管理要容易得多。
#1
1
Option 1 will use less memory, especially for java variant. Stability of option 1 will be less, since one process is the one point of failure here - everything you do to crash process will affect the whole server. Option 1 allows you to use in-memory interoperability between different connections (unless you make server cluster). Restart and service management for option 1 is much easier.
选项1将使用更少的内存,尤其是对于java变体。选项1的稳定性会更低,因为一个进程是此处的一个故障点 - 您对崩溃进程所做的一切都将影响整个服务器。选项1允许您在不同连接之间使用内存中的互操作性(除非您创建服务器群集)。选项1的重启和服务管理要容易得多。