Skip to content

Instantly share code, notes, and snippets.

View Python-37's full-sized avatar

Chou Keika Python-37

  • 東京
  • 12:41 (UTC +09:00)
View GitHub Profile
@zhouchangxun
zhouchangxun / loadbalancer.py
Created July 5, 2018 08:06
a simple loadbalancer implemention with python.
import sys
import socket
import select
import random
from itertools import cycle
# dumb netcat server, short tcp connection
# $ ~ while true ; do nc -l 8888 < server1.html; done
# $ ~ while true ; do nc -l 9999 < server2.html; done
SERVER_POOL = [('10.157.0.238', 8888)]