2

I have a high volume application that reads in data from files, and then hits an internal API (local network) via a POST with X number of records from the current file. I'm using HttpUrlConnection to make the API call. Without the API call, it runs extremely fast, but once I put in the API call, it slows down a lot, and doesn't seem to scale well (e.g. at 8 threads it's faster than at 2, but the per-thread performance is much lower).

Doing some searches, it appears that the underlying implementation appears to be doing connection pooling (generally a good idea), and uses an ConcurrentHashMap for the pooling according to HttpURLConnection implementation question. Should I try turning off the connection pooling? Or increase the size of the pool?

Community
  • 1
  • 1
Drizzt321
  • 993
  • 13
  • 27
  • Here's an article that switched from URLConnection to java.nio.* http://drdobbs.com/java/184406242 – TJR Oct 13 '11 at 01:59

1 Answers1

1

The concurrency problem might be at the server end that's providing the internal API. There's no concurrency problem with HttpURLConnection itself, and fiddling with the pooling etc won't help. I don't even know that you can change the size of the pool; it's controlled more by idle timeouts IIRC.

user207421
  • 305,947
  • 44
  • 307
  • 483