From owner-freebsd-questions@FreeBSD.ORG Fri Jan 22 21:06:50 2010 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 19AD1106568B for ; Fri, 22 Jan 2010 21:06:50 +0000 (UTC) (envelope-from cswiger@mac.com) Received: from asmtpout029.mac.com (asmtpout029.mac.com [17.148.16.104]) by mx1.freebsd.org (Postfix) with ESMTP id 01CB88FC18 for ; Fri, 22 Jan 2010 21:06:49 +0000 (UTC) MIME-version: 1.0 Content-transfer-encoding: 7BIT Content-type: text/plain; charset=us-ascii Received: from [17.151.81.204] by asmtp029.mac.com (Sun Java(tm) System Messaging Server 6.3-8.01 (built Dec 16 2008; 32bit)) with ESMTPSA id <0KWO004PY2NCGN90@asmtp029.mac.com> for freebsd-questions@freebsd.org; Fri, 22 Jan 2010 13:06:49 -0800 (PST) X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 spamscore=0 ipscore=0 phishscore=0 bulkscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx engine=5.0.0-0908210000 definitions=main-1001220237 From: Chuck Swiger In-reply-to: <6201873e1001221221g5491ba85l75fd6d6f01c009f@mail.gmail.com> Date: Fri, 22 Jan 2010 13:06:48 -0800 Message-id: <9453972A-7AE8-4E4E-825F-2514BB36CA45@mac.com> References: <20100122200138.GA19469@cabstand.com> <6201873e1001221221g5491ba85l75fd6d6f01c009f@mail.gmail.com> To: Adam Vande More , Chris Peiffer X-Mailer: Apple Mail (2.1077) Cc: freebsd-questions@freebsd.org Subject: Re: ISO simple non-forking TCP connection forward/balance tool X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 22 Jan 2010 21:06:50 -0000 Hi-- On Jan 22, 2010, at 12:21 PM, Adam Vande More wrote: > A few lines in python should do what you're looking for, see socket lib, > twisted if you have high performance needs. I'm a big fan of python, but you'd have to be careful to choose the right processing model-- some sort of select()/poll()/kqueue() wrapper with nonblocking I/O and process-towards-completion semantics rather than trying to do multithreaded approach, since the GIL will really interfere with concurrency. Note that the intended usage also matters quite a bit. For example, NAT-based solutions depend on the destinations being up all of the time and will happily drop a third (or whatever) of the traffic into the void if one of the backend boxes is down or a service is unresponsive. Software-based load-balancers which recognize and route around downed ports or boxes play nicer for this sort of thing, as do H/W load-balancer solutions like Foundry ServerIrons & Citrix NetScalers, which have liveness checks built in to test destinations and make sure they stay up before distributing traffic onto them. There's also a question of whether the traffic ought to be stateful beyond individual connections, in which case software-based solutions like FastCGI or WebObjects which support session affinity are a much better idea than trying to write stateless services which have to persist to a backend database or something along those lines for every request. Regards, -- -Chuck