A study of database connection pool in microservice architecture - Nur Ayuni, Nor Sobri; Mohamad Aqib Haqmi, Abas; Ihsan, Mohd Yassin; Megat Syahirul Amin, Megat Ali; Nooritawati, Md Tahir; Azlee, Zabidi; Zairi Ismael, Rizman (Politeknik Negeri Padang, 2022)
The growing number of the Internet presents a higher requirement for backend application systems to be designed to handle thousands of user traffic concurrently. Microservice architecture is also in a rising trend which allows each service to scale horizontally by its throughput, and load helps scale the system efficiently without waste of resources like in the traditional monolithic application system. Among the many strategies to optimize delivery, the database connection pool helps backend systems to access databases efficiently by reusing database connections, thus eliminating the computationally expensive need to open and close connections with new requests. Additionally, database connection pools can help improve applications' connection reliability. This paper aims to determine the most suitable maximum amount of database connections in a microservice setting, where multiple instances of the service are used for scalability and high availability purposes of the system. To tackle the scalability issue and achieve the high availability of our services, we propose running multiple instances of each of our services in production, especially for services that we anticipate would be hit the most during runtime. This allows load balancing of request load between multiple instances and having backup instances to serve HTTP requests when one of the instances is down. The result obtained in this experiment shows that five database connections give the best result in microservice settings as described in our methodology.