mtprotoproxy icon indicating copy to clipboard operation
mtprotoproxy copied to clipboard

Running multiple instances by supervisor

Open thisismzm opened this issue 6 years ago • 5 comments
trafficstars

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

thisismzm avatar May 28 '19 14:05 thisismzm

Yes, it will

alexbers avatar May 28 '19 14:05 alexbers

Yes, it will

I didn't understand your answer. Can you describe your answer more? Why it will have a better speed?

thisismzm avatar May 28 '19 18:05 thisismzm

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 avatar May 28 '19 21:05 alexbers

@alexbers can't you make it multithreading?

pouryare avatar May 28 '19 21:05 pouryare

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.

alexbers avatar May 29 '19 11:05 alexbers