August 2, 2024

Spring Boot Database Connection Pooling

 https://medium.com/@ak123aryan/mastering-database-connection-pooling-in-spring-boot-a-comprehensive-guide-with-java-96b1ae8e93db

https://www.baeldung.com/spring-boot-tomcat-connection-pool

application.properties

spring.datasource.type =

"Fully qualified name of the connection pool implementation to use. By default, it is auto-detected from the classpath."

https://docs.spring.io/spring-boot/appendix/application-properties/index.html

HikariCP

spring.datasource.type = com.zaxxer.hikari.HikariDataSource

#default is 10
spring.datasource.hikari.maximum-pool-size=10
#default is same as max pool size
spring.datasource.hikari.minimum-idle=10
#default is 30 seconds
spring.datasource.hikari.connection-timeout=30000
#default is 600000 i.e 10 minutes
spring.datasource.hikari.idle-timeout=600000
#default is 1800000 i.e 30 minutes
spring.datasource.hikari.max-lifetime=1800000 
spring.datasource.hikari.pool-name=HikariConnPool

#spring.datasource.hikari.* =

https://medium.com/javarevisited/hikari-connection-pooling-5600d765e5ae

Tomcat JDBC Connection Pool

spring.datasource.type = org.apache.tomcat.jdbc.pool.DataSource

spring.datasource.tomcat.* =

Apache DBCP2

spring.datasource.type = org.apache.commons.dbcp2.BasicDataSource

spring.datasource.dbcp2.* =

July 31, 2024

IPv4 Network Ranges

Example 192.168.0.0/30

number of IP addresses = 2 ^ (32–30)

which is 2 ^ 2 = 4

The IP addresses are thus 192.168.0.0, 192.168.0.1, 192.168.0.2 and 192.168.0.3

Example 192.168.0.0/29

number of IP addresses = 2 ^ (32–29)

which is 2 ^ 3 = 8

The IP addresses are thus 192.168.0.0, 192.168.0.1, 192.168.0.2 … 192.168.0.7

Example 192.168.0.1/28

number of IP address = 2 ^ (32–28)

which is 2 ^ 4 = 16

The IP addresses are thus 192.168.0.0, 192.168.0.1, 192.168.0.2 … 192.168.0.15

Spring RestTemplate and WebClient Improvements

 Improvements for reactive WebClient

https://medium.com/@dixitsatish34/how-to-improve-webclient-response-time-in-spring-boot-3c0c898f06b4

Improvements for blocking RestTemplate

https://medium.com/@nitinvohra/how-to-improve-performance-of-spring-resttemplate-6af37e0a0f33


RestClient vs. WebClient vs RestTemplate

https://docs.spring.io/spring-framework/reference/web/webmvc-client.html

1. RestTemplate (Spring Framework 3+) Blocking/Synchronous on Servlet Stack (org.springframework.boot:spring-boot-starter-web)


2. WebClient (Spring Framework 5+) Reactive/Asynchronous on WebFlux (org.springframework.boot:spring-boot-starter-webflux)


3. RestClient (Spring Framework 6.1+) Blocking/Synchronous on Servlet Stack (org.springframework.boot:spring-boot-starter-web)


https://digma.ai/restclient-vs-webclient-vs-resttemplate/