Epoll and Select Overhead

I benchmarked epoll() and select() one more time, this time restricted to _one_ FD which becomes readable. This benchmark reflect therefore the most crucial possible performance measurement. And which came as no surprise, select() perform worse. A possible poll() graph should be equal to the select() graph. But as I said before: I am not interested in poll().

January 23, 2011 · 1 min · Hagen Paul Pfeifer

Mass Parallel Network Processing Architecture

Yesterday and today I wrote an ANSI C program to demonstrate how a non-blocking, threaded network server for current SMP/CMP systems may be structured. The design of the server is constructed in a way that all CPU may stressed and load is fair balanced. All thread local clients are multiplexed via a event loop management wrapper (epoll() or select()). The program demonstrate the most effective architecture for current CMP/SMP server systems....

January 23, 2011 · 2 min · Hagen Paul Pfeifer

Link Equilibrium and Oversized Router Buffer

Jim Gettys wrote an blog entry where he describe problems with a oversized router buffer - he called the problem bufferbloat. Buffer in network equipment exist to catch temporary load peaks and allow proper internal packet exchange from one linecard to another linecard in coexist with the max. bandwidth. In the case where buffers are overestimated the effect get worse during periods of network congestion. Overestimated buffer will shift the problem in time, or in other words: TCP will overestimate the available capacity and normal congestion avoidance mechanisms do not timely take effect....

January 20, 2011 · 1 min · Hagen Paul Pfeifer

Epoll versus Select

I finished the select() backend for libeve Thus libeve can be compiled under nearly every operating system in this solar system (I didn’t even tried it, but the functional components are ready). Primary focus was and is Linux, I am not necessarily interested in other systems. Under Linux epoll/timer_fd is the best what you can do if you want to do. Under {Free, Net, Open, …}BSD kqueue should be the most performant implementation, but doe to lack of time and interest it isn’t implemented and select() should be fine too....

January 19, 2011 · 1 min · Hagen Paul Pfeifer

IPv6 Address Assignment to End Sites

IAB/IESG Recommendations on IPv6 Address Allocations to Sites (“RFC 3177”:http://tools.ietf.org/html/rfc3177) provides recommendations that for end sites a @/48@ block should be provided in normal case. A @/64@ block when it is absolutely sure that only one subnet is needed and @/128@ for the case that only one device is connected. The requirements for IPv6 in 1993 included the plan that the next IP version should address approximately 2^40^ networks and 2^50^ hosts....

January 5, 2011 · 2 min · Hagen Paul Pfeifer

Chi Square Test and Cryptographic Hash Functions

The Chi-Square probe is a statistical hypothesis test. The here presented values show the distribution of several hash algorithms compared to the cryptographic SHA1. Currently I am too lazy to explain the algorithm in great detail. Wikipedia is a great source for an introduction. The analysis is part of libhashish and available in the analysis directory.

December 8, 2010 · 1 min · Hagen Paul Pfeifer

SMP and too Optimistic Compiler Optimization

In a nowadays common SMP/CMP environment with more then one CPU it is necessary to protect global/shared data in the kernel. One prominent example are sysctl_ variables. Sysctl variables are protected via a spin lock (sysctl_lock). This look protect the /proc/sysctl interface path, the look itself does not protect the usage path itself. Consider the following example: int global\_val; int foo(void) { if (global\_val != 0) { int res = bar(); return res / global\_val; } return -1; } Here global_val is a global accessible variable....

December 7, 2010 · 2 min · Hagen Paul Pfeifer

Hoist Function Subexpression Elimination

Function calls embedded in loop constructs are a area of optimization. As a general statement: it is clever to hoist any method calls from loop statments like for, while and the like where the result is constant (eliminating redundant computation is a standard optimization mechanism). For example, often you will see constructs like for (i = 0; i < strlen(str); i++) { whatever }. strlen() is evaluated every time, although str does never change....

December 5, 2010 · 2 min · Hagen Paul Pfeifer

Jump Table Optimization For If Else Constructs

This blog post is not about micro-optimization nor about what you have to use. Neither, it is about how compilers can optimize two common flow constructs. The knowledge may provide enough background information to sharpen the view and provides enough insights what construct to use for which usage. The following if-else statement is compiled on x86_64 with -O6 into the following ASM sequence: int main(int ac, char \*\*av) { if (a == 0) foo(); else if (a == 1) bar(); else if (a == 2) shu(); } [....

December 4, 2010 · 3 min · Hagen Paul Pfeifer

My Baby Is Gone

My baby was my lovely Canon EOS 7D. And I lost the camera during the flight back from the IETF meeting in Beijing/China to Frankfurt/Germany. It is a story about how scatterbrained a man can be. ;-) I deposited the camera under the seat in front of me. After the plane landed and all passengers surrounding me left the plane I left the plane too - without the camera …...

December 4, 2010 · 2 min · Hagen Paul Pfeifer