Skip to content

Commit

Permalink
Formatting fix
Browse files Browse the repository at this point in the history
  • Loading branch information
Chaosvex committed Sep 16, 2024
1 parent fc4d6b1 commit e0b6b46
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion content/post/go-faster-with-asio/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,9 @@ for (auto i = 0u; i < core_count; ++i) {
}
```

All we do here is determine the number of cores in the system and create an `io_context` with a single worker thread for each one. When a client connects, we'll have a strategy to determine which `io_context` its associated socket will live on, whether that's round robin or picking the context serving the lowest number of clients. Whether a 1:1 core to thread ratio is the right choice for your application will come down to profiling but it's a sensible starting point.
All we do here is determine the number of cores in the system and create an `io_context` with a single worker thread for each one. When a client connects, we'll have a strategy to determine which `io_context` its associated socket will live on, whether that's round robin or picking the context serving the lowest number of clients.

Whether a 1:1 core to thread ratio is the right choice for your application will come down to profiling but it's a sensible starting point.

Ember's own implementation of this pattern can be found [here](https://github.com/EmberEmu/Ember/blob/development/src/libs/shared/shared/threading/ServicePool.cpp).

Expand Down

0 comments on commit e0b6b46

Please sign in to comment.