知识卡片
服务请求经过连接与线程
典型框架先在端口监听,收到连接后读取协议头与消息,解析输入,再从线程池取线程执行处理方法;方法构造响应后,框架回传并归还线程。do-something模板只展示业务入口,不包含连接管理和调度全部成本。明确这条路径才能判断优化是在业务计算、协议解析还是等待线程;现代框架能简化编写,但不会取消资源约束。
这张卡片看不懂?
这张卡片的反馈已满 10 条,暂时无法继续提交。
已有反馈 · 0 / 10 条
还没有人提交反馈。
在整书笔记中的位置
原书出处 · 1 处
- 服务端架构 · 查看原书依据
A service, when started, creates a server socket with a given port (e.g., 8008) and waits for a client. When a client (e.g., a mobile app running on our customer’s phone) opens a connection, the server socket creates a new socket and hands it over to the service implementation.
参考来源
- 位置:《Software Architecture and Decision-Making》第11章《Server Architectures》(来源项目:book-sources;源文件:extracted/Software Architecture and Decision-Making Leveraging Leadership, Technology, and Product Management to Build Great Products… (Srinath Perera)/_epub-src/ch11.xhtml)
- 结论依据:摘录说明典型框架先在端口监听,收到连接后读取协议头与消息,解析输入,再从线程池取线程执行处理方法;方法构造响应后,框架回传并归还线程。其余条件结合本章相邻例子与取舍说明,数字示例不作当前性能承诺。
- 原始内容:A service, when started, creates a server socket with a given port (e.g., 8008) and waits for a client. When a client (e.g., a mobile app running on our customer’s phone) opens a connection, the server socket creates a new socket and hands it over to the service implementation.