Giter VIP home page Giter VIP logo

Comments (7)

panjf2000 avatar panjf2000 commented on May 22, 2024 1

嗯,我再考虑一下,thanks~

from gnet.

panjf2000 avatar panjf2000 commented on May 22, 2024

@rfyiamcool
抱歉,不太明白,你是说把 subReactors 做成任务队列吗?但是我不觉得这样是一个好的设计,本来用 epoll/kqueue 就是为了达到用少量 goroutines 来管理大量的 connections,没有必要加任务队列吧?

from gnet.

rfyiamcool avatar rfyiamcool commented on May 22, 2024

不好意思没说明白。
我的意思是说,如果我注册的业务方法有阻塞逻辑,比如访问db,那么subReactor也会阻塞,不能及时的去监听下一个事件。我看你在readme里又说,打算解决这个问题。把业务逻辑放到一个协程池里完成。

from gnet.

panjf2000 avatar panjf2000 commented on May 22, 2024

哦,我理解了。
关于阻塞的问题,的确是我在 README 里说的那个 multi-reactors + goroutine-pool 的模型来解决,现在还在做,估计这一两周内搞完吧!

from gnet.

rfyiamcool avatar rfyiamcool commented on May 22, 2024

我也基本想明白了实现方法,只是更想看下你的实现。 😁

from gnet.

panjf2000 avatar panjf2000 commented on May 22, 2024

@rfyiamcool
不过现在又有点纠结,主要是 goroutine pool 放置在哪一层,有两种方案:

  1. 网络层:直接集成 goroutine pool 在 gnet 库里面,每一次执行 Events.React() 方法时提交到 pool;
  2. 业务层:开放 goroutine pool 给 gnet 业务方,让业务方自己在写业务逻辑到 Events.React() 里面的时候适时使用 pool 来规避阻塞。

不知道你有没有什么看法?😀

from gnet.

rfyiamcool avatar rfyiamcool commented on May 22, 2024

我觉得各有各的优点吧。我想的是第一种,还是内敛在一起比较好,用参数来控制是否要池子。 个人看法。

from gnet.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.