- 제 목
- 일반 그링이 병신
- 글쓴이
- 서라벌
- 추천
- 0
- 댓글
- 0
- 원본 글 주소
- https://gall.dcinside.com/vr/576851
- 2020-10-25 07:32:32
자바 런타임 환경 튜닝을 통한 최적화
- jar로 된 서버를 실행시 자바에 부여하는 다양한 옵션을 통해 서버최적화를 할 수 있다 -환경튜닝에 따라 체감가능한 성능향상이 있다 -대부분 가비지컬렉터 셋팅, SEE등 부가적 명령어 사용, 쓰레드 셋팅을 통해 서버를 최적화 한다 -http://www.minecraftforum.net/viewtopic.php?f=1012&t=68128 -http://java.sun.com/performance/reference/whitepapers/tuning.html -http://java.sun.com/performance/reference/whitepapers/6_performance.html -http://www.md.pp.ru/~eu/jdk6options.html
자바 vm의 메모리 활용 크기 늘리기
-1G이상 활용시 꼭 64bit jre가 필요함! -Xms -initial java heap size -Xmx -maximum java heap size -Xmn -the size of the heap for the young generation
자바의 가비지 컬렉터
가비지 컬렉터는 메모리를 관리하는 자바/jre/vm의 기술이다
first two choices are most common for large server applications:
-XX:+UseParallelGC parallel (throughput) garbage collector, or -XX:+UseConcMarkSweepGC concurrent (low pause time) garbage collector (also known as CMS) -XX:+UseSerialGC serial garbage collector (for smaller applications and systems)자바의 가비지 컬렉터를 Concurrent Mark-Sweep(CMS) Collector로 사용하기
-CMS는 일반적인 가비지 컬렉터보다 빠른 응답시간을 위해 만들어 졌다 -XX:+UseConcMarkSweepGC
자바의 가비지 컬렉터를 Parallel Collector(Throughput Collector)로 사용하기
-가비지 컬렉터는 메모리를 관리하는 자바/jre/vm의 기술이다 -Parallel Collector는 여러 CPU/core활용하는 기술이다 -XX:+UseParNewGC
자바의 새로운 가비지 컬렉터 Garbage-First Garbage Collector (G1GC)사용
-가급적 최신 1.7jre를 사용하여 이옵션을 이용하는게 좋다 -최근 개발되고 있는 새로운 가비지 컬랙터로 -최소 듀얼코어이상, 메모리를 2G이상 활용시의 대용량/고성능이 요구될 때 좋다고 한다 -XX:+UseG1GC
자바의 가비지 컬렉터가 몇개의 쓰레드를 사용할 지 정하는 옵션
-자신이 원하는 코어활용 숫자를 넣으면 된다. 보통 코어의 수(하이퍼스레딩포함)로 세팅. -마인크레프트서버가 멀티코어 프로그래밍이 되있는것은 아니지만, 가비지 컬렉팅이라도 여러 코어를 활용하여 응답속도 면에서 이득을 얻을 수 있다 -XX:ParallelGCThreads=원하는코어숫자
-기타 가비지 컬렉터 튜닝 옵션 -XX:SurvivorRatio=16 -(default 32) is the space for young elements. 32 is too big for minecraft. ( will take memory, without filling it ) be carefull to small will crash -XX:NewRatio=6
Xnoclassgc
-Xnoclassgc -makes it so that the GC will not unload classes ( unless it has no choice ) keeps the server speedy :)
-XX:+CMSIncrementalPacing
-XX:-overgcoverheadlimit -the GC can do multiple GC on different heaps at the same time.
SEE연산 활용하기
-고급 CPU에서 제공하는 부가적인 명령어 셋을 활용함으로써 CPU점유율에서 이득을 얻을 수 있다 -XX:UseSSE=명령어셋버전
자바vm의 우선순위 높이기
-XX:+AggressiveOpts
설정예
참고설정 1. G1GC의 최신 GC활용하여 서버구동
-jre1.7x64가 필요하고 성능을 얻는대신 불안전성을 얻을 수도 있다 -XX:+UnlockExperimentalVMOptions -XX\:+UseG1GC -XX:MaxGCPauseMillis=50 -XX:GCPauseIntervalMillis=800 -XX:UseSSE=4 -Xmx16G -Xms16G -G1GC관련 기타 참고 -http://www.javaperformancetuning.com/news/newtips106.shtml
참고설정 2. CMS의 GC활용하여 서버 구동
-상당히 검증된 CMS를 활용하여 성능을 얻기 -Xmx1024M -Xms512M -XX:UseSSE=3 -XX:+UseConcMarkSweepGC -XX:+CMSIncrementalPacing -XX:ParallelGCThreads=2 -XX:+AggressiveOpts
-위의 참고설정 1,2를 적절히 활용하고 아래 링크의 각종 예를 활용하면 -적절한 튜닝 방식을 활용할 수 있을것이다
http://www.minecraftforum.net/viewtopic.php?f=1012&t=68128&start=90
Quote:, Xmx for Max RAM allowed, MaxGCPauseMillis to set pause (5ms is good), ParallelGCThreads is number of threads (i've 2, so it's set to 2) and UseSSE to specify preferred version of SSE to use (My CPU can do 4.2 MAX i think, i've set to 4).
For those who care, this is my exact, copy/paste
@echo off "%ProgramFiles%\Java\jre7\bin\java.exe" -server -XX:+UseConcMarkSweepGC -XX:+UseParNewGC -XX:SurvivorRatio=16 -Xnoclassgc -XX:ParallelGCThreads=2 -Xmn512M -Xmx8192M -Xms1536M -jar Minecraft_Mod.jar nogui pause
It supports upwards of 60-70 players. has dual hex cores (12).
If there's anything that could be tweaked for better performance, please let me know ;)
마크 서버 운영 하면서 이런 최적화 관련 지식 1도 모르면 병신이다....
| 댓글이 없습니다. |
|---|