From owner-freebsd-performance@FreeBSD.ORG Tue Sep 27 12:31:26 2005 Return-Path: X-Original-To: freebsd-performance@freebsd.org Delivered-To: freebsd-performance@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 3756216A41F; Tue, 27 Sep 2005 12:31:26 +0000 (GMT) (envelope-from is@rambler-co.ru) Received: from yam.park.rambler.ru (yam.park.rambler.ru [81.19.64.116]) by mx1.FreeBSD.org (Postfix) with ESMTP id 64CBA43D5A; Tue, 27 Sep 2005 12:31:24 +0000 (GMT) (envelope-from is@rambler-co.ru) Received: from is.park.rambler.ru (is.park.rambler.ru [81.19.64.102]) by yam.park.rambler.ru (8.13.3/8.13.3) with ESMTP id j8RCVMhF063409; Tue, 27 Sep 2005 16:31:22 +0400 (MSD) (envelope-from is@rambler-co.ru) Date: Tue, 27 Sep 2005 16:31:22 +0400 (MSD) From: Igor Sysoev X-X-Sender: is@is.park.rambler.ru To: Xin LI In-Reply-To: <1127101042.788.30.camel@spirit> Message-ID: <20050927162014.M65594@is.park.rambler.ru> References: <1127101042.788.30.camel@spirit> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed Cc: freebsd-performance@freebsd.org, freebsd-arch@freebsd.org Subject: Re: Combine more operation within one system call: to do it, or not to do it? X-BeenThere: freebsd-performance@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Performance/tuning List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 27 Sep 2005 12:31:26 -0000 On Mon, 19 Sep 2005, Xin LI wrote: > It seems that Microsoft has recently revised several of their APIs. One > example is their ConnectEx(), as found in documentation [1]. The > implementation is not so complex that it just combines more operation > within one system call, however, this can reduce some unnecessary > context switches as it's now possible to do more things within one > system call. (For instance, when you connect to a server, you usually > want to send some data as request). > > Shall we do something similar? Or do we already done something similar? > > [1] > http://msdn.microsoft.com/library/default.asp?url=/library/en-us/winsock/winsock/connectex_2.asp Actually, ConnectEx() was implemented to allow to post an asynchronous connect operations to the i/o completion ports. There is no API to implement high perfomance proxy in Windows NT and 2000. You have to use non-blocking connect() and then pass the socket to special helper threads that wait in WSAWaitForMultipleEvents() when the sockets would be connected. Each thread could handle up to 63 sockets only. Igor Sysoev http://sysoev.ru/en/