In my flask application , we are observing very high memory and cpu consumption almost 100% CPU and memory for one of the API call. We are using flask-rest-json api package . In our model we have many tables like
TABLE A - Parent Table B - Child of A ( table a id as FK) Table C - Child of B ( table C id as FK) ---> Very high Memory / CPU
In addition to above table we have many other related tables (parent - child ) also .
Table A is like recording session which contains many videos ( Table B) which contains many images ( Table C) . So for 30 min recording session we have 30 clips of videos and then 30 * 30 = 900 images.
We have created relationships between tables using db.relationship so that we can use filter operations as well.
Once we trigger the url having high cpu / memory usage , wsgi process kill itself and then restart .
Please let me know to debug this issue . WE suspect issue in db relationships .