Skip to Content
Java Network Programming, 4th Edition
book

Java Network Programming, 4th Edition

by Elliotte Rusty Harold
October 2013
Intermediate to advanced
506 pages
13h 35m
English
O'Reilly Media, Inc.
Content preview from Java Network Programming, 4th Edition

Chapter 11. Nonblocking I/O

Compared to CPUs and memory or even disks, networks are slow. A high-end modern PC is capable of moving data between the CPU and main memory at speeds of around six gigabytes per second. It can move data to and from disk at the much slower but still respectable speed of about 150 megabytes per second.[3] By contrast, the theoretical maximum on today’s fastest local area networks tops out at about 150 megabytes per second, though many LANs only support speeds ten to a hundred times slower than that. And the speed across the public Internet is generally at least an order of magnitude smaller than what you see across a LAN. My faster than average FIOS connection promises 6 megabytes per second down and 3 megabytes per second up, about 5% of what my LAN can support. CPUs, disks, and networks are all speeding up over time. These numbers are all substantially higher than I reported in the third edition of this book 10 years ago. Nonetheless, CPUs and disks are likely to remain several orders of magnitude faster than networks for the foreseeable future. The last thing you want to do in these circumstances is make the blazingly fast CPU wait for the (relatively) molasses-slow network.

The traditional Java solution for allowing the CPU to race ahead of the network is a combination of buffering and multithreading. Multiple threads can generate data for several different connections at once and store that data in buffers until the network is actually ready to send ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Java Network Programming, Second Edition

Java Network Programming, Second Edition

Elliotte Rusty Harold
Learning Java, 5th Edition

Learning Java, 5th Edition

Marc Loy, Patrick Niemeyer, Daniel Leuck

Publisher Resources

ISBN: 9781449365936Errata Page