Configuring the initial number of connections in BoneCP

I use BoneCP as connection manager for my application because it is supposed to be fast and deadlock free.

Configuring it in a way that makes it predictable proves to be somewhat of a problem though. This is not really a problem of BoneCP itself but rather one of great configurability and the interaction of the various parameters.

The issue arose because I blindly copied the guide for using Spring+Hibernate. Profiling showed that this did not work in our configuration as we explicitly use a datasource confugration. In this case, Hibernate does not manage the connections itself thus making the Hibernate setting hibernate.connection.provider_class unused.

I started using the following configuration (excluding the actual connection parameters):

<bean id="dataSource" class="com.jolbox.bonecp.BoneCPDataSource"
            lazy-init="true" destroy-method="close">
    .....
    <property name="idleConnectionTestPeriodInMinutes" value="1"/>
    <property name="idleMaxAgeInMinutes" value="4"/>
    <property name="maxConnectionsPerPartition" value="60"/>
    <property name="minConnectionsPerPartition" value="1"/>
    <property name="partitionCount" value="3"/>
    <property name="acquireIncrement" value="3"/>
    <property name="statementsCacheSize" value="50"/>
    <property name="releaseHelperThreads" value="3"/>
</bean>

I expected this to allocate 3 connections at startup (3 partions with one connection each), but this turned out to reserve 39 connections.
It seems there are various setting which are relevant which were not present and some interactions between the settings which are not clear.

  • partitionCount: connections are grouped in partitions as this decreases contention when you open a new connection.
  • lazyInit: should connections immediately be allocated or a little later?
  • maxConnectionsPerPartition: upper limit of the amount of connections in one partition. If the limit is reached you will have to wait when a new connection is requested.
  • minConnectionsPerPartition: number of connections which are immediately allocated when the the pool is created. This is not used when lazyInit is true.
  • acquireIncrement: number of connections which are allocated at once when a connections are added in the pool.
  • poolAvailabilityThreshold: the percentage of available connections which should be available in each partition. The default value is 20%. Additional connections are acquired when there are too less than this percentage of available connections. This reduces the overhead of allocating new connections when needed.
  • connectionTestStatement: SQL statement which is used to verify that a connection is still alive. When not specified, a metadata request is used.

From this list, it is especially the poolAvailabilityThreshold which caused an unexpected number of connections to be initially allocated.

In the end I am now using this configuration:

<bean id="dataSource" class="com.jolbox.bonecp.BoneCPDataSource"
            lazy-init="true" destroy-method="close">
    .....
    <property name="idleConnectionTestPeriodInMinutes" value="1"/>
    <property name="idleMaxAgeInMinutes" value="4"/>
    <property name="maxConnectionsPerPartition" value="30"/>
    <property name="minConnectionsPerPartition" value="1"/>
    <property name="poolAvailabilityThreshold" value="5"/> 
    <property name="partitionCount" value="1"/>
    <property name="acquireIncrement" value="3"/>
    <property name="statementsCacheSize" value="50"/>
    <property name="releaseHelperThreads" value="3"/>
    <property name="connectionTestStatement" value="SELECT 1"/>
    <property name="lazyInit" value="true"/>
</bean>

124 Comments

  1. KK says:

    Thanks a lot.
    This solved my problem from getting “too many connections” in mysql.
    A very good article. Cheers.

  2. Touche. Outstanding arguments. Ҝeep up thе gooɗ effort.

    Feel free tο visit my page: bad credit student loans (http://www.erefinancestudentloans.com)

  3. Issac says:

    Hey! І know thiѕ is ҡind օf off topic but I waѕ wondering ԝhich blog patform aare уou usijg fօr this site?
    I’m ǥetting sick аnd tired of WordPress Ьecause I’ve
    had issues witɦ hackers and I’m loօking at options for another platform.
    I wߋuld bee great if you couuld poiոt me in tҺе direction of a good platform.

    mү web-site … guaranteed payday loans – Issac,

  4. I am in fact grateful to the holder of this web site who has
    shared this great post at at this time.

  5. Dior Outlet says:

    When i could on male real Uggs responsible for, i astounded might the amount pleasant we were looking at approach phony ones.

  6. Coach Outlet says:

    beeing the appoint have shown, they may be displayed doing cold temperature.

  7. Coach Outlet says:

    really renowned characters, Robert Redford, ryan david and furthermore Clas part oft Eastwood completely portrayed cowboys flicks.

  8. Coach Outlet says:

    Coach Outlet

    ladies commonly adorn yourself with lip gloss when they want to appear polished and so make use of the concluding adornment to a glance.

  9. within the last few months, a great many problems currently asked about the cost/benefit of the system, And the potential your impediments with the system can be found ever increasing.

  10. cheap UGGs says:

    cheap UGGs

    the particular canonical path is without a doubt initiated via cytokines which include tumour necrossituation (TNF) and after that interleukin (IL) 1 and microbial products and work a vital perform in the concept among the bodies cytokines and inhibiti…

  11. Andres says:

    I do not even understand how I stopped up right here, but I thought this put up used to be good.
    I do not recognise who you might be but certainly you are going to a
    well-known blogger should you are not already. Cheers!

    web page; Andres,

  12. “I almost recognize my individuals arise for an item introduce, A money clerk laughed and said.

  13. crucial a partial good rapper performed stop a little daughter lady’s first prize showcase, actually claim to be the greatest guitarist of all time, or even a embarrass henry Meyers on state hdtv,

  14. cheap uggs says:

    most up-to-date account, features more completely and so occasion joins, steps this concern.

  15. It’s very straightforward to find out any topic on web as
    compared to books, as I found this article at this
    web site.

    Here is my web site … woolrich coats reviews

  16. ceiling fans can get unyielding shoe starts, Bruce stated,

  17. sell terrain has stabilized after the execution involving austerity actions previous in, since many of our prospects for the christmas carries on decent.

  18. Crayola design bath tub Dropz is ordinarily pleasing for ages 3 or longer.

  19. Effie says:

    Good day I am so delighted I found your weblog, I really found you by mistake, while
    I was searching on Aol for something else, Regardless I am here now
    and would just like to say many thanks for a fantastic post and a all round exciting blog (I also love the theme/design), I
    don’t have time to look over it all at the moment but
    I have book-marked it and also included your RSS feeds, so when I have time I will be back to
    read more, Please do keep up the excellent job.

    site (Effie)

  20. from this day forward consider Deckers, which can nearly all recognized for Ugg footwear.

  21. Gucci Outlet says:

    2011 definitely seems to be the year including hybrid jackets, it’s hard to miss and also researched a bunch of.

  22. Beautiful, fast, perfect, thank you SO much!
    hermes replica handbags

  23. most favored for DeLorme, the garmin, Magelin combined with Holux are believed you need to do quite, highly,

  24. Cheap UGGs says:

    we’re visiting to be able to information and facts since acquire a aminoacids add to pulverulence.

  25. discount christian louboutin women’s shoes

  26. My partner and i LOVEEEE cheap wow goldGSS! I actually have Six pairs i’m searching for an alternative couple the following day:) these are typically VERY nicey! very theraputic for wintertime……..Bailey conventional hardware are really the best however………..I JUST LOVEE THEEEM! <Numerous

  27. lycra suit says:

    You’ll unicolor and multicolor, And I locate a phenomenon that several buyers want to put on the unicolor zentai suit. If you find a single imperative craze for this year, This is the khaki color. This is why, What coloring can be far better than khaki.
    [url=http://www.titaniumtrack.com/wp-content/uploads/cache/]lycra suit[/url]

  28. wow news says:

    Material dongles as a sort of DRM including, Looking for a flash adhere be attached to a pc capable run a software program weren hazardous need StarForce, Still, annoying. If you should disappeared my actual real poke, You can wouldn have the option to run the solution(As well new-found dongles are usually large). Should you have had their offline stay, That you used to be burning a slots on broaden only so i can run utility, It mat be wanting to disconnect an additional instrument.Remarkable nobody needs to handle hentai game games within register. Agencies widely not really claim newest permit, Participate in extensive address variations with him or her and then there are likely to be so many islands mutually images that they’d bombard their email list. Performs this mean i feel hentai is nasty and you are clearly bad for choosing that will? Never,
    wow news

  29. The pyramid is significantly larger in the bottom, so
    there’s room for a lot more and more people, but
    towards the top there exists only room for one. Another feature with the product is the so-called Google Circles.
    The more difficult a URL or perhaps the more a URL changes, the harder it can be to index as a link destination.

  30. Chloe Outlet says:

    even while folk have come out in support of Scott who has got programmed shoes or boots due to adidas originals where it use several impact for appear culture, which include teddy bears, Gorillas, Mickey computer mouse button together with the u. s citizens hunt and the discharge of the cumulus, which includes not ended the momentum individuals in order to suspend this device.

  31. their personal guys fixed consists of a variety of slipper designs and styles additionally midhigh your footwear in numerous colors,

  32. cheap uggs says:

    they been sent a not to very good a birthday present unfortunately i believed i always set aside her after a the worst daughter located in regulations,

  33. cheap uggs says:

    One motive for the fall came to be the increase in sheepskin costs, and as a result outdoor had to pass significantly greater their prices into shoppers.

  34. Event Online’s a place hugely multiplayer pastime. When compared to wow, As where right several truly multi-ply providers for certain situations(Therefore, you can’t say everyone views comparable anyone for that state), Event allocates one hosting forum of the locale, As well, Which means there is simply one event internet. A capsuleer is generally one who can preliminary some specific more so formed cruise crafts.
    diablo 3 news

  35. Yves Saint Laurent Outlet

    the following hunter wellingtons are not monstrous, But also are often more suitable substitute inside your.

  36. Gucci Outlet says:

    south america on earth physical activities can take you the lead here in new jersey discharged to many of the details, in addition to vary the b razil country wide team this realisation year, The new jersey domicile hardware is likely to be nearer to the conventional form.

  37. I think spoil a great stay healthy and well balanced is to refrain from feeling sick.

  38. cheap uggs says:

    Adidas is without a doubt utilizing Kana hook up with drive business to internet sites via this enables e business owners to interact with customers and prospects in useful chitchats, provide you with on a personal basis zeroed in on voicemails with keep track of all voice message campaign statistics for every person.

  39. Gucci Outlet says:

    what Airwalk Fuggs hold getting them is they are well-crafted and also durable.

  40. or even for women came all of the range together with spiky pumps, homes, Ugg boots, sandals to sand wedges.

  41. Amazing! This blog looks exactly like my old
    one! It’s on a entirely different subject but it has pretty
    much thee same layout and design. Wonderful choice of colors!

    Feel free to visit myy web blog; wireless beats by dre

  42. guides says:

    I last of all noticed gw2 this was available for purchase as well as having troublesome pressure from peers during partners. However, Really taking part in it again vastly mainly the particular whole game pretty looks like endgame in and also. Up to date i’m in actuality experiencing the Norn knight situation. They are built a traditional halloween outfit any time sketched directly, Styles ancient. At the time gone through the wrong way, (That getting this done) Seems to resemble a evening mockery.Complete combined accompanied by typically attitude it’s costing know nearly all?Robin the boy wonder, For the reason stretched pants chafe.Four logic behind it everyone ought to browse through math comic strips?1. Simply everybody things i am became aquainted with anywhere of cinema, Music as well as online video game titles wanted says/or comic strips.
    guides

  43. Prada Outlet says:

    functions: polycarbonate matter computerized movements Ventilated polyurethane ring alarm system Chronograph towards conference right time phase egg timer Ten panel recollection Two year assurance,

  44. Kinda by a crossroads. Only probably still very, quite hard as establishments to persist in teaching visitors to build sort of considerable[Gaming gaming system] Movie to get distributed at the ledge to protect individuals bonus will cost you a game lover doesn what to see happy inside the, Believes game owner Lorne bringing, Company president towards Oddworld habitants. Specific conjecture is anytime we read the future of applications at sale, I actually add TMt notice” Using five lengthy, One TMs only probably still like finding music during vinyl fabric.
    diablo 3 gold guide

  45. So it’s so far, So necessary for WildStar. As long as there’s twinge most typically associated with failure going without shoes term common themepark mmog in a place filled up within gills with these, Occurring the miscroscopic that grinded within this toy with up to now attests inwith it due to being on minimum an appealing, With success finished one. Energy definitely reveal in the instance unique(The game and get wildstar plat monthly buy, It is important to find then sell wildstar plat in between ongoing amount of in time board on the net computer poker business regarding your committed funds) And inquiries the same as the desired conclusion fun subject matter will have out buying enough I have on imagine i am continuous for it in the evening Open try out, WildStar is likely for any intents and processes in order to really being quite a decent, Pleasant mmog skills,
    diablo 3 gold

  46. my step-dad recently purchased a stunning red Mercedes-Benz CL-Class CL63 AMG just by working online with a macbook. official website>>>>> http://www.WalletWiki.com

  47. cheap uggs says:

    a very simple behave for Kindness when someone lengthens a helping hand in which to us of a perhaps carries out a really good action, you hardly ever when can pay the face returning.

  48. Well associated with us set these types of the info driver’s through out our constituents but gotten rid of Windows Messenger from the machine. Car and motorbike adding to, Application mend, In addition, operate Indexing acquired then simply incompetent, The local disk was formerly defragmented, With a 768MB long-lasting internet article start is created for a passing fancy partition considering Windows installing. As a final point, Any of us defined Windows XP’s ocular end results to help you”Excellent effectiveness, Installed around their benchmarking a software program, And in addition jogged many of the assessments,
    wildstar gold guide

  49. up to two thirds amongst profit arises from the US, the presented 7.7% financial expansion and additionally world-wide transactions slumped 4.8%.

  50. wow news says:

    “It is filled with profound approach, Unbelievable conceptions, And after that exceptional great ideas. Richards, Is an ancient it is partially professional as well as medical administrating who may have put together for country wide Geographic, Typically all these BBC, Ones record pertaining to Virology, And there are others. In born to run, Kira callier is a superb nevertheless enigmatic anatomical industrial manufacture where reveals ideal on holiday receive savant want sizes in every area of believed then inventive thinking.Wyvern really works as a 2009 western created tv natural scary shoot that is caused by RHI enjoyment which opened across the nation the actual other Sci Fi funnel on thinking about receiving 1, 2009. Compiled by jerrika Bourque and therefore sharp by Steven R. Monroe, Can be is an area of the”Maneater” Production television show crafted exposed to a by means of Sci Fi artwork.
    wow news

  51. A multitude of physicians considered that he must be murdered by means of some other reasons unfortunately heart disease.

  52. great seller. fast shipping. item as described. thank you! A+
    cheap prada wallets clearance

  53. There isn’t a car or truck treating. You are going to generate a new ranges. You’re criminal offenses taint coronary heart. The thing is, Whether you ultimately choose place since planetary quests, Battle is in the centre of they all. Concerned with secure, This requires stabbing amount of car ideas nicely stuck computer mouse button switch, Not like through the link the Spacebar shoots phasers since control introductions torpedoes. Concerning sociallizing, But in addition F central covers nearly all topic and consequently although there are many NPCs waiting for, Disappointingly few of which can be divulged on.
    cheap zentai costumes

  54. Anyone who got a great deal more advances likely has taken themselves, And i think you’ll did,

  55. Gucci Outlet says:

    highlights: Full feed synthetic leather upper FitFoam’s cast PU formula contours for your foot, selling larger extensive consistency additionally security lengthy adiWeaer rubberized outsole through Z Traxoin fashion remain ClimaProof: sweet to become dry on the inside of with regard to dimension assist you, surf to many of our shoes or boots sizes graphs,

  56. wow guide says:

    A put emphasis on getting the hang of a technique for hardship as an alternative health and wellness. To player vs player combat and then PvE. Knowing the course of action prescription medication white the beef and bird of the battle; Once could very well realized it, I don’t want to say again who’s all the time proper up until finally finally something drops dead(I exploring a person, FFXIV).
    wow guide

  57. coach outlet says:

    for almost all of 2012, the particular business was previously serving millions throughout to it has the security buyback package.

  58. I by average joe are unsure. I’m not sure which usually in addition wrist timepieces this site, So cardiovascular exercise try questioning anywhere popular. Iustinus 20:36, 9 may likely 2005(UTC)Hi there. Die-off Aufgabe als office workers researchers your Bord ushanka eine Menge Facetten. Es beginnt damit technische und wissenschaftliche Fragen zu beantworten und endet dabei, Soziale oder Reise Fragen zu arrangieren. Hazel Cotterill ist worker science tecnistions auf dieser dispatch 325 und ich rubbish trash can in Ausbildung, Sozusagen, Ich lerne alles had geht von ihr,
    wow gold guide

  59. You could definitely see your enthusiasm in the work you write. The arena hopes for even more passionate writers such as you who are not afraid to mention how they believe. Always follow your heart.

  60. )で、インヴィスタ社(INVISTA社)の保護の下、製造されています。
    ダウンベスト ファー

  61. Gucci Outlet says:

    Gucci Outlet

    the business’s backlog for transactions fall down up from $387 million with right at the end of 2011 $323 million 2012.

  62. coach outlet says:

    spotlessly clean artwork, innovative decorating but progressive tools give a favourable peek into your destiny for you if you discover who they really are, Where they are exactly where there is they go.

  63. eliza Kors slouchy suede galoshes, $700.

  64. Hello! Would you mind if I share your blog with my facebook group?
    There’s a lot of folks that I think would
    really appreciate your content. Please let me know. Thank youchristian louboutin shop online

  65. its cellular telephone lysates acquired baked and simply exposed to immunoblotting.

  66. it is the words in which adidas adidas needs stayed basically prior to also together with 2014 planet cup in brazil.

  67. How will probably be your blood pressure? she’s i scrutinizing which ceaselessly over the day (quarry is normal) And just after i have a superior browsing the material make contact with the girl.

  68. viagra says:

    Hello, this weekend is good for me, for the reason that
    this occasion i am reading this great informative
    piece of writing here at my house.

  69. for you to say you’ll want to consider fashion the actual best beautiful timeless sand UGG your footwear selection like the beautiful high extra short and, this substance original Bailey button (the most popular).

  70. Chloe Bag Outlet Online Sale

    A++++++++++++++++

  71. My husband and i got quite delighted Ervin managed to complete his homework using the ideas he came across from your very own web site. It is now and again perplexing to just happen to be freely giving guidance which often people today might have been selling. So we know we have got the writer to appreciate for that. The main explanations you made, the simple web site navigation, the relationships you help to promote – it’s all unbelievable, and it’s really letting our son and our family understand the subject matter is excellent, and that’s exceedingly pressing. Many thanks for all the pieces!

  72. いつもと申込み方法が異なりますので、ご了承下さいうちの三代目も、この合宿のために保護団体から借りてきた子でした。
    ゴヤール ホワイト

  73. 収容物の破損や故障、データの損失、消滅などについては一切の責任を負いかねますのでご了承ください。
    クロムハーツ オフィシャル

  74. Good site! I really love how it is easy on my eyes and the data are well written. I’m wondering how I might be notified whenever a new post has been made. I’ve subscribed to your RSS feed which must do the trick! Have a great day!

  75. Ashley was born times (Uneccesary) c/s.

  76. The fresh fruits associated loom shirts and tops are discovered to be another very good selection in men and women.

  77. Great Purse in Great Condition…thank you!

  78. Yesterday I bought these pleasant cheap wow gold: they may be incredibly nice. After you provide them, you don’t want to take them off anymore… :-)

  79. Mittal 眉bernimmt 50% der Anteile an Lukoil kasachischen assetsThe Beteiligung erm枚glicht Lakshmi Mittal N um ein Joint Venture, das Kohlenwasserstoffproduktion in f眉nf 脰lregionen kontrollieren w眉rde.

  80. But with all the coins. Mobile Games industry7 Entertainment is family guy the quest for stuff cheats very crazy for playing on your purchase.
    In drivers battle you and defeat Mr. There is a game please carefully check its terms and conditions.

  81. ダッタン蕎麦を主食としている中国の少数民族、イ(い)族が、厳しい自然と闘いながらも、健康でエネルギッシュ!イ(い)族の人達は、今でも石臼で粉を挽き、ふるいで振るった苦味の少ない、ご膳粉を日常食にしています。
    アナスイ かごバッグ

  82. 高い耐磨耗性はキープしつつ、アウターソールの硬度を少しやわらかく設定し、クッション感をプラス。
    リモワ インテグラル

  83. Well, there was only games which had minimalistic brick design graphics.
    The most successful mobile apps. This way player keeps on increasing
    day by day and also champion leagues. You can play just about every kind of environment that plants vs.
    zombies 2 cheats they are exhibited.

  84. Super fast shipping! Item as described…..A+ seller.

  85. A+++ seller with fast shipping! Very pleased!

  86. Awesome blog post.Thanks Again. Awesome.

  87. Ugg footwear was established to be worn that have basic feet not like hosiery.

  88. The leader of air, KOing spiders, and a lot of people hungry shark evolution cheats thinking regarding mobile games.

  89. The concept hungry shark evolution cheats of mobile users.

    The site provides a very interesting and fascinating, these games are sometimes
    not even need much investment.

  90. cheap uggs says:

    cheap uggs

    Boys’ damp Boots Girls’ for men Boots is to be Boots huge if someone Boots for WomenIt of boots could certainly cater to pair all the cause, And when you are fortunate enough to live in a very easy atmosphere, One pair of boots could accomplish the s…

  91. including our much envisaged economical ranking, ended up being three functional streaks that confirmed unites states attitude from your promotions folks are developing of grow the products, expand our growth ventures and increase in size sales trade positions for the whole trademarks excel,

  92. Cheap NFL Jerseys

    decorating a person’s segment for the interview can be as necessary as precisely what ones application speaks about you.

  93. Really appreciate you sharing this post.Thanks Again.

  94. they are hawaiian (while ‘m i just) and that i knew as a kid them are the useless sheepskin slippers a grandmother wore/gave you.

  95. coach outlet says:

    Adidas is not interested in the game of basketball related equipment, but it is not as popular as it is for a degree of other games,

  96. zentai store says:

    Look onto Zentai Spiderman portions, Hues, Designs, Are used to help. You may choose to find an authentic style. The more realistic the more effective it is. I have only been into zentai for about a 30 days now and am finding the many joys of it(And learning see how to sort in gloves) I currently only have the 1 fit although I am currently awaiting the appearance of the plain black one. Typically I am into it working with fetishistic value of it seeing which i possess a kink for gloves, Face goggles, Spandex and something the right, Which puts zentai head on up my ally. I like seeing girls in zentai leotards and fits but would like to determine more of them with no need of feet and gloves.
    zentai store

  97. Bending how large your global they value for money covering luxembourg. We have four eras may smoothness in the at the tables that him and i ever endured in advance or clients things which means. As large as the video game. Take pleasure in offers quite a bit related it while well, While getting proficiency chunk. Day didn such a lot have a subculture, He submitted precisely believed with regard regarding fill exclusive moment inside actor performances and after that, Becoming that owner, Take a rest off warcraft, On that your un named mmog in about”That Guild” Is actually usually located. As well, It truely does work on the ‘net could possibly approximately unusual in movie, When enjoyment is made for mass fast be appealing,
    diablo 3 gold guide

  98. in contrast, the brand Zealand formulating is amazing essential to fulfill expects on other great areas that features the best standard eastern side publicize,

  99. Bvlgari Outlet

    for that reason, The Lululemon’s trousers have a persons vision using both and even the men which will passion the company,

  100. gucci outlet says:

    a few pumpkin pie spice stirred in converts a usual loaves of bread recipes throughout something unique,

Leave a Reply

Your email address will not be published. Required fields are marked *

*

question razz sad evil exclaim smile redface biggrin surprised eek confused cool lol mad twisted rolleyes wink idea arrow neutral cry mrgreen

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>