Coder Social home page Coder Social logo

Comments (6)

chronoxor avatar chronoxor commented on June 22, 2024 1

Yes, but in those time for us TCP/SSL sessions were more important, so I add analogical UDP benchmark just for brief comparison.
I'll think it over, maybe in near future we'll create benchmarking tests special for UDP.

from cppserver.

ne0phyte70 avatar ne0phyte70 commented on June 22, 2024

Yes. I have also found this to be very surprising. Can the developer please comment? TIA

from cppserver.

chronoxor avatar chronoxor commented on June 22, 2024

In TCP a stream buffer is used to put all outgoing messages together and send them in a batch with full IP packet. Batch mode is more effective.

In UDP a small datagram is send each time in a new IP packet which is not full.

It's just a kind of scenario. In other scenarios UDP could be more effective (e.g. broadcasting).

from cppserver.

ne0phyte70 avatar ne0phyte70 commented on June 22, 2024

from cppserver.

ne0phyte70 avatar ne0phyte70 commented on June 22, 2024

from cppserver.

nicodemuz-zz avatar nicodemuz-zz commented on June 22, 2024

With UDP packets fairly large, and with the benefit of a smaller header, the free´d capacity for more "packets" in batch mode doesn't explain a factor 100 in performance difference unless we go really close to 0 in packet size (payload size), or unless it is CPU limited and not throughput limited.

For 1 Gbps throughput limit, which should not be limit with test in same PC, a UDP packet totalling ~120 bytes including IP and UDP header should result in 1 million packets per second as each is ~1000 bits in size. But I am not getting close to those figures with UDP.

So is it a CPU constraint from CPU overhead at each packet transmission? I never did check the CPU usage...

By the way:
Appropriate send and receive buffer sizes on TCP could even things out, and disabling Nagle algorithm would also adress the stream vs datagram issues making UDP and TCP implementation more comparable.

from cppserver.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.