We are already in the process of making n+ connections and the number of simultaneous builds has bee,simultaneous

來源:互聯網
上載者:User

We are already in the process of making n+ connections and the number of simultaneous builds has bee,simultaneous


simultaneous-build-throttle:
This is the maximum number of connections we can be building at any one time.
That is, the number of new connections that have been requested but aren’t yet available for use.
Because connections can be built using more than one thread (for instance, when they are built on demand)
and it takes a finite time between deciding to build the connection and it becoming available we need some
way of ensuring that a lot of threads don’t all decide to build a connection at once. (We could solve this in a
smarter way – and indeed we will one day) Default is 10.
是指在任一時刻,可以(同時)建立的最大串連數,也就是說,就是已經請求的、但還沒可用的新串連數量。因為串連可以用多線程建立,
從決定要建立串連到串連 可用是需要一定時間的,所以我們需要一些方式來避免大量的線程想同時建立串連。
(我們本應該找一個更聰明的方式來解決這個問題,總有一天我們會找到的)默 認值是10
當我使用140個使用者,進行壓力測試時,發現偶爾,會有多於10個要求同時建立串連的請求,當請求數量超過限定的數值時,會出現串連失敗的情況。
因此結論就是,當資料庫並發串連可能會比較高的應用,這個值應該適當的設大一點。
如果並發請求很高,可能出現的bug為

Caused by: java.sql.SQLException: We are already in the process of making 11 connections and the number of simultaneous builds has been throttled to 10

maximum-active-time:
If the housekeeper comes across a thread that has been active for longer than this then it will kill it. So make sure you set this to a number bigger than your slowest expected response! Default is 5 minutes.
如果一個線程啟用時間超過這個數值,線程會被殺死。所以要確保這個數值設定得比最慢的回應時間長。預設是5分鐘。守護進程會把串連池中多餘的可用線程(未 用的、超過這個時間的)殺死,最終保留的串連數量就是minimum-connection-count規定的數量。守護進程會根據house- keeping-sleep-time參數設定的時間隔定時檢查。

maximum-connection-lifetime:
The maximum amount of time that a connection exists for before it is killed (milliseconds). Default is 4 hours.
指一個串連最大的存活時間(毫秒為單位),超過這個時間,串連會被殺死。預設值是4小時。

overload-without-refusal-lifetime:
This helps us determine the pool status. If we have refused a connection within this threshold (milliseconds) then we are overloaded. Default is 60 seconds.
這個參數協助我們確定串連池的狀態,如果在這個時間閥值內(單位為毫秒)拒絕了一個串連,就認為是過載了。預設值是60。


alias:資料來源的別名

driver-url:url串連串,須確定使用者名稱和密碼

driver-class:驅動名

username:使用者名稱(proxool沒有使用,但是不能沒有)

password:密碼(proxool沒有使用,但是不能沒有)

maximum-new-connections:沒有空閑串連可以分配而在隊列中等候的最大請求數,超過這個請求數的使用者串連就不會被接受

test-before-use:

If you set this to true then each connection is tested (with whatever is defined in house-keeping-test-sql) before being served. If a connection fails then it is discarded and another one is picked. If all connections fail a new one is built. If that one fails then you get an SQLException saying so.

如果串連池在運行當中,出現網路或者資料庫故障而無法串連到資料庫,在恢複正常以後,由於串連是在串連池中持久儲存的,會出現串連仍然停用情況,這時串連池裡的串連實際上都是壞串連,怎麼讓串連池可以自動重連清除這些壞串連呢? 只要配置了test-before-use 參數,即每次取出串連都檢查串連是否可用,就可以做到讓串連池實現在故障恢複後自動重串連

需要注意一點,對於Mysql資料庫還必須在串連參數裡加上autoReconnect=true 參數,否則即使開啟了test-before-use 參數,仍然不能重串連!

 

fatal-sql-exception:

它是一個逗號分割的資訊片段.當一個SQL異常發生時,他的異常資訊將與這個資訊片段進行比較.如果在片段中存在,那麼這個異常將被認為是個致命錯 誤(Fatal SQL Exception ).這種情況下,資料庫連接將要被放棄.無論發生什麼,這個異常將會被重擲以提供給消費者.使用者最好自己配置一個不同的異常來拋出.


fatal-sql-exception-wrapper-class:

正如上面所說,你最好配置一個不同的異常來重擲.利用這個屬性,使用者可以封裝SQLException,使他變成另外一個異常.這個異常或者繼承 SQLException或者繼承字RuntimeException.proxool內建了2個實 現:’org.logicalcobwebs.proxool.FatalSQLException’ 和’org.logicalcobwebs.proxool.FatalRuntimeException’ .後者更合適.


house-keeping-sleep-time:

proxool自動偵察各個串連狀態的時間間隔(毫秒),偵察到閒置串連就馬上回收,逾時的銷毀 預設30秒)

house keeper 保留線程處於睡眠狀態的最長時間,house keeper 的職責就是檢查各個串連的狀態,並判斷是否需要銷毀或者建立.


house-keeping-test-sql:

如果發現了閒置資料庫連接.house keeper 將會用這個語句來測試.這個語句最好非常快的被執行.如果沒有定義,測試過程將會被忽略。

一般mysql可用select SYSDATE ,Oracle可用 select sysdate from dual 或者 select 1 from dual


injectable-connection-interface: 允許proxool實現被代理的connection對象的方法.


injectable-statement-interface: 允許proxool實現被代理的Statement 對象方法.


injectable-prepared-statement-interface: 允許proxool實現被代理的PreparedStatement 對象方法.


injectable-callable-statement-interface: 允許proxool實現被代理的CallableStatement 對象方法.


jmx: 略


jmx-agent-id: 略


jndi-name: 資料來源的名稱


maximum-active-time: 如果housekeeper 檢測到某個線程的啟用時間大於這個數值.它將會殺掉這個線程.所以確認一下你的伺服器的頻寬.然後定一個合適的值.預設是5分鐘.


maximum-connection-count:

The maximum number of connections to the database. Default is 15.

最大的資料庫連接數.預設是15


minimum-connection-count: 最小的資料庫連接數,預設是5


prototype-count:

If there are fewer than this number of connections available then we will build some more (assuming the maximum-connection-count is not exceeded). For example. Of we have 3 active connections and 2 available, but our prototype-count is 4 then it will attempt to build another 2. This differs from minimum-connection-count because it takes into account the number of active connections. minimum-connection-count is absolute and doesn’t care how many are in use. prototype-count is the number of spare connections it strives to keep over and above the ones that are currently active. Default is 0.

串連池中可用的串連數量.如果當前的串連池中的串連少於這個數值.新的串連將被建立(假設沒有超過最大可用數).例如.我們有3個活動串連2個可用 串連,而我們的prototype-count是4,那麼資料庫連接池將試圖建立另外2個串連.這和 minimum-connection-count不同. minimum-connection-count把活動的串連也計算在內.prototype-count 是spare connections 的數量.


recently-started-threshold: 略

statistics: 串連池使用狀況統計。 參數“10s,1m,1d”

statistics-log-level: 日誌統計跟蹤類型。 參數“ERROR”或 “INFO”

test-after-use: 略

trace: 如果為true,那麼每個被執行的SQL語句將會在執行期被log記錄(DEBUG LEVEL).你也可以註冊一個ConnectionListener (參看ProxoolFacade)得到這些資訊.

verbose: 詳細資料設定。 參數 bool 值

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.