Re: FD_SETSIZE limitation

From: Date: Fri, 20 Feb 2009 05:08:37 +0000
Subject: Re: FD_SETSIZE limitation
References: 1 2 3  Groups: php.internals 
Request: Send a blank email to internals+get-43128@lists.php.net to get a copy of this message
Hi, That's the reason why I started writing an ext for PHP that would implement epoll() on linux, and stuff-with-ws2 on Win32. However I don't mind making this a patch to the stream ext. Basically I get the following functions: consts: STREAM_POLL_IN (read) STREAM_POLL_OUT (write) STREAM_POLL_ONESHOT (other options exists on epoll, but are not portable. Some, like "oneshot" can easily be emulated) functions: resource stream_poll_create() bool stream_poll_destroy(resource $poll) array stream_poll_wait(resource $poll, int $timeout,int $maxevents = -1) bool stream_poll_add(resource $poll, stream $socket, int $wait_flags) bool stream_poll_mod(resource $poll, stream $socket, int $wait_flags) bool stream_poll_del(resource $poll, stream $socket) The goal is to use epoll() on linux, weird win32 stuff on win32 (thingie that converts socket to handler, then allows to use waitmultiple on that), kqueue on BSD and fallback to select on all other operating systems so those functions can be used anywhere. Anyway I was initially planning to use that internally, then maybe release it on pecl, it makes more sense to be inside ext/stream (I guess), so if anyone want to see it faster than that, why not. This can also be made OO, however the current stream ext has nothing OO, so I'm not sure it would make any sense. Anyway feedback about this is welcome, I've been wanting to write this for pinetd (those who heared about a PHP DNS Daemon should know what I mean) as using select() can become a problem when you want to handle a *lot* of clients. I am a bit demotivated, however if there is interest into this, or even if it can make it into ext/stream, I would be more than happy to finish/release that. Mark Le vendredi 20 février 2009 à 12:02 +0900, Moriyoshi Koizumi a écrit : > Robin Burchell wrote: > > On Thu, Feb 19, 2009 at 10:24 PM, Andrei Zmievski <andrei@gravitonic.com> wrote: > >> Can someone explain why ext/sockets and also stream socket functions care > >> about FD_SETSIZE? > > > > They care, because they use the select(2) syscall, which cares about FD_SETSIZE. > > > > select(2) itself can handle more fildes than FD_SETSIZE on Linux at least. > > Moriyoshi > >

« previous php.internals (#43128) next »