๊ด€๋ฆฌ ๋ฉ”๋‰ด

โœ๐Ÿป๊ธฐ๋กํ•˜๋Š” ๋ธ”๋กœ๊ทธ

Hikari ์ตœ์ ์˜ Connection Pool Size๋ฅผ ์ฐพ์•„์„œ! ๋ณธ๋ฌธ

ํ”„๋กœ์ ํŠธ/Heeverse

Hikari ์ตœ์ ์˜ Connection Pool Size๋ฅผ ์ฐพ์•„์„œ!

์ฉ์‹œํ‚ด 2023. 11. 13. 20:26
728x90

vuser 200์œผ๋กœ 5๋ถ„๊ฐ„ ์„ฑ๋Šฅํ…Œ์ŠคํŠธ ์‹œ 25๋ฒˆ์˜ HikariPool-1 - Connection is not available, request timed out after 30000ms. SQLTransientConnectionException์„ ๋งˆ์ฃผํ–ˆ์Šต๋‹ˆ๋‹ค.  ์™œ Exception์ด ๋ฐœ์ƒํ•˜๊ณ , ์–ด๋–ป๊ฒŒ ํ•ด๊ฒฐํ–ˆ๋Š”์ง€ ์•Œ์•„๋ด…์‹œ๋‹ค.

 

์ด ๊ธ€์€ ์•„๋ž˜ ๋ชฉ์ฐจ๋กœ ๊ตฌ์„ฑ๋˜์–ด ์žˆ์Šต๋‹ˆ๋‹ค.

 

  1. Hikari Connection Pool ๋™์ž‘ ๋ฐฉ์‹
  2. Hikari CP Connection ํš๋“ ๊ณผ์ •
  3. Hikari CP Connection ๋ฐ˜๋‚ฉ ๊ณผ์ •
  4. ๋ฌธ์ œ ์›์ธ ๋ถ„์„
  5. ๋ฌธ์ œ ํ•ด๊ฒฐ ๋ฐฉ๋ฒ•

 

์›์ธ ๋ถ„์„ ์ „์— Hikari Connection pool ํš๋“ ๋ฐ ๋ฐ˜ํ™˜ ๊ณผ์ •์— ๋Œ€ํ•ด ์•Œ์•„๋ณด๊ฒ ์Šต๋‹ˆ๋‹ค.

Hikari Connection Pool ๋™์ž‘ ๋ฐฉ์‹

์œ„์—์„œ Hikari Connection Pool๋กœ๋ถ€ํ„ฐ connection์„ ํš๋“ํ•˜๋Š” ๋ฐฉ๋ฒ•์„ ์‚ดํŽด๋ดค์Šต๋‹ˆ๋‹ค. ํ•˜์ง€๋งŒ ์–ด๋–ค ๋ฐฉ๋ฒ•์œผ๋กœ connection ์ˆ˜๋ฅผ ์œ ์ง€ํ•˜๋Š”์ง€ ์‚ดํŽด๋ณด๊ฒ ์Šต๋‹ˆ๋‹ค.

Hikari Connection Pool์ด ์–ด๋–ป๊ฒŒ pool์„ ์œ ์ง€ํ•˜๋Š”์ง€๋Š” Hikari ํ…Œ์ŠคํŠธ ์ฝ”๋“œ์—์„œ ์•Œ ์ˆ˜ ์žˆ์—ˆ์Šต๋‹ˆ๋‹ค. 

 

  try (HikariDataSource ds = new HikariDataSource(config)) {
     getUnsealedConfig(ds).setIdleTimeout(3000);

     System.clearProperty("com.zaxxer.hikari.housekeeping.periodMs");

     SECONDS.sleep(1);

     HikariPool pool = getPool(ds);

     assertEquals("Total connections not as expected", 5, pool.getTotalConnections());
     assertEquals("Idle connections not as expected", 5, pool.getIdleConnections());

     try (Connection connection = ds.getConnection()) {
        Assert.assertNotNull(connection);

        MILLISECONDS.sleep(1500);

        assertEquals("Second total connections not as expected", 6, pool.getTotalConnections());
        assertEquals("Second idle connections not as expected", 5, pool.getIdleConnections());
     }

     assertEquals("Idle connections not as expected", 6, pool.getIdleConnections());

     MILLISECONDS.sleep(3000);

     assertEquals("Third total connections not as expected", 5, pool.getTotalConnections());
     assertEquals("Third idle connections not as expected", 5, pool.getIdleConnections());

 

HikariPool์ด ์ƒ์„ฑ๋˜๋ฉด HikariConfig ์„ธํŒ…๊ฐ’์„ ์ฝ์–ด TotalConnection์ˆ˜์™€ IdleConnection ์ˆ˜๋ฅผ ์œ ์ง€ํ•ฉ๋‹ˆ๋‹ค.

์ดํ›„, dataSource๋กœ๋ถ€ํ„ฐ 1๊ฐœ์˜ ์ถ”๊ฐ€ connection์„ ์–ป์œผ๋ฉฐ, IN USE ์ƒํƒœ๋กœ ๋งˆํ‚นํ•ฉ๋‹ˆ๋‹ค.

connection์ด ์ถ”๊ฐ€๋˜์–ด๋„ TotalConnection์€ ๋ณ€๊ฒฝ๋˜์ง€๋งŒ, IdleConnection์€ ๋ฐ”๋กœ ์ฆ๊ฐ€ํ•˜์ง€ ์•Š์Šต๋‹ˆ๋‹ค. Timeout์‹œ๊ฐ„๋งŒํผ InUSE์ƒํƒœ์˜€๋‹ค๊ฐ€ Idle ์ƒํƒœ๋กœ ๋ณ€๊ฒฝํ•ฉ๋‹ˆ๋‹ค. ๋˜๋‹ค์‹œ Timeout ์‹œ๊ฐ„๋งŒํผ ์ฒดํฌํ•˜๋‹ค๊ฐ€ ๋” ์ด์ƒ ์‚ฌ์šฉํ•˜์ง€ ์•Š์€ ๊ฒฝ์šฐ connection์„ ๋ฐ˜๋‚ฉํ•˜๊ฒŒ ๋ฉ๋‹ˆ๋‹ค.

 

HikariConfig์—๋Š” Timeout ์‹œ๊ฐ„์ด 30์ดˆ๋กœ ์„ค์ •๋˜์–ด ์žˆ์Šต๋‹ˆ๋‹ค.

private static final long CONNECTION_TIMEOUT = SECONDS.toMillis(30);

Hikari CP Connection ํš๋“ ๊ณผ์ •

HikariPool.getConnection()์„ ํš๋“ ์‹œ suspendResumeLock์„ ํš๋“ ํ›„ Database์™€์˜ ์ปค๋„ฅ์…˜์„ ํš๋“ํ•ฉ๋‹ˆ๋‹ค. connection์„ ์–ป์–ด์˜ค๋ฉด suspendResumeLock์„ ํ•ด์ œํ•ฉ๋‹ˆ๋‹ค.

 

connection์„ ์–ป๋Š” ๊ณผ์ •์€ ์Šค๋ ˆ๋“œ๋“ค์ด ๋‹ด๊ฒจ์žˆ๋Š” ConcurrentBag์œผ๋กœ๋ถ€ํ„ฐ connection Wrapperํด๋ž˜์Šค bagEntry๋ฅผ ์–ป์Šต๋‹ˆ๋‹ค. 

connectionBag.borrow()๋Š” 3๋‹จ๊ณ„๋ฅผ ๊ฑฐ์ณ ์‚ฌ์šฉ ๊ฐ€๋Šฅํ•œ(idle) Connection์„ ๋นŒ๋ ค์˜ค๊ฒŒ ๋ฉ๋‹ˆ๋‹ค.

 

borrow() ๋ฉ”์„œ๋“œ๊ฐ€ ํ˜ธ์ถœ๋˜๋ฉด ์•„๋ž˜์™€ ๊ฐ™์€ ์ˆœ์„œ์˜ ์กฐ๊ฑด์‹์„ ๊ฑฐ์น˜๊ฒŒ ๋ฉ๋‹ˆ๋‹ค. ์กฐ๊ฑด์‹์— ํ•ด๋‹นํ•  ๊ฒฝ์šฐ connection ๊ฐ์ฒด๋ฅผ ์–ป์–ด์˜ค๊ฒŒ ๋ฉ๋‹ˆ๋‹ค.

var poolEntry = connectionBag.borrow(timeout, MILLISECONDS);
  1. ์š”์ฒญํ•œ ์Šค๋ ˆ๋“œ๊ฐ€ threadList(ThreadLocal)์— ์ด๋ฏธ ์‚ฌ์šฉํ•œ connection์ด ์žˆ๋Š”์ง€ ํ™•์ธ. ์ด๋Š” ThreadLocalํƒ€์ž…์ด๋ฏ€๋กœ ๊ฐ ์Šค๋ ˆ๋“œ๋ณ„ ์ €์žฅ๊ณต๊ฐ„์„ ๊ฒ€์‚ฌ.
  2. Hikari Pool ์ „์ฒด ์ปค๋„ฅ์…˜ ํ’€์— ํ•ด๋‹นํ•˜๋Š” sharedList(CopyOnWriteArrayList)์— STATE_NOT_IN_USE์ƒํƒœ์˜ ์ปค๋„ฅ์…˜์ด ์žˆ๋Š”์ง€ ํ™•์ธ.
  3. ๋นŒ๋ฆด ์ˆ˜ ์—†๋Š” ์ปค๋„ฅ์…˜์ด ์—†์„ ๊ฒฝ์šฐ headoffQueue(SynchronouseQueue)์— ๋“ค์–ด๊ฐ€ ๋Œ€๊ธฐ -> ์ด๋•Œ ๊ฒฝ๊ณผ์‹œ๊ฐ„์ด ์„ค์ • ์‹œ๊ฐ„๋ณด๋‹ค ์ง€๋‚œ ๊ฒฝ์šฐ SQLTransientConnectionException ๋ฐœ์ƒ.

 

โ“์™œ threadList์˜ ์š”์†Œ๋“ค์„ ๋์—์„œ๋ถ€ํ„ฐ ๊ฒ€์‚ฌํ• ๊นŒ์š”?

final var list = threadList.get();
for (int i = list.size() - 1; i >= 0; i--) {
   final var entry = list.remove(i);
   @SuppressWarnings("unchecked")
   final T bagEntry = weakThreadLocals ? ((WeakReference<T>) entry).get() : (T) entry;
   if (bagEntry != null && bagEntry.compareAndSet(STATE_NOT_IN_USE, STATE_IN_USE)) {
      return bagEntry;
   }
}
  1. ๊ฐ€์žฅ ์ตœ๊ทผ์— ์‚ฌ์šฉํ•œ connection์„ ๊ฒ€์‚ฌํ•˜๊ธฐ ์œ„ํ•ด์„œ
  2. list ํƒ์ƒ‰ ์‹œ๊ฐ„์„ ์ค„์ด๊ธฐ ์œ„ํ•ด์„œ

threadList๋Š” Listํƒ€์ž… ์ด๋ฏ€๋กœ remove()๋ฅผ ์ฒซ ๋ฒˆ์งธ ์š”์†Œ๋ถ€ํ„ฐ ์‹œ์ž‘ํ•œ๋‹ค๋ฉด ๋’ค์— ์š”์†Œ๋“ค์„ ์•ž์œผ๋กœ ๋ฐ€์–ด์•ผ ํ•˜๋Š” O(N) ์‹œ๊ฐ„๋ณต์žก๋„๊ฐ€ ๋ฐœ์ƒํ•ฉ๋‹ˆ๋‹ค. ๋์—์„œ๋ถ€ํ„ฐ ์ฒดํฌํ•˜๋ฉด์„œ ์‹œ๊ฐ„ ๋ณต์žก๋„๋ฅผ O(1)๋กœ ์ค„์ผ ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

 

Hikari CP Connection ๋ฐ˜๋‚ฉ ๊ณผ์ •

  1. connection์„ ํš๋“ํ•œ ์Šค๋ ˆ๋“œ๊ฐ€ commit, exception์— ์˜ํ•ด rollback์ด ๋˜๋ฉด ์Šค๋ ˆ๋“œ๋Š” ์Šค๋ ˆ๋“œ ํ’€์— ๋ฐ˜๋‚ฉ๋˜๋Š” ๊ณผ์ •์„ ๊ฑฐ์นฉ๋‹ˆ๋‹ค.
  2. STATE _NOT_IN_USE๋กœ ํ‘œ์‹œ๋˜๋ฉฐ, handOffQUeue์—์„œ ๋Œ€๊ธฐ ์ค‘์ธ ์Šค๋ ˆ๋“œ๊ฐ€ ์žˆ๋Š”์ง€ ํ™•์ธ ํ›„, ๋Œ€๊ธฐ์ƒํƒœ์˜ ์Šค๋ ˆ๋“œ๊ฐ€ ์กด์žฌ ์‹œ handOffQueue๋กœ ๋ฐ˜๋‚ฉํ•ฉ๋‹ˆ๋‹ค. 
  3. ๋Œ€๊ธฐ ์ค‘์ธ ์Šค๋ ˆ๋“œ๊ฐ€ ์—†๋‹ค๋ฉด, threadLocal๋‚ด์˜ list value์— ํ˜„์žฌ connection ์ •๋ณด๋ฅผ ์ถ”๊ฐ€ํ•ฉ๋‹ˆ๋‹ค.

์œ„์—์„œ Hikari Connection Pool์ด ์–ด๋–ป๊ฒŒ ๋™์ž‘ํ•˜๋Š”์ง€ ์•Œ์•„๋ณธ ๋‚ด์šฉ์„ ํ† ๋Œ€๋กœ, Exception์ด ๋ฐœ์ƒํ•œ ์›์ธ์„ ๋ถ„์„ํ•ด ๋ณด๊ฒ ์Šต๋‹ˆ๋‹ค.

๋ฌธ์ œ ์›์ธ ๋ถ„์„

Connection pool์„ ๋‹ค ์ฐจ์ง€ํ•œ ์ƒํƒœ์—์„œ ๋งŽ์€ ๋ถ€ํ•˜๋กœ ๋ฐœ์ƒํ•œ ๋‹ค๋ฅธ ์Šค๋ ˆ๋“œ๋“ค์ด getConnection์„ ์š”์ฒญํ•˜๋‹ค๊ฐ€, ๋” ์ด์ƒ ํš๋“ํ•  connection์ด ์—†์–ด ๋งˆ์ง€๋ง‰ ๋Œ€๊ธฐ ์œ„์น˜์ธ handOffQueue์—์„œ ๋” ์ด์ƒ connection์„ ํš๋“ํ•˜์ง€ ๋ชปํ•˜๊ณ  SQLTransientConnectionException์ด ๋ฐœ์ƒํ–ˆ๋˜ ๊ฒƒ์ž…๋‹ˆ๋‹ค.

tomcat ์„œ๋ฒ„๊ฐ€ ๋– ์žˆ๋Š” docker ์ปจํ…Œ์ด๋„ˆ ์ž์› ์‚ฌ์šฉ๋Ÿ‰

๋˜ํ•œ ๋ฉ”๋ชจ๋ฆฌ ์ž์›์— ๋น„ํ•ด CPU์‚ฌ์šฉ๋Ÿ‰์ด 100%๋ฅผ ๋„˜๋Š” ์ƒํ™ฉ์ด ๋ฐœ์ƒํ–ˆ์Šต๋‹ˆ๋‹ค. ์ด๋Š” ๋ถ€ํ•˜๊ฐ€ ๋ฐœ์ƒํ•˜๋Š” ์ƒํ™ฉ์—์„œ tomcat ์Šค๋ ˆ๋“œ ๊ฐ„ HikariPool์˜ connection์„ ํš๋“ํ•˜๊ณ ์ž race condition์ด ๋ฐœ์ƒํ–ˆ๊ธฐ ๋•Œ๋ฌธ์ž…๋‹ˆ๋‹ค. 

 

heeverse๋Š” ํ†ฐ์บฃ ์Šค๋ ˆ๋“œ ์ˆ˜๋ฅผ 10๊ฐœ (default)๋ฅผ ์‚ฌ์šฉํ•˜๊ณ  ์žˆ์Šต๋‹ˆ๋‹ค. ํ†ฐ์บฃ ์Šค๋ ˆ๋“œ ์ˆ˜๊ฐ€ 10๊ฐœ์ด๊ณ , hikari Connection Pool Size๋„ 10๊ฐœ๋ฉด ์ถฉ๋ถ„ํ•  ๊ฒƒ์ด๋ผ ์˜ˆ์ƒํ–ˆ์Šต๋‹ˆ๋‹ค. 

visual VM์œผ๋กœ ํ™•์ธํ•œ ์Šค๋ ˆ๋“œ ์ˆ˜

Hikari wiki๋ฅผ ์ฐธ๊ณ ํ•˜๋ฉด ํ•˜๋‚˜์˜ ์Šค๋ ˆ๋“œ์—์„œ ์ˆ˜ํ–‰ํ•˜๋Š” ๋‹ค์ˆ˜์˜ connection์— ์˜ํ•ด Pool-Locking์ด ๋ฐœ์ƒํ•  ์ˆ˜ ์žˆ๋‹ค๊ณ  ํ•ฉ๋‹ˆ๋‹ค. 

"Pool-locking"
The prospect of "pool-locking" has been raised with respect to single actors that acquire many connections.

 

hikari Pool State

 

Exception์„ ๋ฐœ์ƒ์‹œํ‚จ API ์ˆ˜ํ–‰ ์‹œ ์–ด๋–ค ํŠธ๋žœ์žญ์…˜์ด ์ˆ˜ํ–‰๋˜๋Š”์ง€ ์‚ดํŽด๋ณด๊ฒ ์Šต๋‹ˆ๋‹ค.

ํ•˜๋‚˜์˜ ํ‹ฐ์ผ“ ์˜ˆ๋งคํ•˜๊ธฐ API๋ฅผ ์ˆ˜ํ–‰ํ•˜๊ธฐ ์œ„ํ•ด์„œ๋Š” ๋‘ ๊ฐ€์ง€ ์ข…๋ฅ˜์˜ ํŠธ๋žœ์žญ์…˜์ด ๋ฐœ์ƒํ•ฉ๋‹ˆ๋‹ค. 

  1. ๋กœ๊ทธ์ธ - ๋‹จ๊ธฐ ํŠธ๋žœ์žญ์…˜
  2. ํ‹ฐ์ผ“ ์˜ˆ๋งค - ์žฅ๊ธฐ ํŠธ๋žœ์žญ์…˜(ํ•˜๋‚˜์˜ ์Šค๋ ˆ๋“œ์—์„œ 5๋ฒˆ์˜ ํŠธ๋žœ์žญ์…˜ ๋ฐœ์ƒ)
    • JWTํ† ํฐ ๊ฒ€์‚ฌ
    • ticket order ์ƒ์„ฑ
    • ํ‹ฐ์ผ“ ์˜ˆ๋งค๋ฅผ ์œ„ํ•œ lock
    • ๋น„๋™๊ธฐ ๋กœ๊ทธ ์ƒ์„ฑ
    • ๊ฒฐ๊ณผ ํ‹ฐ์ผ“ ์กฐํšŒ

์žฅ๊ธฐ ํŠธ๋žœ์žญ์…˜ ์ค‘ ํ‹ฐ์ผ“ ์˜ˆ๋งค๋ฅผ ์œ„ํ•œ Lock์„ ์ƒ์„ฑ ์‹œ, Record Lock์„ ์ˆ˜ํ–‰ํ•˜๊ธฐ ์œ„ํ•ด, ๋น„๊ด€์  ๋ฝ์„ ์ˆ˜ํ–‰ํ•˜๊ณ  ์žˆ์Šต๋‹ˆ๋‹ค. ํ•˜๋‚˜์˜ ์Šค๋ ˆ๋“œ์— ์—ฌ๋Ÿฌ ์ปค๋„ฅ์…˜์„ ์–ป๋Š” ์ž‘์—… + Lock์ˆ˜ํ–‰๊นŒ์ง€ ๊ฒน์น˜๊ฒŒ ๋˜๋Š” ์ƒํ™ฉ์ด ๋˜์—ˆ์Šต๋‹ˆ๋‹ค. 

๋ฌธ์ œ ํ•ด๊ฒฐ ๋ฐฉ๋ฒ•

๊ทธ๋Ÿผ ๋ฌธ์ œ๋ฅผ ์–ด๋–ป๊ฒŒ ํ•ด๊ฒฐํ•  ์ˆ˜ ์žˆ์„๊นŒ์š”? ๋‘ ๊ฐ€์ง€ ๋ฐฉ๋ฒ•์œผ๋กœ ๋ฌธ์ œ ํ•ด๊ฒฐ์„ ์‹œ๋„ํ•ด ๋ณด์•˜์Šต๋‹ˆ๋‹ค.

 

1. data source ๋ถ„๋ฆฌ๋ฅผ ํ†ตํ•œ ์Šค๋ ˆ๋“œ ๊ฒฝํ•ฉ ๊ฐ์†Œ์‹œํ‚ค๊ธฐ

For example, systems with a mix of long running transactions and very short transactions are generally the most difficult to tune with any connection pool. In those cases, creating two pool instances can work well
์˜ˆ๋ฅผ ๋“ค์–ด, ์žฅ๊ธฐ ์‹คํ–‰ ํŠธ๋žœ์žญ์…˜๊ณผ ๋งค์šฐ ์งง์€ ํŠธ๋žœ์žญ์…˜์ด ํ˜ผํ•ฉ๋œ ์‹œ์Šคํ…œ์€ ์ผ๋ฐ˜์ ์œผ๋กœ ์—ฐ๊ฒฐ ํ’€์„ ์กฐ์ •ํ•˜๊ธฐ๊ฐ€ ๊ฐ€์žฅ ์–ด๋ ต์Šต๋‹ˆ๋‹ค. ์ด๋Ÿฌํ•œ ๊ฒฝ์šฐ ๋‘ ๊ฐœ์˜ ํ’€ ์ธ์Šคํ„ด์Šค๋ฅผ ๋งŒ๋“œ๋Š” ๊ฒƒ์ด ์ž˜ ์ž‘๋™ํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

 

์žฅ๊ธฐ ํŠธ๋žœ์žญ์…˜์—๋Š” ticket, ticket-orderํ…Œ์ด๋ธ”์—์„œ ์ž‘์—…์ด ์ˆ˜ํ–‰๋ฉ๋‹ˆ๋‹ค. ๋‘˜ ์ค‘ select for update๋ฅผ lock์œผ๋กœ ์ธํ•œ ๋ณ‘๋ชฉ์ง€์ ์„ ๋ฐœ์ƒ์‹œํ‚ค๋Š” ticket๊ณผ ๊ทธ ์ด์™ธ ํ…Œ์ด๋ธ”์˜ datasource๋ฅผ ๋ถ„๋ฆฌํ•ด ๋ดค์Šต๋‹ˆ๋‹ค. ํ•˜์ง€๋งŒ data source๋ฅผ ๋ถ„๋ฆฌํ•˜๋Š” ์ˆœ๊ฐ„ ํŠธ๋žœ์žญ์…˜ ๊ณต์œ ๊ฐ€ ๋˜์ง€ ์•Š์•„ dabasae lock์ด ๊ณต์œ ๋˜์ง€ ์•Š์•˜์Šต๋‹ˆ๋‹ค.

 

 

2. ์ตœ์ ์˜ hikari Pool size ์ฐพ๊ธฐ

Hikari wiki์— ๋”ฐ๋ฅด๋ฉด Pool-locking์„ ํ”ผํ•˜๊ธฐ ์œ„ํ•œ ์ตœ์ ์˜ pool size ๊ณต์‹์„ ์ œ์•ˆํ•˜๊ณ  ์žˆ์Šต๋‹ˆ๋‹ค.

pool size = Tn x (Cm - 1) + 1

 

Tn :  ์ตœ๋Œ€ ์Šค๋ ˆ๋“œ ์ˆ˜, Cm : ์‹ฑ๊ธ€ ์Šค๋ ˆ๋“œ์—์„œ ๋™์‹œ์— ์ˆ˜ํ–‰๋˜๋Š” ์ปค๋„ฅ์…˜ ์ˆ˜ 

heeverse์—์„œ๋Š” tomcat ์ตœ๋Œ€ ์Šค๋ ˆ๋“œ ์ˆ˜ = 100, ์‹ฑ๊ธ€ ์Šค๋ ˆ๋“œ์—์„œ ๋™์‹œ์— ์ˆ˜ํ–‰๋˜๋Š” ์ปค๋„ฅ์…˜ ์ˆ˜  = 5๋ฅผ ๋Œ€์ž…ํ•˜์—ฌ 41์˜ pool size๋ฅผ ์„ค์ •ํ–ˆ์Šต๋‹ˆ๋‹ค.

 

pool size ์กฐ์ • ํ›„ HIkari Pool State

์ตœ์ ์˜ pool size ์„ค์ •์„ ํ†ตํ•ด Hikari Connection Pool-locking์„ ํ”ผํ•  ์ˆ˜ ์žˆ์—ˆ์Šต๋‹ˆ๋‹ค.

 

์ด๋ฒˆ์—๋Š” connection pool size ์กฐ์ •์œผ๋กœ ํ•ด๊ฒฐํ–ˆ์ง€๋งŒ, hikari wiki์— ๋”ฐ๋ฅด๋ฉด ํ•˜๋‚˜์˜ ์Šค๋ ˆ๋“œ์—์„œ ์—ฌ๋Ÿฌ ์ปค๋„ฅ์…˜์„ ๋งบ์ง€ ์•Š๋„๋ก ์• ํ”Œ๋ฆฌ์ผ€์ด์…˜ ๋ ˆ๋ฒจ์—์„œ ์กฐ์ •ํ•˜๋Š” ๊ฒƒ์„ ๊ฒ€ํ† ํ•˜๋ผ๊ณ  ํ•ฉ๋‹ˆ๋‹ค. ์• ํ”Œ๋ฆฌ์ผ€์ด์…˜ ๋ ˆ๋ฒจ์—์„œ ํ•˜๋‚˜์˜ ์Šค๋ ˆ๋“œ์—์„œ ์ตœ์†Œํ•œ์˜ ํŠธ๋žœ์žญ์…˜์œผ๋กœ ํ‹ฐ์ผ“ ์˜ˆ๋งค๋ฅผ ํ•  ์ˆ˜ ์žˆ์„์ง€ ๋ถ„์„ํ•ด ๋ด์•ผ๊ฒ ์Šต๋‹ˆ๋‹ค.


[์ฐธ๊ณ ]

https://github.com/brettwooldridge/HikariCP/wiki/About-Pool-Sizing

https://saramin.github.io/2023-04-27-order-error/

https://techblog.woowahan.com/2664/

728x90
๋ฐ˜์‘ํ˜•