mtprotoproxy
mtprotoproxy copied to clipboard
Running multiple instances by supervisor
I'm running this script by the supervisor in the background. What will happen if I increase numprocs to something greater than 1? Will I have an enhance in my speed?
For example the following config:
[program:mtproxy]
command=python3.7 /opt/mtprotoproxy/mtprotoproxy.py
numprocs=10
process_name=%(program_name)s_%(process_num)02d
Yes, it will
Yes, it will
I didn't understand your answer. Can you describe your answer more? Why it will have a better speed?
Every process uses a single cpu core. If you have two cores you will get double performance if you run the script twice. If your server has 10 cores, it is better to run the proxy 10 times.
It is valid if you have really lot of users (~5 000) and the proxy process is cpu-bounded. If you have a few users, there will be no difference.
@alexbers can't you make it multithreading?
the multi-threading is slow, the current approach is the fastest way to multiplex the proxy server on several cores since the multiplexing is done in the linux kernel.
It is better to use many small proxy-servers instead of big because the big one is very easy to block by traffic patterns. Also it if it advertised somewhere it will likely be blocked.