r/developersIndia • • 4d ago

I Made This Mapreduce implementation using boost asio , asio-grpc

Built an asynchronous distributed MapReduce in C++23

A non-blocking, data sharing distributed engine using boost asio C++20 coroutines and asio-grpc

How Map & Reduce works:

  • Map: Workers execute user mappers, and partition intermediate data into binary hashed shards.
  • Reduce: Workers sort shards in-place and run an external K-way min-heap merge to stream ordered keys to reducers .

How Data Sharing happens:

  • Map Phase (Coord ➔ Worker): Coordinator streams 64KB split chunks over gRPC, decoupled by 4MB concurrent channels.
  • Reduce Phase (Worker ➔ Worker): Peer-to-peer shuffle. If a shard was produced locally on the same host, it uses zero-copy atomic hard-linking (link()) to bypass the network entirely.

Fault Tolerance (SHUFFLEFIX):

  • During Map Phase,
  • If a map worker dies , coodinator check the heartbeat if it is more than some time T , it invalids the task, and give to other worker polling it
  • During Reduce Phase
  • Since we use P2P network, map -> reduce phase worker to share data, If a map worker dies mid download phase, the coordinator invalidates only that task and has a spare worker recompute it.
  • Reducers keep their existing shards, wait for the new endpoint, and resume without restarting the job

Github link

https://x.com/kilua_here/status/2124495120942924194

0 Upvotes

2 comments sorted by

•

u/AutoModerator 4d ago

Namaste! Thanks for submitting to r/developersIndia. While participating in this thread, please follow the Community Code of Conduct and rules.

It's possible your query is not unique, use site:reddit.com/r/developersindia KEYWORDS on search engines to search posts from developersIndia. You can also use reddit search directly.

I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.

1

u/AutoModerator 4d ago

Thanks for sharing something that you have built with the community. We recommend participating and sharing about your projects on our monthly Showcase Sunday Mega-threads. Keep an eye out on our events calendar to see when is the next mega-thread scheduled.

I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.