python - Async single document insert vs callback insert -



python - Async single document insert vs callback insert -

i have scenario need extract content number of web pages, process content, insert mongodb. pondering best way do. gotten me bit confused there bunch of way approach this.

i instance this:

jobs = group(visit.s(i) in payload) res = ( jobs|process.s()|save.s())()

as far understand visit page, process it, save it. done async(maybe @ same time?). way total async , there no waiting going on, each item individual inserted mongodb.

on other hand utilize callback:

jobs = group(visit.s(i) in payload) res = chord( jobs|process.s(),save.s())()

this aync fetching , processing, wait tasks completed , async save results, lead mass insert mongodb.

so wondering if has had similar experience , improve approach in general. should go total on async? or have sync code in there.

also side question comments on maybe using chunking instead of single page tasks great.

thanks

related question, contains answer. not straight related, jist of mass insert still single insert in loop , mongo can handle big number of connections, seems not matter , async should work fine.

python mongodb asynchronous celery django-celery

Comments

Popular posts from this blog

php - Android app custom user registration and login with cookie using facebook sdk -

django - Access session in user model .save() -

php - .htaccess Multiple Rewrite Rules / Prioritizing -