<rt id="bn8ez"></rt>
<label id="bn8ez"></label>

  • <span id="bn8ez"></span>

    <label id="bn8ez"><meter id="bn8ez"></meter></label>

    隨筆-35  評論-33  文章-0  trackbacks-0
      2016年7月26日

          已經一個多月沒有寫東西了,不過最近確實很忙。前兩天在線上碰到一個C3P0的鏈接死鎖的異常,話說這個上古神物 ,我已經是很久不碰了。先貼異常



    異常截圖

    "apparent deadlocks":名詞解釋是說c3p0拿到鏈接之后,最終使用之后沒有返回到pool,導致死鏈檢測失敗。經過在stack Overflow檢索,https://stackoverflow.com/questions/3730844/c3p0-apparent-deadlock-when-the-threads-are-all-empty.發現增加一個statementCacheNumDeferredCloseThreads該參數的定義,就可以避免這個問題。

    經過查看官方文檔:http://www.mchange.com/projects/c3p0/#statementCacheNumDeferredCloseThreads



    解釋:如果把該值設為超過1,statement的緩存就會自動跟蹤當前可用的connections,如果沒有再用,就會自動銷毀掉。如果需要另外的線程來專門銷毀緩存的statement,則還需要設置maxStatements與maxStatementsPerConnection。

    再貼一個官方的說明:

    Configuring Statement Pooling

    c3p0 implements transparent PreparedStatement pooling as defined by the JDBC spec. Under some circumstances, statement pooling can dramatically improve application performance. Under other circumstances, the overhead of statement pooling can slightly harm performance. Whether and how much statement pooling will help depends on how much parsing, planning, and optimizing of queries your databases does when the statements are prepared. Databases (and JDBC drivers) vary widely in this respect. It's a good idea to benchmark your application with and without statement pooling to see if and how much it helps.

    You configure statement pooling in c3p0 via the following configuration parameters:

    maxStatements

    maxStatementsPerConnection

    statementCacheNumDeferredCloseThreads

    maxStatementsis JDBC's standard parameter for controlling statement pooling.maxStatementsdefines the total numberPreparedStatementsa DataSource will cache. The pool will destroy the least-recently-used PreparedStatement when it hits this limit. This sounds simple, but it's actually a strange approach, because cached statements conceptually belong to individual Connections; they are not global resources. To figure out a size formaxStatementsthat does not "churn" cached statements, you need to consider the number offrequently usedPreparedStatements in your application,and multiply that by the number of Connections you expect in the pool (maxPoolSizein a busy application).

    maxStatementsPerConnectionis a non-standard configuration parameter that makes a bit more sense conceptually. It defines how many statements each pooled Connection is allowed to own. You can set this to a bit more than the number ofPreparedStatementsyour applicationfrequentlyuses, to avoid churning.

    If either of these parameters are greater than zero, statement pooling will be enabled. If both parameters are greater than zero, both limits will be enforced. If only one is greater than zero, statement pooling will be enabled, but only one limit will be enforced.

    大概意思就是這兩個,有一個值如果大于0,c3p0的statement pool就會發生作用。

    以上所有的配置都是基于c3p0的最新版本。PS一下,還是2015年的JAR。



    通過引入最新的C3P0包,另外增加了兩段配置,線上觀察兩天,問題解決。



    最后打個小廣告,JAVA世界最快的JDBC連接池,非HikariCP莫屬。已經甩c3p0好幾個街角,有圖有真像。



    posted @ 2017-11-10 15:25 alexcai 閱讀(1800) | 評論 (0)編輯 收藏
         摘要: 在word的處理之中,文字,各種類型的圖片,最復雜的公式,之前編寫的API基本都覆蓋了。不過,昨天在做一個文檔測試時,發現表格沒有能很好的處理。  閱讀全文
    posted @ 2017-08-25 15:54 alexcai 閱讀(757) | 評論 (0)編輯 收藏
         摘要: HDFS和MapReduce是Hadoop的兩大核心,除此之外Hbase、Hive這兩個核心工具也隨著Hadoop發展變得越來越重要。今天我們只初步的看看HDFS.  閱讀全文
    posted @ 2017-07-24 10:35 alexcai 閱讀(663) | 評論 (0)編輯 收藏
         摘要: 使用thrift已經有段時間了,目前基本是clien+server的方式,負載是通過nginx來處理。這種處理方式有兩個比較大的弊端:  閱讀全文
    posted @ 2017-06-29 16:39 alexcai 閱讀(882) | 評論 (0)編輯 收藏
        www.taggerin.com,主要處理日常文檔的在線編輯,以及與Markdown,PDF,html等格式的雙向轉換.聽說內測版本已經發布。真正的文檔在線編輯與預覽。?
    posted @ 2017-06-02 09:45 alexcai 閱讀(708) | 評論 (0)編輯 收藏
         摘要: 一般的業務開發,不會涉及到多種數據庫類型的操作。因為,無論是對于開發,還是運維,成本都是非常高的。如果是ORACLE數據庫到MYSQL的數據備份,目前我所了解的開源解決方案有2種:  閱讀全文
    posted @ 2016-12-15 13:33 alexcai 閱讀(1240) | 評論 (0)編輯 收藏
         摘要: 作為日常支付業務,微信的接入逐漸進入了大家的視野。今天以PC端接入微信支付的基本流程來說明。  閱讀全文
    posted @ 2016-07-26 11:59 alexcai 閱讀(1443) | 評論 (2)編輯 收藏
    主站蜘蛛池模板: 亚洲国产精品久久久久秋霞影院| 亚洲av日韩av欧v在线天堂| 国产av无码专区亚洲av桃花庵| 免费人成网站永久| 成人永久免费福利视频网站| 亚洲综合精品第一页| 无码专区永久免费AV网站| 91亚洲性爱在线视频| 丁香花免费完整高清观看| ass亚洲**毛茸茸pics| 午夜宅男在线永久免费观看网| 亚洲乱码在线视频| 思思99re66在线精品免费观看| 亚洲久热无码av中文字幕| 亚洲阿v天堂在线2017免费| 一区二区三区精品高清视频免费在线播放 | 深夜a级毛片免费无码| 亚洲国产婷婷综合在线精品| 四虎影视久久久免费| 亚洲自偷自偷图片| 精品无码AV无码免费专区 | 无码国产精品一区二区免费式直播| 亚洲国产中文在线视频| 国产成人免费高清激情视频| 亚洲αⅴ无码乱码在线观看性色 | 免费的一级片网站| 一级做a爱过程免费视| 亚洲AV中文无码乱人伦下载| 免费在线视频你懂的| 国产精品亚洲av色欲三区| 国产亚洲视频在线播放| 在线a免费观看最新网站| 亚洲精品国产高清在线观看| 亚洲精品岛国片在线观看| 鲁丝片一区二区三区免费| 亚洲va在线va天堂成人| 亚洲国产精品一区二区第一页免 | **实干一级毛片aa免费| 亚洲av午夜电影在线观看| 亚洲一区二区三区影院| 99在线视频免费观看视频 |