nbio

nbio是一个用Go语言实现的事件驱动、非阻塞IO的高性能网络框架,支持百万级并发连接,特别适用于海量连接场景,能显著降低内存和GC开销。

Check out nbio on CurateClick

• Copy the embed code to showcase this product on your website

• Share on X to spread the word about this amazing tool

推荐项目<!-- 这里是 HelloGitHub 月刊推荐项目的入口,欢迎自荐和推荐开源项目,唯一要求:请按照下面的提示介绍项目。--><!-- 点击上方 “Preview” 立刻查看提交的内容 --><!--仅收录 GitHub 上的开源项目,请填写 GitHub 的项目地址-->- 项目地址:https://github.com/lesismal/nbio<!--请从中选择(C、C#、C++、CSS、Go、Java、JS、Kotlin、Objective-C、PHP、Python、Ruby、Rust、Swift、其它、书籍、机器学习)-->- 类别:Go<!--请用 20 个左右的字描述它是做什么的,类似文章标题让人一目了然 -->- 项目标题:nbio是一个golang实现的事件驱动、非阻塞IO的百万连接解决方案<!--这是个什么项目、能用来干什么、有什么特点或解决了什么痛点,适用于什么场景、能够让初学者学到什么。长度 32-256 字符-->- 项目描述:1. 旨在解决标准库net包处理海量连接场景的巨大协程内存/GC开销和STW问题;2. 支持非阻塞TLS/HTTP/Websocket,HTTP基本兼容标准库,gin/echo/chi等框架的项目也可以使用nbio驱动网络IO;3. HTTP/Websocket支持多种IOMod,可以根据特定场景让性能与资源消耗更加平衡、让服务更加稳定。<!--令人眼前一亮的点是什么?类比同类型项目有什么特点!-->- 亮点:1. Websocket百万连接、1k payload echo测试,server 4核1G低配仍能 10w qps,相比于标准库方案百万连接8-10G内存起步,海量连接场景节约大量硬件资源、运行稳定;2. 相比于同类Poller框架,性能良好不低于竞品,功能更加丰富自带TLS/HTTP/Websocket支持;3. 虽然事件驱动异步非阻塞,但配合协程池,HTTP/Websocket或其他实现的协议,应用层业务代码仍然可以像标准库一样编写同步代码,具有良好的易用性。- 示例代码:(可选)golangpackage mainimport ("fmt""net/http""github.com/lesismal/nbio/nbhttp")func main() {mux := &http.ServeMux{}mux.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {fmt.Fprintf(w, "hello world")})engine := nbhttp.NewEngine(nbhttp.Config{Network: "tcp",Addrs: []string{"localhost:8080"},Handler: mux,})err := engine.Start()if err != nil {fmt.Printf("nbio.Start failed: %v\n", err)return}defer engine.Stop()<-make(chan int)}- 后续更新计划:持续维护修复各类bug、简化优化代码,希望未来有档期支持HTTP2.0/3.0。

Latest Weekly Picks

make.ink favicon
Weekly Pick

Your AI tattoo generator for pro-grade concepts

Leo Wade
sellfy.com favicon
Weekly Pick

A code-free online store builder to turn views into revenue. Sell digital products, subscriptions, and merch, without fees or hassle.

Maris
www.videotoblog.ai favicon
Weekly Pick

Convert videos into awesome blog posts.

Video To Blog
www.sellerpic.ai favicon
Weekly Pick

SellerPic is the all-in-one AI design platform for e-commerce

SellerPic
fastimage.ai favicon
Weekly Pick

Fast Image AI instantly transforms your photos into stunning styles like Ghibli, Sketch, and Pixar. Effortlessly control image elements and create amazing effects with just one click.

Fast AI Team
linkedinpro.daisy.so favicon
Weekly Pick

AI-powered tool that transforms casual photos into professional LinkedIn headshots instantly. No photographer needed—just upload and download.

Gabriel
crevas.ai favicon
Weekly Pick

Crevas unifies Veo 3, Sora 2, Nano Banana and more into one intuitive canvas — so filmmakers can script, prompt, and generate cinematic stories without switching tools or losing consistency.

Spark Alpha
fotominiatur.com favicon
Weekly Pick

AI Foto Edit - Text to Image & Image Edit

foto miniatur