Two Laptop Bag*
The moose likes I/O and Streams and the fly likes nio maxing CPU usage Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » I/O and Streams
Bookmark "nio maxing CPU usage" Watch "nio maxing CPU usage" New topic
Author

nio maxing CPU usage

Samuel Mendenhall
Greenhorn

Joined: Oct 17, 2004
Posts: 18
This post is related to my other post, http://www.coderanch.com/t/277651/Streams/java/nio-download, but now I have a new problem.

The code below works, pulls down a file, rips out the http response, and closes the channels properly.

HOWEVER, my cpu usage is 100% max while the code runs. This code is also in a thread spawned by a download manager. I have an AMD64 3700 with a gig of ram and running jdk1.5_05, so I don't think processing power is the issue.

This can't be normal, or is it? Any tips or insight into why this is happening?


Ernest Friedman-Hill
author and iconoclast
Marshal

Joined: Jul 08, 2003
Posts: 24183
    
  34

100% CPU usage is a good thing. It means that something is happening as fast as possible, without needing to wait for disk or RAM or network or video or mouse or keyboard. If you search the "Performance" forum for the phrase "100% CPU Usage" you'll probably find this discussed a dozen times.


[Jess in Action][AskingGoodQuestions]
Samuel Mendenhall
Greenhorn

Joined: Oct 17, 2004
Posts: 18
Why then, when I download the same file through firefox or ie, does the CPU usage not max out?
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: nio maxing CPU usage
 
Similar Threads
ServerSocketChannel.accept() seems to create a random port to send data to?
nio and file transfers
java.util.Timer inside Runnable?
java.net.ConnectException
nio download problem