Boto connect_xxx method and connection pools

后端 未结 1 1604
再見小時候
再見小時候 2021-01-11 16:36

If I call boto.connect_xxx, where xxx is some service (dynamodb, s3, etc) multiple times, does it create a new connection pool each time? What I\'d like to do is something l

相关标签:
1条回答
  • 2021-01-11 17:20

    The best approach is to call the connect_xxx method once when your application starts and rely on boto to manage the connection from then on. The only exception to that rule is if you are using multiple threads. In that case, each thread should create it's own connection since boto uses httplib which is not threadsafe.

    Even if you call the connect_xxx method before each request, you really should be okay. Boto pools connection at the class level and should handle this in a pretty efficient manner.

    0 讨论(0)
提交回复
热议问题