From dev-return-21383-apmail-apr-dev-archive=apr.apache.org@apr.apache.org Tue Feb 10 06:40:10 2009 Return-Path: Delivered-To: apmail-apr-dev-archive@www.apache.org Received: (qmail 56211 invoked from network); 10 Feb 2009 06:40:08 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 10 Feb 2009 06:40:08 -0000 Received: (qmail 68441 invoked by uid 500); 10 Feb 2009 06:40:04 -0000 Delivered-To: apmail-apr-dev-archive@apr.apache.org Received: (qmail 68374 invoked by uid 500); 10 Feb 2009 06:40:04 -0000 Mailing-List: contact dev-help@apr.apache.org; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Id: Delivered-To: mailing list dev@apr.apache.org Received: (qmail 67679 invoked by uid 99); 10 Feb 2009 06:40:04 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 09 Feb 2009 22:40:03 -0800 X-ASF-Spam-Status: No, hits=-0.0 required=10.0 tests=SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: local policy) Received: from [162.105.129.22] (HELO water.pku.edu.cn) (162.105.129.22) by apache.org (qpsmtpd/0.29) with SMTP; Tue, 10 Feb 2009 06:39:53 +0000 X-scanvirus: By EQAVSE AntiVirus Engine X-scanresult: CLEAN X-MAILFROM: X-RCPTTO: X-FROMIP: 162.105.80.103 X-EQManager-Scaned: 1 X-EQAUTHUSER: 68376 X-Received:unknown,162.105.80.103,20090210143930 Received: from unknown (HELO bspc0) (68376@162.105.80.103) by localhost with SMTP; 10 Feb 2009 06:39:30 -0000 Message-ID: <1ED067E8EA3B4ABC85180EAB36ABC325@bspc0> From: "Bing Swen" To: , References: <498FF67B.3030900@apache.org> Subject: Re: [WIN32] Using WSAPool for Vista+ Date: Tue, 10 Feb 2009 14:38:05 +0800 MIME-Version: 1.0 Content-Type: text/plain; format=flowed; charset="ISO-8859-1"; reply-type=response Content-Transfer-Encoding: 7bit X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 6.00.3790.3959 X-MIMEOLE: Produced By Microsoft MimeOLE V6.00.3790.4325 X-Virus-Checked: Checked by ClamAV on apache.org "Mladen Turk" wrote on 2009-2-9 17:25 > Hi, > > Vista (Server 2008) and up comes with new winsock WSAPoll API. > Now I did some experiments and it compiles the unix/pool.c > by simply changing poll( ... ) to WSAPoll(...) > > There is also no limitation on pollset size (currently > select is limited to FD_SETSIZE 1024, cause it's too slow > for higher numbers). Well, the testpoll.c passes > with 16K sockets. > Httpd works like a charm with 10K connections. > > Now the problem is that to be able to use it, > we would need a pollset implementation > provider that will dynamically switch back to select in case > winsock doesn't defines WSAPoll. > > That makes me think we can have that generic, allowing > different pollset providers for non-windows platforms > as well (If it makes sense of course), eg. something > like we have for proc_mutex. > (apr_proc_mutex_unix_lock_methods_t would actually become > apr_poll_methods_t allowing choosing different > poll providers, again where it makes sense) > As I've learned , WSAPoll was designed to behave just like the Unix poll(), but it seems to have got counterpart performance of Linux epoll. Some Windows port of Nginx has used WSAPoll to simulate its ngx_poll_module.c on Windows 6.x (Vista and 2008), and seems to achieve the same performance improvement. Though like poll(), this is just a single-threading I/O model, and thus it should be less efficient than the IOCP (completion port) API. It's not uncommon for a single online game or IM server that uses IOCP to handle 100K+ (slow & long-duration) connections with quite a few (4~8) threads. But there seems no reason not to use WSAPoll to implement apr_pollset_t (when _WIN32_WINNT >= 0x0600), at least for such performance gain. That could also benefit httpd a lot, e.g., the worker MPM of httpd using apr_pollset_t will be easily ported to Windows 6+, and possibly has the same (or much better?) network I/O performance than the current Windows MPM version winnt_mpm, which currently uses a suboptimal ICOP scheme. Bing ---- School of EECS Peking University