[nzlug] Is anyone familiar with socat (Multipurpose relay)

Martin D Kealey martin at kurahaupo.gen.nz
Fri Sep 21 16:28:59 NZST 2007


On Thu, 20 Sep 2007, Daniel Pittman wrote:
> > This is what i have so far:
> >
> > socat UNIX-LISTEN:/var/run/mysqld/mysqld.sock,fork,user=mysql,group=mysql
> > TCP4:external.mysql.host:3306
> >
> > But im getting connection failed in mysql client.
>
> ...er, just out of interest: wouldn't it be much easier to configure
> your mysql client software to talk TCP directly rather than trying fancy
> tricks with redirection of the Unix socket?

Actually, I *seriously* have a need for this right now.

And the reason is performance: with a 2.6 Linux kernel running with 2 CPUs
under VMware you're hard pressed to establish more than a few hundred, maybe
a thousand or so outbound TCP connections per second. Reason being the
spin-locks around the kernel memory allocator, which sit and wait for the
next clock tick a lot of the time.

Unix sockets have no such limitation.

Why do I need so many connections?

Because Exim doesn't "pool" connections to database servers: each message
runs in a separate process, indeed possibly more than one if you segregate
inbound and outbound SMTP processing.

So you're limited to only a hundred or so email messages per second, per
server. (Those of you who know where I work will understand why I consider
this to be a serious limitation.)

At the moment I'm hanging out for Exim5, which will have a bunch of smart
pluggable modules, and will almost certainly include database connection
pooling. I'm not interested in debating the merits of other MTAs; I already
know about PosfFix and QMail; they have even more serious limitations where
I'm at.

-Martin



More information about the NZLUG mailing list