TE
科技回声
首页24小时热榜最新最佳问答展示工作
GitHubTwitter
首页

科技回声

基于 Next.js 构建的科技新闻平台,提供全球科技新闻和讨论内容。

GitHubTwitter

首页

首页最新最佳问答展示工作

资源链接

HackerNews API原版 HackerNewsNext.js

© 2025 科技回声. 版权所有。

Evio – Fast event-loop networking for Go

281 点作者 Acconut超过 7 年前

9 条评论

tidwall超过 7 年前
This project is not intended to be a general purpose replacement for the standard Go net package or goroutines. It&#x27;s for building specialized services such as key value stores, L7 proxies, static websites, etc.<p>You would not want to use this framework if you need to handle long-running requests (milliseconds or more). For example, a web api that needs to connect to a mongo database, authenticate, and respond; just use the Go net&#x2F;http package instead.<p>There are many popular event loop based applications in the wild such as Nginx, Haproxy, Redis, and Memcached. All of these are single-threaded and very fast and written in C.<p>The reason I wrote this framework is so I can build certain network services that perform like the C apps above, but I also want to continue to work in Go.
评论 #15625293 未加载
评论 #15627163 未加载
crawshaw超过 7 年前
One of my favorite things about Go is that it cuts through the &quot;threads vs. events&quot; debate by offering thread-style programming with event-style scaling using what you might call green threads (compiler assisted cooperative multitasking that has the programming semantics of preemptive multitasking).<p>That is, I can write simple blocking code, and my server still scales.<p>Using event loop programming in Go would take away one of my favorite things about the language, so I won&#x27;t be using this. However I do appreciate the work, as it makes an excellent bug report against the Go runtime. It gives us a standard to hold the standard library&#x27;s net package to.
评论 #15625394 未加载
评论 #15626665 未加载
评论 #15627685 未加载
olivierva超过 7 年前
The Go network stack already makes use of epoll and kqueue: <a href="https:&#x2F;&#x2F;golang.org&#x2F;src&#x2F;runtime&#x2F;netpoll_epoll.go" rel="nofollow">https:&#x2F;&#x2F;golang.org&#x2F;src&#x2F;runtime&#x2F;netpoll_epoll.go</a> So I&#x27;m not quiet sure why this would be faster since almost all I&#x2F;O in Go is event driven, including the networking stack.
评论 #15624632 未加载
评论 #15624614 未加载
fooyc超过 7 年前
I love Go because I never had to write asynchronous, callback driven programs in this language. I hope it won&#x27;t become the norm in Go, too.
评论 #15625184 未加载
indescions_2017超过 7 年前
I&#x27;d be interested in the level seven reverse proxy application. As well as unix domain socket message queues. There are probably many other places in the networking pipeline evio could provide a boost.<p>It&#x27;s a testament to what is possible through the &quot;syscall&quot; and &quot;golang&#x2F;x&#x2F;sys&quot; facilities. As well as your confidence in playing with Linux internals ;)
评论 #15625164 未加载
bsaul超过 7 年前
Not sure i understand what the use case is. As soon as you start doing something on the event loop , you need some kind of way to perform the operation in another &quot;thread&quot; ( or goroutine or whatever). And then you start to need some kind of concurrency mechanism, and pay the price.<p>Stripping those mechanism to pretend the event handling is faster only works if you never intend to have some real computation performed. That&#x27;s never true in practice... Or am i missing something ?
评论 #15625282 未加载
brian-armstrong超过 7 年前
At this point, why not just use C++? I feel like people are trying to stretch Go way past what it&#x27;s good for. It&#x27;s not going to replace C++ where C++ is effective, and it shouldn&#x27;t :)
评论 #15626678 未加载
adrianratnapala超过 7 年前
Worst of both worlds, only faster?
cdoxsey超过 7 年前
This is single-threaded? What are you going to do with the other 31 or 63 cores?<p>The single-threaded nature of applications liked Redis an Haproxy is a singificant impediment to their vertical scalability. CPUs aren&#x27;t getting faster, we&#x27;re just going to get more cores, so anything that assumes there&#x27;s only a single core seems like a dead end.<p>Haproxy literally just added multithreading support in 1.8.
评论 #15626858 未加载
评论 #15626865 未加载