The Artima Developer Community
Sponsored Link

Java Buzz Forum
HTTP Client Performance – IO

0 replies on 1 page.

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 0 replies on 1 page
Mathias Bogaert

Posts: 618
Nickname: pathos
Registered: Aug, 2003

Mathias Bogaert is a senior software architect at Intrasoft mainly doing projects for the EC.
HTTP Client Performance – IO Posted: Jul 12, 2013 12:54 AM
Reply to this message Reply

This post originated from an RSS feed registered with Java Buzz by Mathias Bogaert.
Original Post: HTTP Client Performance – IO
Feed Title: Scuttlebutt
Feed URL: http://feeds.feedburner.com/AtlassianDeveloperBlog
Feed Description: tech gossip by mathias
Latest Java Buzz Posts
Latest Java Buzz Posts by Mathias Bogaert
Latest Posts From Scuttlebutt

Advertisement
Apparently, one of the unsolved programming problems of our time is making HTTP calls – at least, taken from the fact that new HTTP client libraries keep cropping up. Mostly, the focus is on new features, async APIs etc. But what about the actual IO part? Especially regarding performance? A rather specific case I’m not going to do a general performance comparison – too many aspects. My use case is a bit more specific – downloading files, potentially large, from a fast network. When downloading from a remote server, most likely the network connection is going to be the bottleneck. But what if I have a server in a local network, and bandwidth is no longer an issue? What difference does IO vs NIO make? The internet is full of rumours and outdated information on this, from “NIO is heaps faster” to “IO is the new NIO because it’s faster”. Time for some benchmarking. The contestants Client Version Builds on Language Apache httpcomponents-client 4.2.5 Java IO Java Apache commons-httpclient (discontinued) 3.1 Java IO Java Apache HttpAsyncClient (dev) 4.0-beta3 Java NIO, async Java Bee 0.21.0 Java HTTP Scala soke-http 3.0.0 Finagle, Netty Scala Dispatch 0.10.0 Ning Async HTTP Client, Netty Scala cURL 7.24.0 x86_64-apple-darwin10.8.0 C The test I’m going to be a bit unscientific here – I’m running the test on my workstation, rather than on dedicated hardware in an isolated network. To compensate, I’m doing a number of runs over time, averaging will still give a valid trend. In the results, there has been very little variance in the recorded times. I’m downloading three binary files from a Nexus server on the local network: File Size small ~ 80 KB medium ~ 7 MB large ~ 30 MB Each test starts a JVM and downloads one file. As much as the respective APIs allow, the tests factor out creation and startup of the client instances and try to measure pure request to disk speed. Running JDK 1.6 on OSX, all writes go to SSD. Small file cURL, being native, unsurprisingly beats the hell out of most JVM-based solutions. Commons-httpclient comes second – given the size of the file, the deciding factor here is JVM startup, establishing a connection and request generation overhead. Medium file Bee is losing ground pretty quickly. Apache’s async client is already twice as fast, while the other solutions play in the mid-field, except for commons-httpclient, which is still the fastest. Large file Here it starts to get interesting. NIO’s low-level IO operations are starting to make a difference, as Apache’s async client beats even cURL. Bee is far off, and interestingly enough, the classic Apache beats the Netty-based libraries this time. But the winner, in overall download time, is still the discontinued commons-httpclient, using classic IO. A word on NIO Before we start to look on what’s going on under the hood, a word on NIO. It’s often mentioned that NIO is short for “non-blocking IO”, but apparently, it stands for “New IO API”. NIO.2, by [...]

Read: HTTP Client Performance – IO

Topic: 30 Days with IntelliJ IDEA. Find Usages Previous Topic   Next Topic Topic: Modern Web Development

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use