Building High Performance Networking Servers using Tcl

“Tcl as a network server? This can’t be possible. Isn’t Tcl much slower than C? Won’t the clients suffer from scripting language latency? Well, yes C, C++, Java and even Perl does raw networking faster than Tcl, but none of them (without serious customization or third party libraries) have Tcl’s secret weapon: The Event Loop. That and the well thought out (and decently abstracted) I/O system makes for an excellent prototyping and a suprisingly robust production environment.

Most of the following idioms focus on how to Tcl to build safe, reliable servers in short time. Some of the idioms may seem small or obvious, but combined they can create powerful servers. I have built custom SMTP servers, transaction managers, checkpointing message journals, in-memory databases, tuplespaces and network stress testers in Tcl with a focus on robustness, scaling and performance.

In a 100Mbit network, a single Tcl process may not be able to keep up consuming a full pipe, but most systems don’t employ a single process to handle a constantly full pipe of data. In a system where performance is measured by transactions per second, with the exception of hardcore processing, Tcl is up to the task.

Tcl is slower than C, but the network is slower than Tcl…”

http://www.maplefish.com/todd/tcl_net_idioms.html