• Post Reply Bookmark Topic Watch Topic
  • New Topic

HttpURLConnection Best Practices

 
Kevin G Scott
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,
I am working to develop a high-volume Web Service. Most requests of this service will need a HttpURLConnection to another service to make a HTTP request. Are there any best practices for managing a large number of HTTP Connections? I guess what I am looking for is basically connection pooling for HTTP Connections, but it looks like that's not possible. So can anyone suggest the best way to manage these connections so I can save the time of opening a new connection each time?

Thanks,
KS
 
Santhosh Kumar
Ranch Hand
Posts: 242
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you are expecting lots of http connections to be opened and retrieve the response, consider NIO over traditional blocked sockets. NIO will give very good performance even when you open new connection each time you want to get the response.

Over this if you would like, you can implement the kind of connection pool too. I don't see any problems with this.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!