I'd like to avoid running into "Max number of clients reached" errors with interfacing with a 3rd party Redis host from my Heroku app by limiting the number of connections held in the pool to an arbitrary amount of my choosing.
Is that possible?
I think maybe you should keep your redis instance in the global, let all requests share the same redis instance, this should not cause too many connections anymore. The redis instance will have its own connection pool, you can limit your connection nums by set max_connections parameter to redis.ConnectionPool. If max_connections is set, then this object raises redis.ConnectionError when the pool's limit is reached.
limit number of connections to redis in py-redis