numactl 커맨드

unix and linux 2017. 10. 19. 22:06


numa 아키텍처(Non-Uniform Memory Access, NUMA)는 멀티프로세서 시스템에서 사용되고 있는 컴퓨터 메모리 설계 방법중의 하나로, 메모리에 접근하는 시간이 메모리와 프로세서간의 상대적인 위치에 따라 달라진다. NUMA구조에서 프로세서는 자기의 로컬 메모리에 접근할 때가 원격 메모리에 접근할 때보다 더 빠르다. 원격 메모리는 다른 프로세서에 연결되어 있는 메모리를 말하고 로컬 메모리는 자기 프로세서에 연결되어 있는 메모리를 말한다.


https://ko.wikipedia.org/wiki/%EB%B6%88%EA%B7%A0%EC%9D%BC_%EA%B8%B0%EC%96%B5_%EC%9E%A5%EC%B9%98_%EC%A0%91%EA%B7%BC



numa를 잘 활용해야 훨씬 빠르게 메모리를 관리할 수 있다. 




https://github.com/numactl/numactl


numa 아키텍처에서 지원하는 간단한 AP로서 numa 아키텍처에서 동작하는 java daemon을 실행할 때 자주 사용될 수 있다. elasticsearch나 cassandra에 사용한다면 성능 효과를 얻을 수 있다. 




https://www.slideshare.net/slidunder/numa-and-java-databases





numactl은 공유 메모리 또는 파일에 대한 정책을 지정할 수 있다. 





예를 들어 간단한 numactl 커맨드가 있다.


$ numactl --interleave=all /home/www/elasticsearch-5.3/bin/elasticsearch -d


interleave 모드를 사용하면 라운드 로빈으로 메모리를 노드에 할당하게 한다. numa 아키텍처를 활용해 빠르게 접근하게 한다!





https://linux.die.net/man/8/numactl



--interleave=nodes, -i nodes
Set a memory interleave policy. Memory will be allocated using round robin on nodes. When memory cannot be allocated on the current interleave target fall back to other nodes. Multiple nodes may be specified on --interleave, --membind and --cpunodebind. You may specify "all", which means all nodes in the current cpuset. nodes may be specified as N,N,N or N-N or N,N-N or N-N,N-N and so forth. Relative nodes may be specifed as +N,N,N or +N-N or +N,N-N and so forth. The + indicates that the node numbers are relative to the process' set of allowed nodes in its current cpuset. A !N-N notation indicates the inverse of N-N, in other words all nodes except N-N. If used with + notation, specify !+N-N.



자바와 NUMA 아키텍처와 관련된 설명은 다음을 참조한다.

https://www.slideshare.net/slidunder/numa-and-java-databases


이 슬라이드는 numctl과 cassandra 간의 조심스러움을 표현하고 있다. 


NUMA and Java Databases from Raghavendra Prabhu






Posted by '김용환'
,