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

Mysql 에러메시지

조회 수 17519 추천 수 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
번호 분류 제목 날짜 조회 수
116 컴퓨터잡담 파이썬 아나콘다 설치시 오류발생 대처방법 2021.06.16 11014
115 컴퓨터잡담 파이썬 문자열b 안에 변수 a를 대치시키려면 크게 세 가지 방법 2021.06.18 2425
114 컴퓨터잡담 파이썬 리스트에 데이터 삽입하기 2021.06.22 1651
113 컴퓨터잡담 파이썬 멀티라벨 소스 줄이기 2021.06.23 1593
112 컴퓨터잡담 파이썬 for문으로 자동변수 생성하기 2021.06.24 3722
111 컴퓨터잡담 파이썬 gspread 사용법 file 2021.06.25 10639
110 컴퓨터잡담 2021년 플래시 플레이어 웹사이트 크롬에서 접속하는 방법 2021.07.05 2547
109 컴퓨터잡담 KM Wakeup 절전모드 예약 및 깨우는 프로그램 file 2021.07.08 1714
108 Excel 엑셀에서 "따옴표" 입력하기 2021.07.09 3189
107 컴퓨터잡담 파이썬 에러 해결방법 모음 2021.07.19 1493
106 컴퓨터잡담 파이썬 엑셀 다루기 - openpyxl 사용법 2021.07.19 4552
105 컴퓨터잡담 파이썬 Beautifulsoup 웹크롤링 차단시 해결방법 2021.07.23 1353
104 HTMLPHPMSQL html testing 2021.07.24 3698
103 컴퓨터잡담 파이썬 최대값 두번째 큰값 세번째 큰값 구하기 2021.07.27 4502
102 컴퓨터잡담 파이썬 변수값에서 숫자만 추출하기 2021.07.28 1116
101 컴퓨터잡담 윈도우 10 절전모드(슬립모드) 예약해제 방법 secret 2021.07.28 425
100 컴퓨터잡담 파이썬 find, select 사용법 2021.07.30 1305
99 컴퓨터잡담 파이썬 FTP 업로드/다운로드 하기 2021.07.31 3146
98 HTMLPHPMSQL CCS 메뉴 스타일 링크 2021.08.04 3867
97 컴퓨터잡담 카카오 인증관련 오류 file 2021.08.08 6924
Board Pagination Prev 1 ... 39 40 41 42 43 ... 46 Next
/ 46

http://urin79.com

우린친구블로그

sketchbook5, 스케치북5

sketchbook5, 스케치북5

나눔글꼴 설치 안내


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

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

설치 취소