[Python] Thread와 Async를 이용한 비동기 방법


[Python] Thread와 Async를 이용한 비동기 방법

Python Thread와 Async를 이용한 비동기 방법 이후 Client에서 Request 보낼 Server의 소스는 다음과 같다. @router.get("/second") async def second(): return { "second": random.randint(1, 100), } 그리고 일반 함수를 생성해서 Server로 Request 했을 때, 약 20초 걸린다. import datetime import requests def second_request(): resp = requests.get("http://localhost:8090/second") start = datetime.datetime.now() for _ in range(0, 10): second_request() print(d..


원문링크 : [Python] Thread와 Async를 이용한 비동기 방법