microsoft / microsoft/ntttcp-for-linux
Avoid using atomic primitives in the hot path
Nobody has claimed this yet.
- Dominant language
- C
- Stars
- 426
- Forks
- 108
- PR merge metrics
- No merged PRs in 30d
Description
For instance, in tcpstream.c and udpstream.c, __sync_fetch_and_add() is used to update the number of bytes transferred. This can cause contention between cores if they share cache lines (i.e. false sharing). Ideally, each thread would update their own counter without any kind of locking, and these numbers would be tallied up after joining the worker threads.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reading the counter updates in tcpstream.c and udpstream.c, then trace how worker threads are created and joined. Determine how each thread's byte count can be retained and aggregated after joining without atomic updates. Done means the hot-path counters no longer use __sync_fetch_and_add() and the benchmark still builds and reports the totals correctly.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- c
- Domain
- networking, performance
- Issue type
- Refactor
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100