FlexyPool adds metrics and failover strategies to a given Connection Pool, allowing it to resize on demand.

Overview

Flexy Pool Logo

License Maven Central JavaDoc

Introduction

The FlexyPool library adds metrics and flexible strategies to a given Connection Pool, allowing it to resize on demand. This is very handy since most connection pools offer a limited set of dynamic configuration strategies.

Flexy Pool architecture

Features

Are you struggling with application performance issues?

Hypersistence Optimizer

Imagine having a tool that can automatically detect if you are using JPA and Hibernate properly. No more performance issues, no more having to spend countless hours trying to figure out why your application is barely crawling.

Imagine discovering early during the development cycle that you are using suboptimal mappings and entity relationships or that you are missing performance-related settings.

More, with Hypersistence Optimizer, you can detect all such issues during testing and make sure you don't deploy to production a change that will affect data access layer performance.

Hypersistence Optimizer is the tool you've been long waiting for!

Training

If you are interested in on-site training, I can offer you my High-Performance Java Persistence training which can be adapted to one, two or three days of sessions. For more details, check out my website.

Consulting

If you want me to review your application and provide insight into how you can optimize it to run faster, then check out my consulting page.

High-Performance Java Persistence Video Courses

If you want the fastest way to learn how to speed up a Java database application, then you should definitely enroll in my High-Performance Java Persistence video courses.

High-Performance Java Persistence Book

Or, if you prefer reading books, you are going to love my High-Performance Java Persistence book as well.

High-Performance Java Persistence book High-Performance Java Persistence video course

Documentation

  1. Installation Guide
  2. User Guide
  3. Developer Guide

In the Press

  1. The anatomy of Connection Pooling
  2. FlexyPool, reactive connection pooling
  3. Connection pool sizing with Flexy Pool
  4. The simple scalability equation
  5. How to monitor a Java EE DataSource
  6. How does FlexyPool support the Dropwizard Metrics package renaming
  7. How does FlexyPool support both Connection proxies and decorators
  8. Applying Queueing Theory to Dynamic Connection Pool Sizing with FlexyPool
  9. Java Performance Tuning - November 2016
  10. Brett Wooldridge Shows What it Takes to Write the Fastest Java Connection Pool
  11. FlexyPool 2 has been released

Who uses FlexyPool

ToroDB Stampede is a replication and mapping technology allowing you to mirror a MongoDB database in a SQL database.

ToroDB Stampede exposes multiple metrics using JMX, some of them are custom metrics and other are metrics offered by third party products like Flexy-pool.

Etuovi is the leading real estate portal in Finland.

New Etuovi.com has used FlexyPool in production since early 2014.
The library has proven to be reliable and allows our infrastructure to handle temporary spikes much better. We use it everywhere in our stack, ranging from our frontends to the backend services.
-- Antti Koivisto, Software Architect, Etuovi.com

Mitch&Mates is a software company specializing in products and services for health care.

Mitch&Mates uses FlexyPool in all it's environments. It gives us the ability to measure performance and scalability, detect potential flaws and improve intensive loads.
Additionally, we compared several connection pool libraries which decided us to switch to another provider.
-- Bram Mommaerts, Software Engineer, Mitch&Mates NV

Scentbird is a website that allows its subscribers to try hundreds of designer fragrances at very affordable prices.

We have tried FlexyPool in Scentbird, after one week of intensive testing we decided switch it to FlexyPool and HikariCP in production mode, and everything works very robust and fast, we so happy about that!
Thank you for this library.
-- Andrey Rebrov, CTO, Scentbird

Requirements

Comments
  • Support for multiple JNDI datasources in JEE.

    Support for multiple JNDI datasources in JEE.

    Patch to allow the specification of flexy pool configuration properties in JPA persistence.xml file. flexy-pool.properties is still used a a fallback, but the values specified in the persistence unit declaration, such as , are preferred.

    This allow to use FlexyPool to monitor multiple JNDI datasource in JEE.

    opened by lpenet 16
  • Dropwizard Metrics

    Dropwizard Metrics

    We are using Flexypool with HikariCP for our dropwizard app. We push our dropwizard metrics to a graphite server.

    Wanted to push flexy pool metrics to the same graphite server, how do we proceed with the same. Can we pass the Dropwizard metrics registry to flexypool metric factory?

    enhancement 
    opened by sheldon-sminq 15
  • Odd Dependency Structure within HikariCP JAR

    Odd Dependency Structure within HikariCP JAR

    While starting to integrate flexy-pool with a Java SE app, I found the following CNFE:

    Caused by: java.lang.NoClassDefFoundError: com/codahale/metrics/JmxReporter
    	at com.vladmihalcea.flexypool.metric.codahale.JmxMetricReporter.init(JmxMetricReporter.java:28)
    	at com.vladmihalcea.flexypool.metric.codahale.CodahaleMetrics.<init>(CodahaleMetrics.java:87)
    	at com.vladmihalcea.flexypool.metric.codahale.CodahaleMetrics.<init>(CodahaleMetrics.java:102)
    	at com.vladmihalcea.flexypool.metric.codahale.CodahaleMetrics$ReservoirMetricsFactory.newInstance(CodahaleMetrics.java:45)
    	at com.vladmihalcea.flexypool.config.Configuration$Builder.build(Configuration.java:164)
    

    This was confusing, since I didn't declare any metrics runtime (yet), and was planning to use DWM4.

    The following is part of the dependency tree I see within my app:

    [INFO] +- com.vladmihalcea.flexy-pool:flexy-hikaricp:jar:1.3.0:compile
    [INFO] |  +- com.vladmihalcea.flexy-pool:flexy-pool-core:jar:1.3.0:compile
    [INFO] |  +- com.vladmihalcea.flexy-pool:flexy-codahale-metrics:jar:1.3.0:compile
    [INFO] |  +- com.vladmihalcea.flexy-pool:flexy-dropwizard-metrics:jar:1.3.0:compile
    [INFO] |  \- io.dropwizard.metrics:metrics-core:jar:4.0.2:compile
    

    I wouldn't expect a hard compile time dependency on these components, they don't seem like they're hard dependencies either within the code. So should they be removed? Or excluded?

    opened by johnament 13
  • Does flexy-pool supports DB2 and Oracle Datasources?

    Does flexy-pool supports DB2 and Oracle Datasources?

    We uses the below connection pools in our application

    1. DB2DataSource 2) OracleDataSource

    Does current flexy-pool supports DB2 and Oracle Datasources? Can we implement flexypool metrics and failover strategies to the above connection pools? I didn't find any specific doc or example code related to it under vladmihalcea's flexypool github repository.

    Could you please suggest on this?

    opened by Ahmed-A-Syed 10
  • Fix the Include uniqueName in the metric names #60 issue

    Fix the Include uniqueName in the metric names #60 issue

    All metrics wil now start with flexypool_ making it easy to see which metrics is made from flexy-pool All metrics will have a parameter poolname= with the value from the pools uniqueName making it possible to see what pool the metric belongs to. Example. The metrics:

    concurrentConnectionRequestsHistogram_count 12.0
    concurrentConnectionRequestsHistogram_sum 6.0
    

    will with 2 pools with uniqueNames quartzPool and batchPool become

    flexypool_concurrentConnectionRequestsHistogram_count{poolname="quartzPool",} 6.0
    flexypool_concurrentConnectionRequestsHistogram_sum{poolname="quartzPool",} 3.0
    flexypool_concurrentConnectionRequestsHistogram_count{poolname="batchPool",} 6.0
    flexypool_concurrentConnectionRequestsHistogram_sum{poolname="batchPool",} 3.0
    
    opened by atokle 6
  • Include uniqueName in the metric names

    Include uniqueName in the metric names

    Hello and thank you guys for your great work. Flexypool is amazingly helpful. My problem is that I have multiple connection pools(different datasources) and they all want to use the same metric name since they aren't factoring the uniqueName into it. I was able to figure out how to do this on my own, it just felt a bit more difficult than I'd like and it seems like including the uniqueName in the metric name might be good default behavior. Perhaps I am missing an easier way to do it?

    For reference, here's how I got around it:

     configurationBuilder.setMetricsFactory(new MetricsFactory() {
      public Metrics newInstance(com.vladmihalcea.flexypool.common.ConfigurationProperties configurationProperties) {
    
       CompositeMeterRegistry globalRegistry = io.micrometer.core.instrument.Metrics.globalRegistry;
    
       return new MicrometerMetrics(configurationProperties, globalRegistry){
         @Override
         public Histogram histogram(String name) {
           return super.histogram(poolName + StringUtils.capitalize(name));
         }
    
         @Override
         public Timer timer(String name) {
           return super.timer(poolName + StringUtils.capitalize(name));
         }
       };
      }
    });
    
    opened by coryjamesfisher 6
  • Flexypool not showing any stats

    Flexypool not showing any stats

    Hi, I have added flexypool into my applicaiton but when I observe the MBeans on Jconsole , it doesn't show any activity.

    Here is what I did: In pom added below entry:

    <dependency>
       <groupId>com.vladmihalcea.flexy-pool</groupId>
    	<artifactId>flexy-dbcp</artifactId>
        <version>1.3.0</version>
        <exclusions>
            <exclusion>
                <groupId>com.vladmihalcea.flexy-pool</groupId>
                <artifactId>flexy-dropwizard-metrics</artifactId>
            </exclusion>
        </exclusions>
    </dependency>
    

    In ApplicationContext.xml added below entries:

    <bean id="configurationBuilder" class="com.vladmihalcea.flexypool.config.Configuration$Builder">
    	<constructor-arg value="uniqueId"/>
    	<constructor-arg ref="oracleDataSource"/>
    	<constructor-arg value="#{ T(com.vladmihalcea.flexypool.adaptor.DBCPPoolAdapter).FACTORY }"/>
    </bean>
    
    <bean id="configuration" factory-bean="configurationBuilder" factory-method="build"/>
    
    <bean id="dataSource" class="com.vladmihalcea.flexypool.FlexyPoolDataSource" init-method="start" destroy-method="stop">
    	<constructor-arg ref="configuration"/>
    	<constructor-arg>
    		<array>
    			<bean class="com.vladmihalcea.flexypool.strategy.IncrementPoolOnTimeoutConnectionAcquiringStrategy.Factory">
    				<constructor-arg value="5"/>
    			</bean>
    			<bean class="com.vladmihalcea.flexypool.strategy.RetryConnectionAcquiringStrategy.Factory">
    				<constructor-arg value="2"/>
    			</bean>
    		</array>
    	</constructor-arg>
    </bean>
    
    

    oracleDataSource here refers to the datasource of my application

    After this.. I started the server, and navigated through my application but in JConsole's Mbeans.. I dont see any activity.

    Note: I am on weblogic and jdk 1.6

    opened by asker2410 4
  • Add support for Dropwizard Mertics 4

    Add support for Dropwizard Mertics 4

    As explained in this issue, DW Metrics 4 has added several changes:

    1. They did not rename the package after all which makes the DW FlexyPool module dependency useless
    2. They moved the JmxReporter to a new package.

    So, we need to release version 2.0 for that and change the DW module to reflect all these changes.

    enhancement 
    opened by vladmihalcea 4
  • Flexy-pool with hibernate 4.2

    Flexy-pool with hibernate 4.2

    We are using an old version of Hibernate (4.2.14.Final) with JBoss EAP 6.1-Final.

    I wanted to give a try to flexy-pool to test some of the performance hints given by your great book (High-Performance Java Persistence). However when I try to start our application following exception is thrown:

    Caused by: java.lang.NoClassDefFoundError: org/hibernate/engine/jdbc/connections/internal/DatasourceConnectionProviderImpl

    Is possible to use flexy-pool with Hibernate 4.2?

    opened by fmiguelez 4
  • #38 Add support for Atomikos using non-XA JDBC implementations

    #38 Add support for Atomikos using non-XA JDBC implementations

    The AtomikosPoolAdapter was unnecessarily tied to the XA-specific AtomikosDataSourceBean instead of its abstract base class.

    This change enables support for the AtomikosNonXADataSourceBean.

    opened by abrenk 4
  • Spring Boot support?

    Spring Boot support?

    Any plan to implement flexy-pool-spring-boot-starter? It will be very convenient for microservices application developers. Developers just import flexy-pool-spring-boot-starter and all will be ready for usage and metrics.

    enhancement 
    opened by linux-china 4
  • Add support for Atomikos5

    Add support for Atomikos5

    Atomikos 5 has been released, and it has some changes in its API, that made flexy-atomikos incompatible with it.

    https://www.atomikos.com/Blog/TransactionsEssentials5dot0

    opened by oburgosm 1
Owner
Vlad Mihalcea
Java Champion, developing Hypersistence Optimizer, and author of High-Performance Java Persistence.
Vlad Mihalcea
光 HikariCP・A solid, high-performance, JDBC connection pool at last.

HikariCP It's Faster.Hi·ka·ri [hi·ka·'lē] (Origin: Japanese): light; ray. Fast, simple, reliable. HikariCP is a "zero-overhead" production ready JDBC

Brett Wooldridge 17.7k Jan 1, 2023
🔥 强大的动态线程池,附带监控线程池功能(没有依赖任何中间件)。Powerful dynamic thread pool, does not rely on any middleware, with monitoring thread pool function.

ThreadPool, so easy. 动态线程池监控,主意来源于美团技术公众号 点击查看美团线程池文章 看了文章后深受感触,再加上最近线上线程池的不可控以及不可逆等问题,想做出一个兼容性、功能性、易上手等特性集于一身的的开源项目。目标还是要有的,虽然过程可能会艰辛 目前这个项目是由作者独立开发,

龙台 3.4k Jan 3, 2023
🔥 强大的动态线程池,附带监控线程池功能(没有依赖任何中间件)。Powerful dynamic thread pool, does not rely on any middleware, with monitoring thread pool function.

?? 动态线程池系统,包含 Server 端及 SpringBoot Client 端需引入的 Starter. 动态线程池监控,主意来源于美团技术公众号 点击查看美团线程池文章 看了文章后深受感触,再加上最近线上线程池的不可控以及不可逆等问题,想做出一个 兼容性、功能性、易上手等特性 集于一身的的

龙台 3.4k Jan 3, 2023
SPRING MySQL Database Connection using JDBC STEPS

SPRING-MySQL-Database-Connection-using-JDBC-STEPS SPRING MySQL Database Connection using JDBC STEPS Step1: Create maven project Group id: com.cdac Art

Dnyaneshwar Madhewad 1 Jan 27, 2022
Time Series Metrics Engine based on Cassandra

Hawkular Metrics, a storage engine for metric data About Hawkular Metrics is the metric data storage engine part of Hawkular community. It relies on A

Hawkular 230 Dec 9, 2022
Code metrics for Java code by means of static analysis

CK CK calculates class-level and method-level code metrics in Java projects by means of static analysis (i.e. no need for compiled code). Currently, i

Maurício Aniche 286 Jan 4, 2023
MapDB provides concurrent Maps, Sets and Queues backed by disk storage or off-heap-memory. It is a fast and easy to use embedded Java database engine.

MapDB: database engine MapDB combines embedded database engine and Java collections. It is free under Apache 2 license. MapDB is flexible and can be u

Jan Kotek 4.6k Dec 30, 2022
MapDB provides concurrent Maps, Sets and Queues backed by disk storage or off-heap-memory. It is a fast and easy to use embedded Java database engine.

MapDB: database engine MapDB combines embedded database engine and Java collections. It is free under Apache 2 license. MapDB is flexible and can be u

Jan Kotek 4.6k Jan 1, 2023
jdbi is designed to provide convenient tabular data access in Java; including templated SQL, parameterized and strongly typed queries, and Streams integration

The Jdbi library provides convenient, idiomatic access to relational databases in Java. Jdbi is built on top of JDBC. If your database has a JDBC driv

null 1.7k Dec 27, 2022
A RatingBar library for android, you can customize size, spacing, color and image easily, and support right to left.

AndRatingBar A RatingBar library for android, you can customize size, spacing, color and image easily, and support right to left. 安卓RatingBar终极方案,继承自原

dqq 271 Aug 14, 2021
esProc SPL is a scripting language for data processing, with well-designed rich library functions and powerful syntax, which can be executed in a Java program through JDBC interface and computing independently.

esProc esProc is the unique name for esProc SPL package. esProc SPL is an open-source programming language for data processing, which can perform comp

null 990 Dec 27, 2022
Replicate your Key Value Store across your network, with consistency, persistance and performance.

Chronicle Map Version Overview Chronicle Map is a super-fast, in-memory, non-blocking, key-value store, designed for low-latency, and/or multi-process

Chronicle Software : Open Source 2.5k Dec 29, 2022
eXist Native XML Database and Application Platform

eXist-db Native XML Database eXist-db is a high-performance open source native XML database—a NoSQL document database and application platform built e

eXist-db.org 363 Dec 30, 2022
A blazingly small and sane redis java client

Jedis Jedis is a blazingly small and sane Redis java client. Jedis was conceived to be EASY to use. Jedis is fully compatible with redis 2.8.x, 3.x.x

Redis 10.8k Dec 31, 2022
Speedment is a Stream ORM Java Toolkit and Runtime

Java Stream ORM Speedment is an open source Java Stream ORM toolkit and runtime. The toolkit analyzes the metadata of an existing SQL database and aut

Speedment 2k Dec 21, 2022