Hi,
Is that lighttpd thing multithreaded? Because if you issues enough
(e.g. 50) blocking reads concurrently, it should give a very good
performance (probably even better than any of aio/epoll). But there is
still a problem with thread consumption. Currently in Go if one
carelessly issue file reads from lots of goroutines, it can cause
creation of basically infinite amount of threads.
I think it's worth doing.
What OSes are you interested in? I would expect windows to be the
easiest to implement.
Do you know how to implement it on linux?
The following program fails with:
epoll_ctl: Operation not permitted
EPERM The target file fd does not support epoll.
#include <sys/epoll.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <stdio.h>
int main(void) {
struct epoll_event evt = { .events = EPOLLIN };
int ep, fd;
ep = epoll_create1(0);
if (ep == -1) { perror("epoll_create"); return 1; }
fd = open("/bin/ls", O_RDONLY | O_NONBLOCK);
if (fd == -1) { perror("open"); return 1; }
if (epoll_ctl(ep, EPOLL_CTL_ADD, fd, &evt) == -1) {
perror("epoll_ctl"); return 1; }
return 0;
}
As far as I know, aio used a background pool of threads on linux,
which is absolutely unacceptable for Go. And I would like to not have
the second IO dispatcher for files.
In any case, here is the issue to track this:
https://code.google.com/p/go/issues/detail?id=6222
A good start may be creating a benchmark and estimating size of the problem.