gocat, a 21st-century multi-purpose relay from source to destination

Anton Antonov
2 min readFeb 17, 2020

--

Photo by Catherine Heath on Unsplash

Enter https://github.com/sumup-oss/gocat

Faster Golang alternative of socat.

Multi-purpose relay from source to destination.

A relay is a tool for bidirectional data transfer between two independent data
channels.

Supported source-to-destination relays:

* TCP to Unix,
* Unix to TCP.
* Need something else? Feel free to open an issue to discuss it or shoot a Pull Request.

Why?

* Significantly faster than socat with medium and larger message payloads.
* Static binary, it just works. TM
* Actively health checks the source to prevent hanging/zombified source connections. (initial reason why socat didn’t work for us)

Why not?

* socat performs slightly better with small message payloads.

Where it’s used?

At SumUp we use it as a backbone for infrastructure and deployment system(s) that:
* need to relay SSH protocol,
* proxy to TCP -> Unix or vice-versa where speed
* have reliability as an important concern.

As a now open-source project of SumUp, we hope that we find more use-cases together.

Benchmarks

How the benchmarks work

Benchmarks are sending a message from the destination, relaying via gocat/socat to the source, which is an echo server that relays back to the destination via gocat/socat.

Reading the benchmarks:

X axis is the message payload size.

Y axis is throughput as per golang test’s -count argument, which benchmarks only the sending and receiving of a message sync or async.

TCP to UNIX

Unix to TCP

Benchmarking mistakes?

Think we can improve them or got something wrong? Feel free to open an issue to discuss it.

We want the best possible benchmark and opportunity to improve the software!

Usage and more, continue reading at https://github.com/sumup-oss/gocat

About SumUp

It is our mission to make easy and fast card payments a reality across the entire world. You can pay with SumUp in more than 30 countries, already. Our engineers work in Berlin, Cologne, Sofia and Sāo Paulo. They write code in JavaScript, Swift, Ruby, Go, Java, Erlang, Elixir and more. Want to come work with us? Head to our careers page at https://sumup.com/careers to find out more.

--

--