So I have a lot of internal and external APIs that are called on basically each request. This means that there's a lot of setting up connections to these APIs. Is there a way of creating a persistent connection object that can be shared between requests?
So I'd like to replace:
def a(request):
c = api.connect()
c.call_function()
With:
def b(request):
// use existing connection object from earlier request
c.call_function()
Any ideas?
I'm also not sure how big the gain would be but I don't mind doing some benchmarking once I have a first solution.