Comments (7)
嗯,我再考虑一下,thanks~
from gnet.
@rfyiamcool
抱歉,不太明白,你是说把 subReactors 做成任务队列吗?但是我不觉得这样是一个好的设计,本来用 epoll/kqueue 就是为了达到用少量 goroutines 来管理大量的 connections,没有必要加任务队列吧?
from gnet.
不好意思没说明白。
我的意思是说,如果我注册的业务方法有阻塞逻辑,比如访问db,那么subReactor也会阻塞,不能及时的去监听下一个事件。我看你在readme里又说,打算解决这个问题。把业务逻辑放到一个协程池里完成。
from gnet.
哦,我理解了。
关于阻塞的问题,的确是我在 README 里说的那个 multi-reactors + goroutine-pool 的模型来解决,现在还在做,估计这一两周内搞完吧!
from gnet.
我也基本想明白了实现方法,只是更想看下你的实现。 😁
from gnet.
@rfyiamcool
不过现在又有点纠结,主要是 goroutine pool 放置在哪一层,有两种方案:
- 网络层:直接集成 goroutine pool 在
gnet
库里面,每一次执行Events.React()
方法时提交到 pool; - 业务层:开放 goroutine pool 给
gnet
业务方,让业务方自己在写业务逻辑到Events.React()
里面的时候适时使用 pool 来规避阻塞。
不知道你有没有什么看法?😀
from gnet.
我觉得各有各的优点吧。我想的是第一种,还是内敛在一起比较好,用参数来控制是否要池子。 个人看法。
from gnet.
Related Issues (20)
- [Question]: gnet engine is stopping with error: kevent add|clear:function not implemented HOT 5
- [Question]: 您好大佬,这个库的epoll的底层实现是用纯go实现的吗?没有用到cgo是吧? HOT 1
- [Feature]: how to disable logging? replace uber zap with zerolog too pls HOT 3
- [Question]: The TechEmpower Benchmark is misleading, but can we make it even faster? HOT 1
- [Feature]: add synchronization for Conn to make it concurrency-safe HOT 1
- [Question]: What is the maximum number of cores tested by anyone? I just tested 192 cores and it's better than evio etc but... HOT 7
- [Question]: Will the OnTraffic function be called concurrently? HOT 1
- [Question]: Validate the approach of implementing persistent TCP connections. HOT 1
- [Bug]: Calling Dial() in version 2.4 of Windows 10 will block HOT 4
- [Question]: I would like to verify whether this problem in the screenshot will cause the memory of the service to slowly increase. HOT 1
- [Feature]: support edge-triggered I/O
- [Question]: Is the netpoll v1 version defaulting to horizontal triggering, and the V2 version defaulting to edge triggering? HOT 15
- [Bug]: fatal error: concurrent map read and map write HOT 1
- Inconsistent behaviors with SO_REUSEPORT on Linux and *BSD HOT 7
- Don't use SO_REUSEPORT on Unix domain sockets HOT 1
- Don't disable SO_REUSEPORT on DragonFlyBSD HOT 1
- [Question]: gnet client works not as expected even tho i did it according to the api ref HOT 1
- [Bug]: GNET client not working as expected HOT 4
- [Bug]: example gnet for echo tcp uses too much memory HOT 7
- [Bug]: Read returns io.ErrShortBuffer on closed connection HOT 7
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 gnet.