python - Making 1 milion requests with aiohttp/asyncio - literally -


i followed tutorial: https://pawelmhm.github.io/asyncio/python/aiohttp/2016/04/22/asyncio-aiohttp.html , works fine when doing 50 000 requests. need 1 milion api calls , have problem code:

    url = "http://some_url.com/?id={}"     tasks = set()      sem = asyncio.semaphore(max_sim_conns)     in range(1, last_id + 1):         task = asyncio.ensure_future(bound_fetch(sem, url.format(i)))         tasks.add(task)      responses = asyncio.gather(*tasks)     return await responses 

because python needs create 1 milion tasks, lags , prints killed message in terminal. there way use generator insted of pre-made set (or list) of urls? thanks.

asyncio memory bound (like other program). can not spawn more task memory can hold. guess hit memory limit. check dmesg more information.

1 millions rps doesn't mean there 1m tasks. task can several request in same second.


Comments

Popular posts from this blog

Spring Boot + JPA + Hibernate: Unable to locate persister -

go - Golang: panic: runtime error: invalid memory address or nil pointer dereference using bufio.Scanner -

c - double free or corruption (fasttop) -