One possibility I saw in a talk on YouTube a couple of years ago (sorry,
couldn't find the link).

   1. Have a buffered channel of clients.
   2. Try to grab a client from the channel for each request, using a
   time.Timer to time out after a reasonable amount of time (one second, 100
   ms, whatever)
   3. If it times out, create a new client and use it.
   4. Regardless of whether you re-used or created the client, put it into
   the channel when you're done with it (use a Timer again and just drop it if
   it times out).

You end up re-using a fixed-size set of clients. You're not using one, and
you're not using one per request. Somewhere in between.

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to