4

关于 mysql 连接、连接池以及 socket 的疑问

 2 years ago
source link: https://www.v2ex.com/t/820666
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

V2EX  ›  程序员

关于 mysql 连接、连接池以及 socket 的疑问

  liu1996 · 17 小时 6 分钟前 · 304 次点击

mysql 的每一个 connection 底层都是一个 socket 连接对吗?(别说 socket 是抽象接口,这里就把它的实现称为 socket ) 服务端每次接收到客户端请求时都会生成一个新的 socket ,新的 socket 中有服务器 ip 、服务器端口号、客户端 ip 、客户端端口号,以此来表明这是某个客户端与服务端的连接。 那么连接池中的 socket 是什么样的?是有多个服务器 ip 、服务器端口号一样,客户端 ip 、客户端端口号都为空的 socket 对象吗?然后每次有新的客户端请求进来,就拿出一个 socket 对象,把它的客户端 ip 、客户端端口号置为这个请求的,用完以后再把客户端 ip 、客户端端口号置为空,并且将这个 socket 对象放进连接池中,我的想法对吗?


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK