I fee very skeptical about this part as I have not found an answer on the web that satisfies me.
The questions are:
Should I keep the db connection on forever and then keep processing my requests. This way is easier as I only have to open up the connection once and forget about closing it unless it goes down for some reason. Here, I understand the overheads of keeping a connection on forever.
Should I open up a fresh connection each time I receive a request that needs some processing in the database and then close after the processing is done.
As per my research, the second part is better, but I need to understand the consequences in both cases.
It will mean a lot if someone can explain me the design overheads here with some examples