AtlasOfLivingAustralia / image-service

Image repository and tiling services
https://images.ala.org.au
0 stars 17 forks source link

SettingService.getOrCreateSetting can be a bottle neck #147

Closed sbearcsiro closed 3 years ago

sbearcsiro commented 3 years ago

SettingService.getOrCreateSetting can become a bottle neck during periods of high database contention due to it being synchronized. Using double checked locking to bypass synchronization if the Setting already exists would prevent this method becoming a bottleneck in most cases, thereby preventing requests that already hold an active transaction or database connection to complete and return the database connection to the pool.