Giter Club home page Giter Club logo

Comments (1)

veaba avatar veaba commented on June 19, 2024

这是其中一个,主要造成卡滞的问题,在本地开发过程有几个表现:

  1. 现在的设计逻辑是:
    -> A用户授权,然后socket.io
    -> 丢到kafka生产者里面
    -> 通过将这条弹幕丢到mongodb的弹幕日志里面以便,新用户连接上来就可以拉取到过完的弹幕日志
    ->消费者逐条读取到该日志
    ->通过socket.io 发送给全体在线用户

  2. kafka是集群化的,本身功能强大,被我玩炸了,上前面一条的基础上,这个过程有一定的折返,会消耗些时间,尤其是表现在第一次

  3. 本地化开发的时候,socket.io 如果频繁刷新,就会挂起在socket.on 事件里面,没有响应,尤其是小于1s的频繁连接,这个表现的很奇怪

  4. 弹幕从右侧滚进来视口的阈值有关系,会看起来好久才出来,这个是可以优化的,

  5. 综上所述,移除kafka这一层,单用socket通信,确实可以提供响应速度。拓展来讲,如果在线用户很多,很难使用单台机器来维持用户的socket通信,那样负担太大了,可以考虑大用户量的场景。

  6. kafka本身就不应该用于实时数据的场景吧~

这个项目可以认为是一个学习型项目,可以在它的基础上,做到的更极致。

from ncov.

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.