C:epoll的和多线程 [英] C: epoll and multithreading

查看:255
本文介绍了C:epoll的和多线程的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要建立专门的HTTP服务器,为了这个,我打算使用epoll的sycall,但我想利用多处理器/内核,我不能拿出架构解决方案。
ATM我的想法是followng:创建自己的epoll的描述多线程,主线程接受连接和线程的epoll之间分配他们。
但有没有更好的办法呢?哪些书/文章/导游,我可以读高负荷的架构?我只看到 C10K 的文章,但大多数链接的例子是死:(仍然没有深入对这款本本主题:(

I need to create specialized HTTP server, for this I plan to use epoll sycall, but I want to utilize multiple processors/cores and I can't come up with architecture solution. ATM my idea is followng: create multiple threads with own epoll descriptors, main thread accepts connections and distributes them among threads epoll. But are there any better solutions? Which books/articles/guides can I read on high load architectures? I've seen only C10K article, but most links to examples are dead :( and still no in-depth books on this subject :(.

感谢您的答案。

UPD:请更具体,我需要的材料和实例(Nginx的不是一个例子,因为它太复杂,有多个抽象层来支持多个系统)

UPD: Please be more specific, I need materials and examples (nginx is not an example because its too complex and has multiple abstraction layers to support multiple systems).

推荐答案

并的 libev 来源。他们具有很强的可读性,并且已经用良好的基础设施。

check libevent and libev sources. they're highly readable, and already a good infrastructure to use.

此外,libev的文档有很多的一些尝试和真正的战略事例。即使你preFER直接写的epoll(),该实例可以导致一些见解。

Also, libev's documentation has plenty of examples of several tried and true strategies. Even if you prefer to write directly to epoll(), the examples can lead to several insights.

这篇关于C:epoll的和多线程的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆