Comments (15)
不同IOMod
处理方式不同,默认是 IOModNonBlocking
,是IO协程池(等同于poller协程,写成数量为NPoller
)、逻辑协程池处理所有连接,逻辑协程池size可定制(MessageHandlerPoolSize
)
IOMod
可以看下这里:
https://github.com/lesismal/nbio#different-iomod
from nbio.
好的。
请教下,如果用这个库开发一个云服务,有上百万个用户的websocket连接,您建议用哪种IOMod,服务端读消息和推送消息的性能比较高?
from nbio.
如果持续高在线量的话 IOModNonBlocking 就可以,如果低峰时段在线量不那么大,用 IOModMixed 可以响应延迟略低、更好些
from nbio.
好的。
这个库,调用linux操作系统的epoll,是通过cgo吗?还是通过纯的go代码实现的?
from nbio.
没有使用cgo,所有功能都是纯go的。
也相当于没有三方依赖,只依赖标准库。tls依赖的llib是我自己的库,是基于标准库魔改的代码,由于标准库开源协议不是MIT,所以单独拆到llib里了
from nbio.
非常感谢指导。
再请教下,如果上百万个用户连接,有些用户可能比较频繁操作系统,发送请求,另一些用户可能不是很频繁操作。无论间隔多长时间客户端和服务端相互之间没有发送任何消息,我想让服务端始终保持websocket连接。这个库可以保持连接吗?有没有相关的服务端启动参数之类的?
from nbio.
你的双方不主动关闭就可以保持连接。
为了避免僵尸连接,通常有心跳机制,正常发心跳就可以了,心跳可以参考这里的建议:
lesismal/nbio-examples#12
from nbio.
This issue is stale because it has been open for 30 days with no activity.
from nbio.
不同
IOMod
处理方式不同,默认是IOModNonBlocking
,是IO协程池(等同于poller协程,写成数量为NPoller
)、逻辑协程池处理所有连接,逻辑协程池size可定制(MessageHandlerPoolSize
)
IOMod
可以看下这里: https://github.com/lesismal/nbio#different-iomod
io协程和连接协程有啥区别
from nbio.
io协程和连接协程有啥区别
io协程是nbio自己的协程池、数量不大、可以自己配置数量
基于标准库的连接每个连接一个协程、在线数大的时候协程数量大
from nbio.
io协程和连接协程有啥区别
io协程是nbio自己的协程池、数量不大、可以自己配置数量 基于标准库的连接每个连接一个协程、在线数大的时候协程数量大
能直接在连接协程里面,进行数据库操作等比较耗时的操作吗?现在测试过程发现,在连接协程做耗时的操作 影响用户连接。
from nbio.
提供下示例代码
from nbio.
你说的 “连接协程” 是指nbio的处理连接的逻辑协程,还是指基于标准库的每个连接一个协程?
先把术语对齐,然后提供下你的有问题的示例
from nbio.
This issue is stale because it has been open for 30 days with no activity.
from nbio.
This issue was closed because it has been inactive for 14 days since being marked as stale.
from nbio.
Related Issues (20)
- 如何增加序列化和反序列化的函数? HOT 3
- how to use with so reuseport option for the http example? HOT 3
- one more question. thx for the prompt reply, how well does it scale as a client? HOT 7
- just tested the performance of nbio tcp https on multicore system. it's great! but... how to do h2? HOT 1
- am i asking for a lot? pushing for tcp performance and nbios hit the mark but... HOT 18
- curious about the "total success" HOT 28
- how to increase the eventloop from the tls server example? HOT 5
- only 2,000 req/s with redis client example but using tls server example modification, i can get 25,000 req/s. what's wrong? HOT 2
- 请教大佬,在很短的时间里,向同一个conn推送多次数据 HOT 8
- 使用udp发送数据,会存在丢包! HOT 14
- Retract v1.5.4 HOT 6
- how to set so reuseport option for server? HOT 2
- 1.5.6 仍可能存在潜在bug HOT 31
- What is the principle of realizing 10 million connections to a single server? HOT 2
- WS客户端发送超高压缩率内容,可导致服务器OOM HOT 15
- onClose 没有调用 HOT 2
- InsecureSkipVerify=false的时候,无法进行TLS连接 HOT 7
- 请教下关于二进制数据压缩的问题 HOT 3
- LetsEncrypt HOT 1
- 大佬有交流群吗 HOT 4
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 nbio.