[컴][DB] MySQL stress test

MySQL benchmark tool , BMT / mysql optimization / mysql status query / db monitoring / db 모니터링 / 디비 모니터 / mysql log / maria db log / mariadb log




MySQL 최적화

MySQL stress test

여러가지 tool 들이 있다.
  • mysql-stress-test.pl [ref. 1]
  • mysqlslap [ref. 2]
  • Sysbench [ref. 3]
  • super-smack[ref. 4]
  • mysqltuner[ref. 7]



max_connections 과 thread_cache_size[ref. 4]

현재 connection 상태를 알아보는 방법

mysql> show status like '%conn%';
+----------------------+-------+
| Variable_name        | Value |
+----------------------+-------+
| Aborted_connects     | 0     |
| Connections          | 8611  |
| Max_used_connections | 396   |
| Threads_connected    | 1     |
+----------------------+-------+

mysql> show status like '%thr%';
+------------------------------------------+-------+
| Variable_name                            | Value |
+------------------------------------------+-------+
| Delayed_insert_threads                   | 0     |
| Performance_schema_thread_classes_lost   | 0     |
| Performance_schema_thread_instances_lost | 0     |
| Slow_launch_threads                      | 0     |
| Threads_cached                           | 7     |
| Threads_connected                        | 1     |
| Threads_created                          | 5575  |
| Threads_running                          | 1     |
+------------------------------------------+-------+

새로운 thread가 생성되면 Threads_created 값이 1씩 증가하고, cache에 있는 thread를 사용할 경우는 Threads_created 값은 증가하지 않는다.

즉 Connections 값과 Threads_created 값, 그리고 현재 MySQL 서버가 얼마정도로 바쁜지를 파악하여 이 thread_cache_size 값을 조절해줘야 한다.

그러나 MySQL 서버가 상당히 바쁘고(STATUS == busy 이상) 이 값이 작으면 Connections이 이루어질때마다 새로운 thread가 생성된다

아래와 같은 공식으로 thread_cache_size 를 맞춰주면 된다고 한다.[ref. 6]

  • 100 - ((Threads_created / Connections) * 100)

MySQL 모니터링

먼저 기본적으로 MySQL 에서 제공하는 slow_query_log 와 performance schema 를 이용해 보는 것이 좋을 듯 하다.

slow_query_log

Performance Schema 관련


SHOW GLOBAL STATUS LIKE "Questions";
SHOW GLOBAL STATUS LIKE "Com_select";
Writes = Com_insert + Com_update + Com_delete

Munin

Percona


References

  1. MySQL: mysql-stress-test.pl — Server Stress Test Program 
  2. How do I... Stress test MySQL with mysqlslap? - TechRepublic
  3. Linux ETC - Sysbench를 통한 System, MySQL 성능 테스트 
  4. MySQL의 max_connections과 thread_cache에 대해 - Mimul's Developer World
  5. MariaDB Memory Allocation - MariaDB Knowledge Base
  6. 15 Useful MySQL/MariaDB Performance Tuning and Optimization Tips - Part 2
  7. 15 Useful MySQL/MariaDB Performance Tuning and Optimization Tips - Part 4 

[컴] DeepFake 예제 동영상

딥페이크 / 얼굴 변경 / 동영상 얼굴 편집

DeepFake 예제 동영상


[웹] 코딩 사이트

코딩 연습할 곳 / 재미로 코딩 / 코딩 배울 수 있는 사이트 / coding site / site for coder / 프로그래밍 / programming

코딩 사이트

[컴][책] Reverse Engineering for Beginners

실전연습으로 완성하는 리버싱 책 / 리버싱 책 / 리버스 / reversing / reverse engineering / 리버스 엔지니어링 / 자료 / 책 /


"실전연습으로 완성하는 리버싱"의 원본

[컴] vscode 의 쓸만한 기능들

vscode 의 쓸만한 기능들 / vscode tip




VS code 의 쓸만한 기능들

semantic selection


  • SHIFT + ALT + 화살표
  • vscode 1.31.0 이후에서 사용가능


한 파일에서 특정 라인선택

  • CTRL + SHIFT + L : 한 file 내에서 현재 선택된 text 와 같은 모든 text 를 선택해준다.
  • CTRL + I : 한 라인 선택(select)

파일내의 symbol 을 그룹지어서 보기

Go to Symbol | Code Navigation in Visual Studio Code

  • Ctrl+Shift+O : 이것으로 현재 file 내의 symbol 들을 볼 수 있다.
  • `:` (세미콜론) : 세미콜론을 넣으면 symbol 들을 그룹지어서 보여준다. 


command panel 의 결과를 editor 로 보내주는 기능

Pipe output directly into VS Code : 그림을 볼 수 있다.
  • echo Hello World | code - (Windows)
  • ps aux | grep code | code - (macOS, Linux)

Search 기능을 하단에 두기

  • settings.js 에서 "search.location": "panel"


F8, Go to Next Problem

problems 의 내용을 순차적으로 navigate 해준다.


Logpoints

breakpoint 을 찍으면 printf 를 넣은 것처럼 동작하게 해준다.


Emmet: Wrap with Abbreviation preview

특정 블럭의 parent block 을 추가하는데, emmet 형식으로 넣으면 미리보기가 된다.


See Also

  1. visual studio code 에서 유용한 extension 들


정리중...





[컴][웹] typescript 에서 native type 에 함수를 추가하는 방법

extend function / extend class / mixin



typescript 에서 native type 에 함수를 추가하는 방법


interface 설정


declare 의 사용

declare 는 이 변수가 어딘가에 var 로 정의되어 있다고 compiler 에게 이야기 해주는 역할을 한다. 그래서 output 에 declare 로 설정된 이 변수에 대해 추가로 var 하지 않는다.

static 함수 추가



codes

declare global {
    interface Array<T> {
        find(value: any):any;
    }

    interface ArrayConstructor { // static methods
        from(arrayLike: any): any;
    }

    interface String {
        startsWith(search: any, pos: any): any;
    }
}

if (!Array.prototype.find) {
    Object.defineProperty(Array.prototype, 'find', {
        value: function(predicate:any) {
            ...
            return undefined;
        },
        configurable: true,
        writable: true
    });
}

if (!Array.from) {
    Array.from = (function () {
        ...
  
        // The length property of the from method is 1.
        return function from(arrayLike: any/*, mapFn, thisArg */) {
            ...
            return A;
        };
    }());
}





[컴][웹] 저렴한 서버 호스팅

클라우드 호스팅 / cloud web  / web hosting / 서버 가격 / 대여 / idc / 웹 호스팅

호스팅 가격

단독서버 호스팅

  • iWebIDC : ref. 1 의 글에서는 iWebIDC 가 코리아 IDC 보다 저렴하다고 한다. 하지만 실질적으로 홈페이지를 보면, 코리아 IDC가 더 저렴해 보인다.
  • 코리아IDC

클라우드

See Also


References

  1. 저렴한 서버 호스팅 추천 :: IT & GAME 의 최신형 블로그