Forums Register Login

HttpURLConnection Best Practices

+Pie Number of slices to send: Send
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
+Pie Number of slices to send: Send
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.
Why fit in when you were born to stand out? - Seuss. Tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com


reply
reply
This thread has been viewed 2118 times.
Similar Threads
Front Controller pattern and DataSource / Connection sharing
Glassfish error
Read XML output from a URL
DB connection in a servlet question
check web sevice availability/ connection
More...

All times above are in ranch (not your local) time.
The current ranch time is
Mar 29, 2024 04:00:37.