Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有两个用途不同的 java 服务器,我必须在同一台机器上同时运行它们。我的问题是:(为了性能)最好只创建一个应用程序,其中实例化两个 ServerSocket(具有不同的端口)或为每个服务器创建两个不同的 java 应用程序?
与性能问题一样,我建议不要过早进行优化。
也许根据您的需求部署最简单的解决方案,然后进行衡量。
另请注意,使用两台服务器,您将有一个额外的流程来管理、部署、测量等。拥有两台服务器意味着您可以独立关闭和/或在出现问题时将每台服务器切换到单独的主机。因此,我认为这个问题不仅仅与性能有关。