套接字服务器性能

Socket server performance

我正在开发网络套接字应用程序。从前端来看,每个应用程序只有一个套接字。但我不确定后端。我们将 Python 和 nginx 与 Flask-socketIO 和 socket-io 客户端库一起使用。该体系结构将用于通知前端发生了更改并且应该更新数据。

以下是我的疑惑—— 将在服务器上创建多少套接字和线程? 套接字可以在不同的连接之间共享吗? 有没有什么工具可以分析socket open的数量?

您可以使用 netstat -np 如果在 linux 机器上目前找不到打开的端口。 此 post 也可能对您有所帮助。 TCP : two different sockets sharing a port?

How many sockets and threads will be created on server?

有多少套接字就有多少入站连接。至于线程,这取决于你的架构。可能是一个,可能与插座相同,可能介于两者之间,可能更多。无法回答。

Can a socket be shared between different connection?

不,当然不是。这个问题没有意义。套接字是连接的端点。

Is there any tool to analyze no of socket open?

netstat 工具。