Comments (4)
https://zh.wikipedia.org/wiki/%E7%92%B0%E5%BD%A2%E7%B7%A9%E8%A1%9D%E5%8D%80
在这里,我想一方面可以复用对象, 另外一方面心跳的一来一回正好和它的两个指针(write 和read)很像. 另外数组的实现比链表对CPU更友好
from goim.
无锁的一个ring 复用数据结构用的;
from goim.
@Terry-Mao 关于这个请教一个可能比较业余的问题。这里面的wp和rp都一定能保证原子性么?否则的话为什么就能保证线程安全呢。
另外有看到例如缓冲池的大小设置为5,如果消费能力很差的情况下,客户端连接就会断开,这个是出于什么目的呢?
from goim.
能保证原子,取决于CPU 平台,64的话,确实是原子,但是 不一定goroutine 可见,这个是一个问题,可以用atomic来处理,目前相对比较少遇到这种问题(不可见),不过确实不安全
缓冲池,根据业务可以调整;
from goim.
Related Issues (20)
- 任意room的一个消息是不是要被广播到所有的comet? HOT 3
- 项目不错,不过还是用自己的算了,目测go版本过于老旧,你应该及时更新go版本才对
- 如果goim里再加上微服务写在哪个模块比较好呢
- 多个线程处理同一个连接的目的 HOT 1
- comet 向客户端连接写入消息, protocol.go 文件中 WriteTCP方法,需要判断op == OpRaw, websocket缺不需要 HOT 1
- 消息堆积疑惑 HOT 1
- job是如何将消息推送到指定comnet? HOT 1
- step: 5 ws handshake timeout HOT 1
- job 消息丢失
- pkg/buffer可以直接用sync.Pool吧,为啥要自己实现一遍呢?
- 很多长连接(2w),仅连接保活,无业务情况,cpu忽然间隔很高:40%+
- 大量的房间或用户的情况下,无任何业务情况下,cpu间隔飙高30%
- 这么好的项目,感觉好久没更新了。有点可惜啊!! HOT 2
- 明显的逻辑问题,难道没人发现吗? HOT 6
- mac环境m1芯片不兼容discovery, 搞了docker容器把所有环境都装在里面了 一系列问题 老哥们来看看 HOT 5
- discovery 能把这个服务发现注册换成其他的吗。这个discovery好像早就没维护了。而且除了2.*版本其他也不兼容 HOT 1
- A vulnerability has been fixed, but no specific tag denotes the patched version.
- Vulnerability of dependency "github.com/gin-gonic/gin"
- 看代码遇到困惑的地方,请教下为啥discovery://default/goim.logic 这个地址可以直接 dail HOT 1
- online demo not working
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 goim.