Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/apokalyptik/tcp-cl-proxy
A TCP Proxy designed to limit concurrency
https://github.com/apokalyptik/tcp-cl-proxy
Last synced: 3 months ago
JSON representation
A TCP Proxy designed to limit concurrency
- Host: GitHub
- URL: https://github.com/apokalyptik/tcp-cl-proxy
- Owner: apokalyptik
- License: gpl-2.0
- Created: 2014-12-31T22:46:25.000Z (about 10 years ago)
- Default Branch: master
- Last Pushed: 2021-08-18T17:15:58.000Z (over 3 years ago)
- Last Synced: 2024-07-16T13:08:51.580Z (7 months ago)
- Language: Go
- Size: 391 KB
- Stars: 6
- Watchers: 1
- Forks: 2
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
tcp-cl-proxy
============A TCP Proxy designed to limit concurrency
### Why?
Sometimes have a service listening on a TCP port which can be easily overwhelmed by concurrent requests. Additionally, for whatever reason, the service does not have any method for limiting its own resource usage or concurrency. When you do not have the ability (closed, missing, or untouchable source code) or resources (time, money, etc) to properly fix the service yourself you can use this very simple proxy for limiting concurrency as a man in the middle.
### How does it work?
```
Usage of ./tcp-cl-proxy:
-c=1: Number of active connections allowed to proxy address at a given time
-l="127.0.0.1:8301": Listen for TCP connections at this address
-p="127.0.0.1:8300": Proxy connected clients to this address
-s="127.0.0.1:8299": Give stats to clients connecting to this address
```When a new connection comes in and the number of active connections is already at the configured maximum the proxy simply accepts the new connection and waits until an active connection finishes. When a free active connection slot opens up one (and only one) new connection to the service is made to service one additional waiting client.
Additionally the proxy provides a second listening socket on which to test livliness and gather simple stats. This port is good for use with things like monit, nagios, munin, etc. It simply returns the number of active and waiting connections, and then disconnects.
### How to obtain this software
If you have a working Go environment setup ([which is very easy to set up](http://golang.org/doc/install)) then simply running the following command should be sufficient to compile the binary into $GOPATH/bin
```bash
go get github.com/apokalyptik/tcp-cl-proxy
```