This is a continuation of the earlier posts starting with this one: http://ravinote.blogspot.com/2020/09/best-practice-from-networking.html
Performance counter: Frequently subsystems and components take a long time. It is not possible to exhaust diagnostic queries to discover the scope that takes the most time to execute. On the other hand, the code is perfectly clear about call sequences, so such code blocks are easy to identify in the source. Performance counters help measure the elapsed time for the execution of these code blocks.
Statistics counter: In addition to the above-mentioned diagnostic tools, we need to perform aggregation over the execution of certain code blocks. While performance counters measure elapsed time, these counters help with aggregation such as count, max, sum, and so on.
Locks: In order to perform thread synchronization, these primitives are often used. If their use cannot be avoided, they are best taken as few as possible universally. Partitioning and coordination solve this in many cases. The networking server relies on the latter approach and versioning.
Parallelization: Generally, there is no limit enforced to the number of parallel workers in the network server or the number of partitions that each worker operates on. However, the scheduler that interleaves workers works best when there is one active task to perform in any time slice. Therefore, the number of tasks is ideal when it is one more than the number of processors. A queue helps hold the tasks until their execution. This judicious use of task distribution improves performance in every layer.
Serialization: There is nothing simpler than bytes and offsets to pack and persist in any data structure. The same holds true in network engineering. We have referred to messages as a necessity for communication between layers and components. When these messages are written out, it is irrelevant whether the destination is local or remote. Serialization comes useful in both cases. Consequently, serialization and deserialization are required for most entities.