Is the tcp request sent by a thread or a process?

for example, I have such a simple code block, the main function is to receive http requests through the flask application, then judge the validity, and then send the combed data to other modules using tcp. So should the class that sends tcp requests inherit threading.Thread or multiprocessing.Process? Currently, flask applications are hosted on the main process, and sending tcp information can be regarded as an IO operation. Because in addition to sending data using tcp, another tcp port is monitored to receive data.


use multithreading, generally speaking, io intensive use threads, compute intensive use multiprocess


should use celery to start asynchronous tasks


using process is not a waste of process scheduling and switching time, network IO makes process wait most of the time

Menu