We have develoed an APP using Angular 8 and flask-restplus(0.13.0) (Python 3.7.4) and cx_oracle(7.2.3).
The Angular app is deployed on NGINX on Ubuntu server. We have created 3 micro services and have deployed it on gunicorn using docker and kubernetes pods.
Production environment is having 7 kubernetes PODs per service.
In Yaml file of kubernetes we have configured it to run on 4 threads using below command.
["gunicorn"]
args: ["run_app:app","-b","0.0.0.0:8080","--threads=4","--access-logfile","-","--error-logfile","-"]
The session pool code is as follows:
dbsession_pool = cx_Oracle.SessionPool('xxxxx', 'xxxxx', 'xxxxx.xxxxx.com/xxxxxdb', min=5, max=50, increment=5, threaded = True)
All the services run for a while and then start giving 504 gateway timeout error after some time.
But if we use cx_Oracle.connect then it works fine. Our reason to use session pool was to save time for connecting and disconnecting to DB thus improving performance.
Copyright Notice:Content Author:「Onkar Kubal」,Reproduced under the CC 4.0 BY-SA copyright license with a link to the original source and this disclaimer.
Link to original article:https://stackoverflow.com/questions/60184083/issue-in-db-pooling-using-cx-oracle-and-flask-python