Now i am studying how to fetch data from website as fast as possible. To get faster speed, im considering using multi-thread. Here is the code i used to test the difference
The biggest thing you are doing wrong, that is hurting your throughput the most, is the way you are calling thread.start() and thread.join():
for i in range(0, 10):
thread = threading.Thread(target = current_post.post)
thread.start()
thread.join()
Each time through the loop, you create a thread, start it, and then wait for it to finish Before moving on to the next thread. You aren't doing anything concurrently at all!
What you should probably be doing instead is:
threads = []
# start all of the threads
for i in range(0, 10):
thread = threading.Thread(target = current_post.post)
thread.start()
threads.append(thread)
# now wait for them all to finish
for thread in threads:
thread.join()