"What could be causing this?"
Not enough details. One reason may be that your private Internet connection is starving from too many concurrent connections. But since you did not indicate in which environment you are executing this piece of code, this is pure speculation.
However, there is no suggestion that your approach to solving this problem is very inefficient. multiprocessing designed to solve CPU problems. Retrieving data over multiple TCP connections is not directly related to the CPU. Having one process on a TCP connection is a waste of resources.
The reason this seems slow is because in your case one process spends a lot of time waiting to return system calls (the operating system on the other hand spends a lot of time waiting for the network module to do what it was told (and the network component spends a lot of time waiting for packets to arrive over the wire)).
You do not need several processes to make your computer spend less time waiting. You do not even need multiple threads. You can retrieve data from many TCP connections in a single OS-level thread using collaborative scheduling. In Python, this is often done using greenlet. A higher level module using green dots, gevent .
The web is full of gevent-based examples for disabling many HTTP requests - at the same time . When properly connected to the Internet, a single OS level thread can handle hundreds or thousands or ten thousand simultaneous connections simultaneously. In these orders, the value then evolves to be tied to I / O or tied to a processor, depending on the specific purpose of your application. That is, either a network connection, or a CPU bus, or a separate processor core limits your application.
Regarding ssl.SSLError: The read operation timed out -like errors: in the world of networks, you have to consider that such things happen from time to time and decide (depending on the details of your application) how you want to deal with these situations. Often a simple attempt at repetition is a good solution.
source share