Best practices of high-performance network applications

后端 未结 4 684
被撕碎了的回忆
被撕碎了的回忆 2021-02-04 11:19

While testing out a UDP multicast server that I\'ve written on Windows 7 Ultimate x64, I came across a most curious thing. Playing music with foobar2000 in the background signif

相关标签:
4条回答
  • 2021-02-04 11:31

    Foobar got many plugins written by different people. These may be the cause of your issue. I propose you to come closer to the real reason. Try to switch off plugins one by one performing your test each time a plugin is disabled.

    Hope the idea will help.

    0 讨论(0)
  • 2021-02-04 11:43

    It has been many years since I wrote network protocol related code, but I'll offer a guess.

    I suspect this is an issue of throughput and latency. Playing music is introducing I/O contention and adding latency in transmitting the packets. However, the added latency is likely causing the packets to queue and thus batched increasing throughput.

    To address this in your code, you might try sending the packets in batches yourself. I am assuming that you are sending each packet to the system for transmission as the data becomes ready. Group multiple packets and send them to the system at the same time. Even just a group of two or three packets could make a dramatic difference especially if you are introducing your own small delay between each system call.

    I couldn't find any directly relevant links from a quick search on Google. However, you can see the concept in this discussion of network tuning for Linux or in this FAQ which describes techniques such as batching to improve throughput.

    0 讨论(0)
  • 2021-02-04 11:50

    This sounds like TSP/IP managing throughput based on it's primitive algorithm. The white paper here should give more background. http://www.asperasoft.com/?gclid=CICSzMqD8Z0CFShGagod_ltSMQ Their product is a UDP protocol that works very well.

    0 讨论(0)
  • 2021-02-04 11:55

    What you observe is the side-effect of your media player setting clock resolution of your machine to 1 ms.

    This happens only during the play

    The side-effect is - your app has smaller timeslices and this imporves your app because you probably had lot of CPU stolen from your app and with longer timeslices - for longer time.

    To test it you can simply set the timer resolution within your app to 1ms and compare performance without media playing.

    Should be the same as if with no clocres setting but with media playing.

    0 讨论(0)
提交回复
热议问题