This is a creation in Article, where the information may have evolved or changed.
Easyproxy, easy-to-use TCP proxy
Recently encountered in the work golang of the project, a little bit of interest in it, intends to seriously study, just in the building mysql of the main environment when found that if the use of an agent to test their own will be more convenient (mainly to build wheels), so this based on Golang tcp proxy The project produced
Demand
Because it is to learn golang, we should use the basic knowledge of Golang as far as possible to implement the agent basic function.
Not really simple to play, learn a thing in addition to enrich the brain, but also in order to have practical use, so it is necessary to engineering
The program is not too complicated, after all, this is my first golang project, more days
Design
The structure diagram is as follows:
+----------+ +------------+| Client |<----+ | |+----------+ +--->+-----+<-------->| Server | | | | |+----------+ | | +------------+| Client |<-------->| |+----------+ | | | | +------------++----------+ | L | | || Client |<-------->| B |<-------->| Server |+----------+ | S | | | | | +------------++----------+ | || Client |<-------->| |+----------+ | | +------------+ | | | |+----------+ +--->+-----+<-------->| Server | | Client |<----+ | |+----------+ +------------+
The most common load-balancing mode, but there are several points that need to be supported:
Support different scheduling strategies, such as: rotation, random, etc.
Have a heartbeat check mechanism to remove the problematic backend server in a timely manner, but also to recover at the time of server recovery
Simple monitoring for easy viewing of the backend server's agent situation and client connectivity
Simple configuration file for easy modification
... Follow up and add ...
Realize
Github:easyproxy
Other
If you have any questions, please golang contact your other preferred partners:xsank#foxmmail.com