Skip to content
컴퓨터잡담
2010.04.27 11:03

Mysql 에러메시지

조회 수 17549 추천 수 0 댓글 0
?

단축키

Prev이전 문서

Next다음 문서

크게 작게 위로 아래로 댓글로 가기 인쇄
?

단축키

Prev이전 문서

Next다음 문서

크게 작게 위로 아래로 댓글로 가기 인쇄



super_user>mysqladmin status

Uptime: 5263  Threads: 2  Questions: 577405  Slow queries: 11  Opens: 356  Flush

 tables: 1  Open tables: 115  Queries per second avg: 109.710


super_user>mysqladmin status

Uptime: 5480  Threads: 1  Questions: 602952  Slow queries: 11  Opens: 416  Flush

 tables: 1  Open tables: 58  Queries per second avg: 110.27


super_user>mysqladmin status

Uptime: 5481  Threads: 2  Questions: 603056  Slow queries: 11  Opens: 416  Flush

 tables: 1  Open tables: 58  Queries per second avg: 110.26



Mysql을 재시작한지 불과 1시간 30분만의 결과이다.


Slow queries: 11개 / Opens :416개 / Flush tables: 1회 / 평균 쿼리/초 : 110.26


MySQL의 느린 응답을 나타낸다. => slow_queries와 slow_launch_threads

부하가 심하다는 것을 나타낸다 =>   threads_created,  max_used_connections,  opend_tables이 큰 경우 (이 경우 table_cache를 올리자)

문제는 테이블 캐시는 안늘어남.. ㅎ

인덱스를 많이 읽는다. => handler_read_key가 높은 경우

락 경쟁과 관련된 항목 =>  table_locks_waited VS table_locks_immediate , 만약 table_locks_waited가 높으면, myisam에서 innodb로 변경하는 것이 좋다.



흐미... 미친다.


왜이럴까?


phpMyAdmin 의 status 중 붉은색으로 나오는 리스트는 아래와 같다.




Handler_read_rnd 1,488k

You probably have alot of queries that require MySQL to scan whole tables or you have joins that don't use keys properly.


Handler_read_rnd_next  823k

Generally this suggests that your tables are not properly indexed or that your queries are not written to take advantage of the indexs you have.


Created_tmp_disk_tables  727

tmp_table_size를 늘리라는 설명이 있지만 사실 엄청나게 큼.

그리고 mysql 안에서의 status를 보면 0.


opened_tables  445         

your table cache value is probably too small. 

음,, 테이블캐쉬가 900이 넘는데???

사용중인건 100개도 안되는데....


table_locks_waited 1,123

If ths is high, and you have performance problems, you should first optimize your queries, and then either split your table or tables or use replication.



마지막으로 

On a busy server, the byte counters may overrun, so those statistics as reported by the MySQL server may be incorrect.






하지만 mysql에서 status를 해보면,



mysql> show status like '%con%';

+--------------------------+-------+

| Variable_name            | Value |

+--------------------------+-------+

| Aborted_connects         | 0     |

| Com_show_contributors    | 0     |

| Connections              | 17217 |

| Max_used_connections     | 15    |

| Ssl_client_connects      | 0     |

| Ssl_connect_renegotiates | 0     |

| Ssl_finished_connects    | 0     |

| Threads_connected        | 3     |

+--------------------------+-------+

8 rows in set (0.00 sec)


처음에는 아무생각없이 Max_connections을 높였다.

300, 500, 1000... 헌데, 올리면 올릴수록 문제가 생겼다.

이유는 최대접속수를 늘리면 테이블 수가 줄어들기 때문이다.

join_table과 연관이 있다는데 아직 내용을 알지는 못함.


threads_connected는 사실 cpu와 램, 하드 속도만 빠르면 크게 증가하지 않는다.

이에 따라 Max_used_connections이 많이 늘어나는 것은 접속자가 많다는 이유가 될수도 있지만

환경설정이 잘못될 경우 머무르는 시간이 길어져 늘어날 수도 있다.

물론 my.ini 환경설정도 아주 중요하지만.. ^^;;


현재로 봐서는 정상!!!



mysql> show status like '%table%';


| Created_tmp_disk_tables  | 0      |

| Created_tmp_tables       | 0      |

| Open_table_definitions   | 124    |

| Open_tables              | 93     |

| Opened_table_definitions | 0      |

| Opened_tables            | 0      |

| Slave_open_temp_tables   | 0      |

| Table_locks_immediate    | 597693 |

| Table_locks_waited       | 1227   |

+--------------------------+--------+

23 rows in set (0.00 sec)


오픈중인 테이블수 100개를 초과하지 않음.

table_locks_waited VS table_locks_immediate => table_locks_waited가 높으면, myisam에서 innodb로 변경하는 것이 좋다.

헌데 innodb를 사용하면 시스템 전체가 느려진다. 


table_cache가 증가하지 않는부분에 대해서 찾아보았지만

file descriptors와 관련이 있다고 하여 max_connections와 값을 조정해보았지만 변동이 없슴.


이 값이 '0'이면 mysqld는 max_connections*5 

또는 max_connections + table_cache*2 (whichever is larger) number of files이 필요하다 

mysqld가 'Too many open files'에러를 나타내면 이 값을 증가시켜야 한다. 

open_files_limit '0'이 아니면 mysqld는 file descriptors가 setrlimit()를 사용하도록 바꾸기위해 이것을 사용한다 

open_files_limit '0'이면, mysqld는 max_connections*5 




mysql> show status like '%thread%';

+------------------------+-------+

| Variable_name          | Value |

+------------------------+-------+

| Delayed_insert_threads | 0     |

| Slow_launch_threads    | 0     |

| Threads_cached         | 11    |

| Threads_connected      | 4     |

| Threads_created        | 15    |

| Threads_running        | 3     |

+------------------------+-------+

6 rows in set (0.00 sec)


mysql>


mysql> show status like '%key%';

+------------------------+-----------+

| Variable_name          | Value     |

+------------------------+-----------+

| Com_assign_to_keycache | 0         |

| Com_preload_keys       | 0         |

| Com_show_keys          | 0         |

| Handler_read_key       | 0         |

| Key_blocks_not_flushed | 0         |

| Key_blocks_unused      | 172626    |

| Key_blocks_used        | 58002     |

| Key_read_requests      | 217456662 |

| Key_reads              | 159168    |

| Key_write_requests     | 1009069   |

| Key_writes             | 35368     |

+------------------------+-----------+

11 rows in set (0.00 sec)


mysql>


variables는




mysql> show variables like '%max_con%';

+--------------------+-------+

| Variable_name      | Value |

+--------------------+-------+

| max_connect_errors | 10    |

| max_connections    | 151   |

+--------------------+-------+

2 rows in set (0.00 sec)



mysql> show variables like '%thread%';

+----------------------------+---------------------------+

| Variable_name              | Value                     |

+----------------------------+---------------------------+

| max_delayed_threads        | 20                        |

| max_insert_delayed_threads | 20                        |

| myisam_repair_threads      | 1                         |

| pseudo_thread_id           | 17186                     |

| thread_cache_size          | 128                       |

| thread_handling            | one-thread-per-connection |

| thread_stack               | 196608                    |

+----------------------------+---------------------------+

7 rows in set (0.00 sec)


mysql> show variables like '%table%';

+----------------------------+-----------+

| Variable_name              | Value     |

+----------------------------+-----------+

| big_tables                 | OFF       |

| lower_case_table_names     | 1         |

| max_heap_table_size        | 268435456 |

| max_tmp_tables             | 256       |

| old_alter_table            | OFF       |

| sql_big_tables             | OFF       |

| table_definition_cache     | 256       |

| table_lock_wait_timeout    | 50        |

| table_open_cache           | 943       |

| table_type                 | MyISAM    |

| tmp_table_size             | 402653184 |

| updatable_views_with_limit | YES       |

+----------------------------+-----------+

12 rows in set (0.00 sec)


mysql> show variables like '%key%';

+--------------------------+------------+

| Variable_name            | Value      |

+--------------------------+------------+

| delay_key_write          | ON         |

| foreign_key_checks       | ON         |

| have_rtree_keys          | YES        |

| key_buffer_size          | 268435456  |

| key_cache_age_threshold  | 300        |

| key_cache_block_size     | 1024       |

| key_cache_division_limit | 100        |

| max_seeks_for_key        | 4294967295 |

| ssl_key                  |            |

+--------------------------+------------+

9 rows in set (0.00 sec)


mysql>



로그인 후 댓글쓰기가 가능합니다.

?

List of Articles
번호 분류 제목 날짜 조회 수
117 파이썬 키움 증권 API를 이용하여 주식 자동 매매 프로그램 개발 3 2021.09.07 3928
116 파이썬 키움증권 OpenAPI 당황스러움 file 2021.09.06 1749
115 파이썬 키움증권 openAPI 지정가분할매수주문.py 2021.09.13 3532
114 컴퓨터잡담 타지역 농지매입 2021.06.01 1108
113 컴퓨터잡담 탐색기 다른 이름으로 저장하기 저장위치 즐겨찾기 폴더 변경하기 2 file 2012.03.02 5294
112 컴퓨터잡담 탐색기 속성 변경하여 특정 폴더 열기 3 2011.12.18 6834
111 WindowsTip 탐색기로 ftp 폴더 바로열기 file 2013.12.03 19665
110 컴퓨터잡담 테블릿을 세컨트모니터로??? 2023.04.26 38077
109 컴퓨터잡담 텍스트를 한글로 읽어주는 사이트 1 file 2013.04.18 9527
108 컴퓨터잡담 토렌트 다운로드한 파일이 실행되지 않을경우 2010.11.11 5406
107 컴퓨터잡담 툴바제작사이트 1 2011.09.15 4055
106 컴퓨터잡담 트랜지스터의 종류와 특정 2013.10.12 28525
105 컴퓨터잡담 트위터 개발하기 3 2010.04.26 13817
104 컴퓨터잡담 특정 파일을 제외한 현재 디렉토리 내의 모든 파일을 삭제하는 배치파일 2022.07.14 32730
103 Server 특정범위 안의 모든 문자 수 찾기 3 2012.06.19 7587
102 컴퓨터잡담 특정사이트 접속 느려질 경우 대처방법 1 2011.08.09 4552
101 컴퓨터잡담 티맥스 앞날이 깜깜 2009.07.08 17160
100 컴퓨터잡담 티맥스 윈도우가 살아남는 방법 5 1 2009.07.24 22701
99 컴퓨터잡담 티맥스OS 무료배포도 판매 수익의 세배이상 가능하다 2 2009.07.26 24566
98 파이썬 파이썬 any, all 사용하기(배열데이터 안에 값이 하나라도 있는지 또는 모두 있는지 비교) 2021.09.11 1956
Board Pagination Prev 1 ... 39 40 41 42 43 ... 46 Next
/ 46

http://urin79.com

우린친구블로그

sketchbook5, 스케치북5

sketchbook5, 스케치북5

나눔글꼴 설치 안내


이 PC에는 나눔글꼴이 설치되어 있지 않습니다.

이 사이트를 나눔글꼴로 보기 위해서는
나눔글꼴을 설치해야 합니다.

설치 취소