DZone
Thanks for visiting DZone today,
Edit Profile
  • Manage Email Subscriptions
  • How to Post to DZone
  • Article Submission Guidelines
Sign Out View Profile
  • Post an Article
  • Manage My Drafts
Over 2 million developers have joined DZone.
Log In / Join
Refcards Trend Reports Events Over 2 million developers have joined DZone. Join Today! Thanks for visiting DZone today,
Edit Profile Manage Email Subscriptions Moderation Admin Console How to Post to DZone Article Submission Guidelines
View Profile
Sign Out
Refcards
Trend Reports
Events
Zones
Culture and Methodologies Agile Career Development Methodologies Team Management
Data Engineering AI/ML Big Data Data Databases IoT
Software Design and Architecture Cloud Architecture Containers Integration Microservices Performance Security
Coding Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks
Partner Zones AWS Cloud
by AWS Developer Relations
Culture and Methodologies
Agile Career Development Methodologies Team Management
Data Engineering
AI/ML Big Data Data Databases IoT
Software Design and Architecture
Cloud Architecture Containers Integration Microservices Performance Security
Coding
Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance
Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks
Partner Zones
AWS Cloud
by AWS Developer Relations
Securing Your Software Supply Chain with JFrog and Azure
Register Today

Trending

  • What ChatGPT Needs Is Context
  • Microservices With Apache Camel and Quarkus (Part 3)
  • Transactional Outbox Patterns Step by Step With Spring and Kotlin
  • Essential Architecture Framework: In the World of Overengineering, Being Essential Is the Answer

Trending

  • What ChatGPT Needs Is Context
  • Microservices With Apache Camel and Quarkus (Part 3)
  • Transactional Outbox Patterns Step by Step With Spring and Kotlin
  • Essential Architecture Framework: In the World of Overengineering, Being Essential Is the Answer
  1. DZone
  2. Data Engineering
  3. Data
  4. FlexyPool, Reactive Connection Pooling

FlexyPool, Reactive Connection Pooling

Vlad Mihalcea user avatar by
Vlad Mihalcea
·
Apr. 28, 14 · Interview
Like (0)
Save
Tweet
Share
4.35K Views

Join the DZone community and get the full member experience.

Join For Free

introduction

when i started working on enterprise projects we were using j2ee and the pooling data source was provided by the application server.

enterpriseapplicationserver

scaling up meant buying more powerful hardware to support the increasing request demand. the vertical scaling meant that for supporting more requests we would have to increase the connection pool size accordingly.

horizontal scaling

our recent architectures shifted from scaling up to scaling out. so instead of having one big machine hosting all our enterprise services, we now have a distributed service network.

enterprisearchitecture

this has numerous advantages:

  • each jvm is tuned according to the hosted service intrinsic behaviour. web nodes employ the concurrent low pause collector , while batch services use the throughput collector
  • deploying a batch service doesn’t affect the front services
  • if one service goes down it won’t affect the rest

database connection provisioning

but all those services end up calling the database and that’s always done through a database connection. a database server can offer only a limited number of concurrent connections, so connection provisioning is mandatory.

the current connection pooling solutions offer limited monitoring and failover support. this is what we’ve been struggling with lately and that’s why i decided to build flexypool .

there’s a new guy in town

flexypool is a data source proxy offering better monitoring and failover for the following connection pools:

  • bitronix transaction manager

  • apache dbcp

  • apache dbcp2

  • c3p0

  • bonecp

  • hikaricp

flexypoolarchitecture

we concluded that sizing connection pools is not an upfront design decision. in large enterprise systems you need adaptability and monitoring is the first step to taking the right decisions.

advance monitoring

name description

concurrentconnectioncount

this indicates how many connections are being used at once.

concurrentconnectionrequestcount

this indicates how many connection are being requested at once.

connectionacquiremillis

a time histogram of the target data source connection acquire interval.

connectionleasemillis

the lease time is the duration between the moment a connection is acquired and the time it gets released.

maxpoolsizehistogram

a histogram of the target pool size.

overallconnectionacquiremillis

a time histogram of the total connection acquire interval.

overflowpoolsizehistogram

a histogram of the pool size overflowing.

retryattemptshistogram

a histogram of the retry attempts number.

failover strategies

when all pooled connections are being used, a new connection acquire request will wait for a limited amount of time before giving up. this prevents system overloading but to avoid rejecting connection requests you have to properly configure the connection pool size. you will also have to consider traffic spikes and take into consideration all other services competing for the limited amount of database connections. the monitored data can provide you a better insight into connection usage so you’ll be better equipped when deciding the proper pools size.

flexypool was design to be reactive, so it can better adapt to traffic spikes. for this it offers a configurable failover strategy mechanism.

a strategy is a connection acquiring safety mechanisms, a resort that’s called when a connection is not successfully fetched from the target connection pool.

flexypool comes with the following default strategies

  • increment pool on timeout

    this strategy will increment the target connection pool maximum size on connection acquire timeout.

    the connection pool has a minimum size and on demand it can grow up to its maximum size . the overflow is a buffer of extra connections allowing the connection pool to grow beyond its initial maximum size . whenever a connection acquire timeout is detected, the current request won’t fail if the pool hasn’t grown to its maximum overflow size .

    overflowpoolsize

  • retrying attempts

    this strategy is useful for those connection pools lacking a connection acquiring retry mechanism

stay tuned. my next article will demonstrate how flexypool can assist you finding the right pool size.

Database connection Connection pool Web Service

Published at DZone with permission of Vlad Mihalcea. See the original article here.

Opinions expressed by DZone contributors are their own.

Trending

  • What ChatGPT Needs Is Context
  • Microservices With Apache Camel and Quarkus (Part 3)
  • Transactional Outbox Patterns Step by Step With Spring and Kotlin
  • Essential Architecture Framework: In the World of Overengineering, Being Essential Is the Answer

Comments

Partner Resources

X

ABOUT US

  • About DZone
  • Send feedback
  • Careers
  • Sitemap

ADVERTISE

  • Advertise with DZone

CONTRIBUTE ON DZONE

  • Article Submission Guidelines
  • Become a Contributor
  • Visit the Writers' Zone

LEGAL

  • Terms of Service
  • Privacy Policy

CONTACT US

  • 600 Park Offices Drive
  • Suite 300
  • Durham, NC 27709
  • support@dzone.com

Let's be friends: