최근에 들었던 소식은 한 서비스에서 파코나의 툴킷(http://www.percona.com/doc/percona-toolkit/2.2/)을 활용하면 중단없이 변경하려고 했었던 서비스가 있었다고 한다. DB부하가 너무 높아서 결국 실패했다고 하는 소식을 들었다.. innodb의 특성을 타기도 하고. 데이터 용량 이슈도 있으니. 잘 써야 할 듯 하다..
다음과 같은 Exception이 발생했다.
cubrid.jdbc.driver.CUBRIDException
Has been interrupted.
at cubrid.jdbc.driver.CUBRIDStatement.checkExecuteError(CUBRIDStatement.java:909)
at cubrid.jdbc.driver.CUBRIDStatement.executeCoreInternal(CUBRIDStatement.java:802)
at cubrid.jdbc.driver.CUBRIDStatement.executeCore(CUBRIDStatement.java:769)
at cubrid.jdbc.driver.CUBRIDPreparedStatement.execute(CUBRIDPreparedStatement.java:453)
at core.log.impl.PreparedStatementLoggable.execute(PreparedStatementLoggable.java:109)
at sun.reflect.GeneratedMethodAccessor30.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at core.log.aop.handler.DaoInfo.doAround(DaoInfo.java:95)
at core.log.aop.reflection.profiler.AroundProfiler.invoke(AroundProfiler.java:19)
at $Proxy3.execute(Unknown Source)
at sun.reflect.GeneratedMethodAccessor30.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at com.ibatis.common.jdbc.logging.PreparedStatementLogProxy.invoke(PreparedStatementLogProxy.java:62)
at $Proxy4.execute(Unknown Source)
at com.ibatis.sqlmap.engine.execution.SqlExecutor.executeQuery(SqlExecutor.java:182)
at com.ibatis.sqlmap.engine.mapping.statement.GeneralStatement.sqlExecuteQuery(GeneralStatement.java:205)
at com.ibatis.sqlmap.engine.mapping.statement.GeneralStatement.executeQueryWithCallback(GeneralStatement.java:173)
at com.ibatis.sqlmap.engine.mapping.statement.GeneralStatement.executeQueryForObject(GeneralStatement.java:104)
at com.ibatis.sqlmap.engine.impl.SqlMapExecutorDelegate.queryForObject(SqlMapExecutorDelegate.java:565)
at com.ibatis.sqlmap.engine.impl.SqlMapExecutorDelegate.queryForObject(SqlMapExecutorDelegate.java:540)
at com.ibatis.sqlmap.engine.impl.SqlMapSessionImpl.queryForObject(SqlMapSessionImpl.java:106)
at com.ibatis.sqlmap.engine.impl.SqlMapClientImpl.queryForObject(SqlMapClientImpl.java:84)
원인은 timeout과 관련된 것으로서, PreparedStatement.setQueryTimeout 으로 지정한 시간보다 긴 Query 실행시 나타날 수 있는 Exception이다. timeout을 길게 해주면 된다.
> create database wp
> GRANT USAGE ON *.* TO 'wp'@'localhost' IDENTIFIED BY '1111';
> GRANT ALL PRIVILEGES ON *.* TO 'wp'@'localhost';
> flush privileges;
* connectTimeout
- Timeout for socket connect (in milliseconds), with 0 being no timeout. Only works on JDK-1.4 or newer. Defaults to '0'
* socketTimeout
Timeout on network socket operations (0, the default means no timeout)
* initialTimeout
If autoReconnect is enabled, the initial time to wait between re-connect attempts (in seconds, defaults to '2').
* enableQueryTimeouts
When enabled, query timeouts set via Statement.setQueryTimeout() use a shared java.util.Timer instance for scheduling. Even if the timeout doesn't expire before the query is processed, there will be memory used by the TimerTask for the given timeout which won't be reclaimed until the time the timeout would have expired if it hadn't been cancelled by the driver. High-load environments might want to consider disabling this functionality.
* queryTimeoutKillsConnection
If the timeout given in Statement.setQueryTimeout() expires, should the driver forcibly abort the Connection instead of attempting to abort the query?
* loadBalanceBlacklistTimeout
Time in milliseconds between checks of servers which are unavailable.
* ConnectionKilledDueToTimeout
Connection closed to due to statement timeout being reached and "queryTimeoutKillsConnection" being set to "true".
* LoadBalancingConnectionProxy.badValueForLoadBalanceBlacklistTimeout
Bad value ''{0}'' for property "loadBalanceBlacklistTimeout".
"Il n'y a aucune ambigu, http://www.timberlandbaratas.com Timberland shops?té. Nos soldats, les soldats de la France, http://www.timberlandbaratas.com timberland, n'ont pas vocation à s'ingérer dans les affaires intérieures de la C?te d'Ivoire, http://www.timberlandbaratas.com botas timberland. Ils agissent, nos soldats, en vertu d'un mandat, http://www.timberlandbaratas.com Timberland Online, d'un mandat des Nations unies", http://www.timberlandbaratas.com timberland españa, a déclaré Nicolas Sarkozy lors de ses voeux aux armées, http://www.timberlandbaratas.com outlet timberland.Related articles:
http://ebhanglobaltopics.tistory.com/330 It is reveling in the news it has one two major awards in the airline industry in the space of just
http://8hertz.tistory.com/278 Cinq rebelles présumés ont été tués
내가 측정하려고 했던 것은 웹 서버에서 엄청나게 많은 쿼리를 날렸을 때, DB나 미들웨어가 잘 버텨주는 지에 대한 테스트였다.
0. 철저한 계획
아마도 이 부분이 중요했던 것 같다. 사람들을 설득하고. 어떻게 진행할 것인지 얘기
1. 웹 서버에서는 해야할 일
(1) 개발 DB에 리얼 DB에 있는 데이터를 그대로 덤프해서 저장
Row개수, index까지 똑같이
(2) 간단한 쿼리 테스트는 기본
(3) Transaction/procedure/join 테스트는 빼먹지 않기
(4) CLOB/한글 이슈 확인 - 응근히 이것을 테스트를 놓치기도 함. 골치 아파짐
=> 결국은 웹 서버나 게임서버에서 사용하는 모든 쿼리 테스트를 진행해야 한다.
(5) PrepareStaement 테스트 진행 (예전 버전의 Sequoia는 된다고 해놓고. 실제로는 지원이 안되었다.)
(6) PrepareStatement 테스트시 Hard 하게 테스트
(DB의 prepared statement cache size를 넘어서도록 한다. 그래서 항상 DB콜을 할 수 있도록 테스트 환경 구축)
(7) DBA와 충분히 얘기 - 내가 못보는 부분을 DBA입장에서 보도록 함
(8) 웹서버의 bottleneck을 없도록 해서 DB의 성능이 최대한 나오게 개발
(9) 웹 서버는 최대한 많이 두고, 한 서버에 cpu개수 만큼의 JVM Instance(웹 어플리케이션 서버)를 구축
2. 구축환경
load runner 혹은 - > 웹 서버 -> DB 혹은 DB 미들웨어
성능 테스트툴
3. DB 혹은 DB 미들웨어
(1) 가용성 테스트. (Active-Standby 테스트 : 문제없이 동작되는지 확인)
- 간단한 테스트
(프로세스 Kill / iptables 블락 / 랜선 빼기)
- Active한 서버를 내리고, Standby가 Active로 잘 돌아가는 지 확인
- Reconnect 를 통한 fail over 검증 필요
(2) 성능
- 물리 서버의 성능에 비례, 좋은 장비는 최고의 퍼포먼스
- 가용량 산정. Throughput 산정 가능
(3) 기능 테스트
- reconnect
- timeout
- connection pooling
connection을 pooling하고 있는데. DB에서 session kill를 하고 나서, 어떻게 하는지 확인
(4) QPS (query per second) 측정
job queue에 쌓이는 시점을 발견해야 함.. (임계점)
-> 안정 구간이 얼마정도인지 확보
댓글을 달아 주세요