Giter Site home page Giter Site logo

antlabs / greatws Goto Github PK

View Code? Open in Web Editor NEW
76.0 76.0 5.0 339 KB

100w连接仅需500-700MB内存,针对海量连接特别优化的websocket库(kqueue, epoll),高性能,callback写法,在服务器cpu上有不俗表现 https://github.com/antlabs/greatws-example

License: Apache License 2.0

Go 98.78% Makefile 0.90% Shell 0.32%
rfc6455 websocket

greatws's People

Contributors

guonaihong avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

greatws's Issues

v0.1.x版本需要完成的功能

1. kqueue 对接完成,完成autobahn的测试
2. epoll 对接完成,完成autobahn的测试
3. go 程池
4. go程的拆分,分成一个全局的,和一个本地的
5. oneshot支持
6. 内存池复用率的优化
7. 有序性保证,对于语音类的长连接每个包接收顺序和发生顺序必须一样。
8. 定时器
9. 性能优化(当然这是最重要的)

v0.2.x版本

  1. iocp 对接完成(windows对于dup之后的socket 加入iocp有问题,可能要自定义http接入层支持下)
  2. tls支持
  3. 验证下同步和异步的连接公正性长尾现象
  4. iouring 对接完成

Conn无锁的一致性问题

扫了几眼,可能会有窜号问题,假设:

step 1: 应用模块A有close:
https://github.com/antlabs/bigws/blob/master/conn_unix.go#L45
或者event loop收到对端EOF后close了fd

step 2: 此时Conn被应用模块B协程池持有,并且正执行Write、马上要syscall但尚未syscall:
https://github.com/antlabs/bigws/blob/master/conn_unix.go#L61

step 3: 新的连接到来,被分配了这个fd

step 4: step 2中执行到了syscall write,数据被写入到了新的fd中

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.