Comments (4)
另外,异步库与标准库单纯对比吞吐量,其实实际意义也不大,因为标准库方式的包体解析逻辑可能更简单,并且异步库解析完整包后通常需要跨协程传递再由其他逻辑协程池处理,时空亲和性、调度亲和性、生命周期等各种实际情况加起来。
7层业务下、普通在线量比如不同硬件规格10-100k这种量级,异步库未必比标准库有相应性能的优势
from gev.
虽然我读懂了,但是还是建议你发表这种见解时组织一下语言。
from gev.
虽然我读懂了,但是还是建议你发表这种见解时组织一下语言。
单就内容本身,已经表达的够清楚了,问题本身稍微有点复杂,即使再加上1、2、3、表格,一般的逻辑程序员也看不懂。这个只是给 Allenxuxu 交流、建议的,目测应该能看懂的
from gev.
虽然我读懂了,但是还是建议你发表这种见解时组织一下语言。
我在 nbio 里做了很多功能支持和细节优化,tls/http/websocket,both server and client side,http的标准库兼容,websocket的全量测试,但这些都不是最难的。
最难的是把这个几个层的内存优化打通。不能简单使用2^N的内存池,因为异步流解析涉及half-packet,而且需要应用层协成池,所以buffer是需要跨协成传递的,buffer生命周期不确定,不能像使用net.Conn的方案那样简单地为每个连接复用同一个buffer(阻塞读一个、处理一个、然后再读下一轮读和处理)。
整体来说,去年优化内存这块花费了我最多的时间,其次是魔改标准库的tls支持异步流解析。
从某些使用方式的角度讲,异步库使用2^N的内存池在parser解析的过程中可能会有更多性能浪费,或者用ring buffer作为读或者写的cache与连接绑定、在连接数很大的时候会造成巨大内存消耗、甚至节省的协程数量的资源都无法弥补回来
这次还是没组织语言,能看懂就行吧,这些都是实现过程中总结的,我还希望在有可能的地方继续提升自己的库,所以希望跟大伙多多交流
from gev.
Related Issues (20)
- How to use with gin HOT 1
- 事件处理顺序如何排序,这里的排序有什么讲究? HOT 4
- Are the writes to socket blocking or non-blocking? HOT 3
- 这里的循环是不是换成if也行 HOT 2
- 请教一个问题,实在没看懂。 HOT 4
- 关闭连接时,为什么不直接关闭连接,而是将【关闭连接】这个任务放到异步队列里面等待执行? HOT 3
- 请问一下该库能管理大量客户端连接么? HOT 1
- 对于gev的一些疑问 HOT 1
- 控制EpollWait的msec优势在哪?
- EpollWait循环中wakeHandlerRead()是不是处理早了 HOT 1
- 建议加入UDP协议 HOT 1
- 百兆数据传输效率 HOT 2
- Question: is it possible to use your module as a websocket client? HOT 1
- OnConnect 里使用 c.set 的请教! HOT 1
- 能不能加一个sproto支持啊?
- 是否应该加入高水位回调来避免客户端不收数据
- windows 下cpu、内存占用问题
- 不会触发OnClose
- cpu跑到400%, 目前只有2个连接,抓包只有60s定时的心跳
- Linux下客户端访问的数据,不让服务端自动返回 HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from gev.