Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

请教下 这个可以支持百万或者千万并发吗? #45

Open
LoveChina-3000 opened this issue Jul 5, 2022 · 3 comments
Open

Comments

@LoveChina-3000
Copy link

startClients(loop,serverAddr,clients,10000000);

@LoveChina-3000
Copy link
Author

请教大佬第二个问题:大佬能再封装下libuv的pipe吗?用惯了大佬封装得libuv

@wlgq2
Copy link
Owner

wlgq2 commented Jul 8, 2022

经常看到网络库宣传自己支持百万并发,其实大家都是epoll,iopc封的,理论上不是封的太挫,性能上不至于差非常多。这个库本身是对libuv封的,最初的设定就是不损耗太多额外的性能,libuv本身性能怎么样,它就是怎么样,所以这个库尽可能减少memcopy或者内存重新分配(比如读每个连接的数据,那个缓存是复用的,只有不够了才重新申请)。能跑多少,和你机器本身性能有关。

客户端这个例子你可以试试每个线程开个LOOP,每个LOOP分配若干客户端,还有关闭客户端的包处理缓存(会占内存,读包性能降低)。你可以试试和其他网络库对比。

@wlgq2
Copy link
Owner

wlgq2 commented Jul 8, 2022

不要一个loop跑100w客户端,因为是单线程,开若干线程(比如你16核就16个线程),每个线程一个独立的loop对象,每个loop跑几万个客户端,你可以测试下看看性能。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants