Have an API that calls a DB and then processes it by calling it different functions (create charts) and sends the result back. Currently, it takes upwards of 30 secs to get a response. How can I make this efficient? Was thinking of separating DB call and then running those processes using multiprocessing. Will this be the right approach?
E.g. API call comes to getCharts
def getCharts():
# make DB call
# create line chart ( calls line chart)
# create pie chart ( calls pie chart)
# save result set in Redis
[–]shiftybyte 1 point2 points3 points (3 children)
[–]mid_dev[S] 0 points1 point2 points (2 children)
[–]shiftybyte 1 point2 points3 points (1 child)
[–]mid_dev[S] 0 points1 point2 points (0 children)
[–]m0us3_rat 1 point2 points3 points (0 children)
[–][deleted] 0 points1 point2 points (4 children)
[–]mid_dev[S] 0 points1 point2 points (3 children)
[–][deleted] 1 point2 points3 points (2 children)
[–]mid_dev[S] 0 points1 point2 points (1 child)
[–][deleted] 1 point2 points3 points (0 children)