-
Notifications
You must be signed in to change notification settings - Fork 6
Python config
eugene-retunsky edited this page Jan 20, 2021
·
1 revision
Repository: https://pypi.org/project/pproxy/
pproxy
is a single-threaded asyncio
app, so to utilize two cores, we need to run two instances.
sudo cgcreate -t $USER:$USER -a $USER:$USER -g cpuset:pyproxy1
echo 2 > /sys/fs/cgroup/cpuset/pyproxy1/cpuset.cpus
echo 0 > /sys/fs/cgroup/cpuset/pyproxy1/cpuset.mems
cgexec -g cpuset:pyproxy1 --sticky ~/.local/bin/pproxy -l tunnel://localhost:9000 -r tunnel://localhost:80
and
sudo cgcreate -t $USER:$USER -a $USER:$USER -g cpuset:pyproxy2
echo 2 > /sys/fs/cgroup/cpuset/pyproxy2/cpuset.cpus
echo 0 > /sys/fs/cgroup/cpuset/pyproxy2/cpuset.mems
cgexec -g cpuset:pyproxy2 --sticky ~/.local/bin/pproxy -l tunnel://localhost:9001 -r tunnel://localhost:80
I used tmux
to be able to run and shutdown instances:
tmux new-session -d -s "python1" ./start-python1.sh # port 9000
tmux new-session -d -s "python2" ./start-python2.sh # port 9001
tmux kill-session -t python1
tmux kill-session -t python2