Date: Fri, 25 Apr 2003 02:44:03 +0200 From: Clement Laforet <sheepkiller@cultdeadsheep.org> To: freebsd-net@freebsd.org Subject: minor libalias/natd improvements (first snapshot) Message-ID: <20030425024403.6d727b2a.sheepkiller@cultdeadsheep.org>
next in thread | raw e-mail | index | archive | help
Hi guys, I've been working on extending the libalias LSNAT features, and as most of you surely know, incoming redirections have **REALLY** poor performance, due to links management (_FindLinkIn loop eats CPU cycles). So, I dug into libalias and try my best to make it work better :) Here's the stuff : - Add Redirections list + new hash for incoming packets (based on client address). This little workaround considerably improves natd incoming redirections/forwards speed (specially on heavy loaded servers), and uses less CPU time (ex: for _FindLinkIn 47% => 0.9% CPU time (according to gprof)) - Add two weighted round robin scheduling types, and prepare for more. Ex: A=1,B=2,C=3 rr: A,B,C,A,B,C,A,... wrr: A,B,C,B,C,C,A,... wsrr: A,B,B,C,C,C,A,... (useless, for testing only) - now, natd can be reloaded (killall -HUP natd) "All-in-one" tarball can be found here (natd-libalias.tar.gz): (I'll make a patch soon, after cleaning up the code) http://www.cultdeadsheep.org/sheepkiller/FreeBSD/patch-libalias/ Quick Howto ;-) #fetch http://www.cultdeadsheep.org/sheepkiller/FreeBSD/patch-libalias/natd-libalias.tar.gz # tar zxf natd-libalias.tar.gz # cd natd-libalias # make <nice warnings, aren't they ? ;)> # $EDITOR <your natd config file> To play with scheduling: redirect_port proto <scheduling> IP:port[@weight,IP:port[@weight]] [IP:]port ex : redirect_port tcp wrr 192.168.0.1:80@2,192.168.0.2:80,192.168.0.3@5 10.0.0.1:80 #./natd -f <your natd config file> # $EDITOR <your natd config file> # killall -HUP natd <scheduling> can be : rr,wrr,wsrr KNOWN BUGS: - wrr scheduling take second server for its first redirection. - Others are hidden ;-) TODO: 1. Add *RR to RedirectAddress and fix it [done] 2. Add more efficient load sharing/balancing scheduling types 3. Clean some dirty code (famous "FIX ME") 4. Separate natd/libalias 5. Patch ppp 6. Writing docs 8-) 7. a lot of tests 8. and more... BENCHMARKS: In progress... Advices are welcome :-) Feedback, comments, benchmarks, questions, insults, patches are welcome :-) regards, clem
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20030425024403.6d727b2a.sheepkiller>