joeldseidel / maverick-scms-data

Maverick Systems SCMS data https server system (the backend boy)
2 stars 0 forks source link

Database connections are still wasteful and it needs to be overhauled #40

Open joeldseidel opened 5 years ago

joeldseidel commented 5 years ago

I'm thinking one db connection per handler and it is managed there instead of in the manager?

Maybe we make use of the manager prototype in this regard to ensure only one is open?

Regardless, current performance leaves much to be desired is in unacceptable.

joeldseidel commented 5 years ago

Note for later: using System.gc() can invoke garbage collect more frequently, though it remains nondeterministic

joeldseidel commented 5 years ago

I've done some more research into garbage collection and the nondeterministic nature of the whole thing makes me nervous. I believe the best course of action for this issue is to manually close a database connection. I am not yet sure if this is best done in the handlers or the managers.

The manager prototype class contains a finalization method which closes a database connection before the manager is garbage collected and displays the time that the connection has been open for. Garbage collect is allowing these connections to stay open for minutes, even with other connections being made. This is unacceptable from a performance standpoint.