네트워크란 ?
- 노드(node)와 링크(link)가 서로 연결되어 있거나 연결되어 있으며 리소스를 공유하는 집합을 의미.
- 여기서 말하는 노드는 서버, 라우터, 스위치 등 네트워크 장치를 의미함. (링크는 유선, 무선)
처리량과 지연 시간
- 대역폭 (Bandwidth) : 주어진 시간 동안 네트워크 연결을 통해 흐를 수 있는 최대 비트 수
더보기
이전에 hbase 클러스터 replication을 진행한 적 이 있는데,
replication과정에서는 table의 snapshot을 peer 클러스터로 보내는 과정에서 대역폭을 고려해야 한다.
Datasize와 Bandwidth로 작업 예정시간을 계산해서 네트워크 운영자에게 대략적인 작업시간을 제시해야 하기 때문이다.
ex) 24TB*1024*1024/(80MB/s*17대*3600s)=5.14시간
80MB/s : Bandwidth
- 처리량 (Throughput) : 링크 내에서 성공적으로 전달된 데이터의 양 -> 보통 얼만큼의 트래픽을 처리했는지를 나타냄.
- 단위는 bps(bits per second)를 사용. 초당 전송 또는 수신되는 비트 수를 의미.
지연 시간 (Latency)
- 요청이 처리되는 시간을 말하며 메시지가 두 장치 사이를 왕복하는데 걸린 시간을 말함.
- 무선,유선, 패킷 크기, 라우터의 패킷 처리 시간에 영향을 받는다.
스푸핑
- LAN상에서 송신부의 패킷을 송신과 관련 없는 다른 호스트에 가지 않도록 하는 스위칭 기능을 마비시키거나 속여서 특정 노드에 해당 패킷이 오도록 처리하는 것을 말한다. => 간단히 말하자면, 원래 가야할 패킷을 임의적 노드를 거치도록 (책에서는 악의적인 노드로 표현)
네트워크 토폴로지
- 스타 토폴로지
- 링형 토폴로지
- 메시 토폴로지 (망형 토폴로지)
병목현상 (bottleneck)
- 전체 시스템의 성능이나 용량이 하나의 구성 요소로 인해 제한을 받는 현상을 말한다.
- 주된 원인
- 네트워크 대역폭
- 네트워크 토폴로지
- 서버 CPU, 메모리 사용량
- 비효율적인 네트워크 구성
- 원인을 발견하는데 주로 사용하는 명령어
- ping
- netstat
- nslookup (도메인에 매핑된 IP를 확인하기 위해 사용)
- 주된 원인
더보기DB에 쿼리를 요청하는 client의 IP를 아는 것은 중요하다.
만약, 쿼리 timeout과 같은 현상이 발생 했을 때, 누가 언제 어떠한 쿼리를 날렸는지 알 수 있는 유일한 방법이라 할 수 있다.
도메인을 A 타입 (IPv4주소를 연결하는 방식)으로 생성하게 된다면
101.xxx.xxx.xxx와 같은 레코드 값을 도메인 네임에 매핑시킬 수 있다.
nslookup은 도메인에 연결된 레코드 값을 찾는 방식이라 생각하면 된다.
나는 이걸 언제 사용했냐면 ?
druid 클러스터를 이중화 하면서 지금 쿼리를 날리고 있는 broker의 IP가 궁금해졌다.
도메인 네임은 보통 사람이 읽기 쉬운 것으로 사용하다보니, 여러 ip를 묶어서 사용할 때도 있으므로 실제로 연결된 ip를 찾는 것이 중요했다.
ex) druid-admin.com (CNAME)
druid-3030.com | druid-4040.com
자 실제로 연결 된 IP는 무엇이지 ?
Java code
//Connection metadata에서 현재 연결된 avatica url을 parsing 후 host를찾고 -> 해당 호스트를 nslookup
String connectionUrl = connection.getMetaData().getURL();
URI uri = URI.create(connectionUrl.substring("jdbc:avatica:remote:url=".length()));
InetAddress address = InetAddress.getByName(uri.getHost());
LOG.info(String.valueOf(address));
//결과
2023-11-07 16:30:50,767 INFO [main] canary.DruidCanaryRunner - druid-4040-mn1.dakao.io/10.41.40.152
=> 이 방식으로 하면, CNAME과 연결된 레코드 값을 찾을 수 있기 때문에 스위칭 시 전환된 브로커로 쿼리를 실행하는지 직접적으로 알 수 있음.
- tracert
- 목적지 노드까지 네트워크 경로를 확인할 때 사용하는 명령어 이다.
TCP/IP 4계층 모델
TCP (Transmission Control Protocol)
IP (Internet Protocol)
- 4계층 모델은 네트워크에서 사용되는 통신 프로토콜의 집합으로 계층들은 프로토콜의 네트워킹 범위에 따라 네 개의 추상화 계층으로 구성된다.
이 부분 은 길게 얘기 될 것 같아서 . 다음 글로 넘어감.