{{ !articles[0].partner.isSponsoringArticle ? "Platinum" : "Portal" }} Partner
architects,high-perf,performance,tips and tricks

How fast are Java Datagrams?


Following my article How fast are Java sockets, this article follows the same tests except for Datagrams which use UDP rather than TCP.

The timings

The tests are the same except Datagrams don't support busy waiting in Java 6 which hurts the Threaded Ping latency

UDP Pings per second 224 K/s
UDP Pings latency was 1/50/99%tile 4.1/4.2/4.7 us
Threaded UDP Pings per second 131 K/s
Threaded UDP Pings latency was 1/50/99%tile 9.8/11.0/33.2 us


Test  Threaded  Throughput Typical latency
Datagram Ping no 224 K/s  4.2 μs
Socket Ping no 170 K/s  5.8 μs
Datagram Ping yes 131 K/s 11.0 μs
Socket Ping yes 235 K/s 8.5 μs

The Code


Published at DZone with permission of {{ articles[0].authors[0].realName }}, DZone MVB. (source)

Opinions expressed by DZone contributors are their own.

{{ tag }}, {{tag}},

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}
{{ parent.authors[0].realName || parent.author}}

{{ parent.authors[0].tagline || parent.tagline }}

{{ parent.views }} ViewsClicks