Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

EC2 디스크 사용량을 줄인다. #55

Open
3Juhwan opened this issue Feb 8, 2025 · 1 comment
Open

EC2 디스크 사용량을 줄인다. #55

3Juhwan opened this issue Feb 8, 2025 · 1 comment
Labels
기타 업무가 명확하지 않을 때, 선택해 주세요.

Comments

@3Juhwan
Copy link
Member

3Juhwan commented Feb 8, 2025

작업할 내용

EC2 프리티어의 무료 EBS 양은 30GB 입니다. 현재 EBS 사용량은 다음과 같습니다.

  • 크롤러 서버: 15GB
  • 테스트 서버: 10GB

운영 환경과 비슷한 테스트 서버의 디스크 사용량을 보니 현재 약 7GB 사용 중이고 3GB의 여유가 있습니다.
이를 통해 운영 환경도 여유 공간을 포함하여 10GB의 디스크가 필요하다고 판단했습니다.

크롤러 서버 분석

/home/ubuntu 경로에서 분석한 결과입니다. sudo du -h --max-depth=2 | sort -hr 명령어를 사용했습니다.

sudo du -h --max-depth=2 | sort -hr
2.1G	.
1.7G	./actions-runner
868M	./actions-runner/_work
353M	./.gradle
266M	./actions-runner/externals.2.322.0
266M	./actions-runner/externals.2.321.0
204M	./.gradle/caches
146M	./.gradle/wrapper
79M	./actions-runner/bin.2.322.0
79M	./actions-runner/bin.2.321.0
54M	./app
8.7M	./actions-runner/_diag
1.6M	./.gradle/native
1.2M	./.gradle/.tmp
956K	./.gradle/daemon
48K	./.gradle/init.d
32K	./.m2
20K	./.docker
16K	./.docker/buildx
8.0K	./.ssh
8.0K	./.gradle/notifications
4.0K	./.gradle/workers
4.0K	./.gradle/.setup-gradle
4.0K	./.cache
  • 애플리케이션 중에서 actions-runner가 1.7GB를 사용하고 있습니다. 개선이 필요한 지점입니다.
  • 서버가 들어있는 /app은 54MB로 상대적으로 작은 규모를 유지합니다.
  • gradle 환경도 353MB로 생각보다 많이 사용하는 것을 확인할 수 있습니다.

사용자 애플리케이션 외에도 시스템 적으로 분석 후 개선이 필요합니다.

@3Juhwan 3Juhwan added 개선 프로덕트에 개선이 필요해요. 기타 업무가 명확하지 않을 때, 선택해 주세요. and removed 개선 프로덕트에 개선이 필요해요. labels Feb 8, 2025
@3Juhwan
Copy link
Member Author

3Juhwan commented Feb 8, 2025

EC2 처음 생성한 시점

메모리 사용량

free -h
               total        used        free      shared  buff/cache   available
Mem:           957Mi       328Mi       402Mi       888Ki       379Mi       629Mi
Swap:             0B          0B          0B

디스크 사용량

df -h
Filesystem      Size  Used Avail Use% Mounted on
/dev/root       8.7G  1.7G  7.0G  20% /
tmpfs           479M     0  479M   0% /dev/shm
tmpfs           192M  876K  191M   1% /run
tmpfs           5.0M     0  5.0M   0% /run/lock
/dev/xvda16     881M   76M  744M  10% /boot
/dev/xvda15     105M  6.1M   99M   6% /boot/efi
tmpfs            96M   12K   96M   1% /run/user/1000
sudo du -h --max-depth=2 | sort -hr
28K	.
8.0K	./.ssh
4.0K	./.cache

스왑 메모리 2기가

메모리 사용량

free -h
               total        used        free      shared  buff/cache   available
Mem:           957Mi       348Mi       158Mi       888Ki       607Mi       608Mi
Swap:          2.0Gi          0B       2.0Gi

디스크 사용량

df -h
Filesystem      Size  Used Avail Use% Mounted on
/dev/root       8.7G  3.7G  5.0G  43% /
tmpfs           479M     0  479M   0% /dev/shm
tmpfs           192M  876K  191M   1% /run
tmpfs           5.0M     0  5.0M   0% /run/lock
/dev/xvda16     881M   76M  744M  10% /boot
/dev/xvda15     105M  6.1M   99M   6% /boot/efi
tmpfs            96M   12K   96M   1% /run/user/1000

open jre 21 설치

디스크 사용량

df -h
Filesystem      Size  Used Avail Use% Mounted on
/dev/root       8.7G  4.6G  4.1G  54% /
tmpfs           479M     0  479M   0% /dev/shm
tmpfs           192M  892K  191M   1% /run
tmpfs           5.0M     0  5.0M   0% /run/lock
/dev/xvda16     881M   76M  744M  10% /boot
/dev/xvda15     105M  6.1M   99M   6% /boot/efi
tmpfs            96M   12K   96M   1% /run/user/1000

Actions runner 설치

메모리 사용량

free -h
               total        used        free      shared  buff/cache   available
Mem:           957Mi       337Mi        94Mi       892Ki       697Mi       620Mi
Swap:          2.0Gi       256Ki       2.0Gi

디스크 사용량

df -h
Filesystem      Size  Used Avail Use% Mounted on
/dev/root       8.7G  5.1G  3.6G  59% /
tmpfs           479M     0  479M   0% /dev/shm
tmpfs           192M  888K  191M   1% /run
tmpfs           5.0M     0  5.0M   0% /run/lock
/dev/xvda16     881M   76M  744M  10% /boot
/dev/xvda15     105M  6.1M   99M   6% /boot/efi
tmpfs            96M   12K   96M   1% /run/user/1000
sudo du -h --max-depth=1 | sort -hr
458M	./actions-runner
458M	.
8.0K	./.ssh
4.0K	./.cache

Github runner svc로 백그라운드 실행

메모리 사용량

free -h
               total        used        free      shared  buff/cache   available
Mem:           957Mi       413Mi        81Mi        13Mi       642Mi       543Mi
Swap:          2.0Gi       256Ki       2.0Gi

디스크 사용량

df -h
Filesystem      Size  Used Avail Use% Mounted on
/dev/root       8.7G  5.1G  3.6G  59% /
tmpfs           479M     0  479M   0% /dev/shm
tmpfs           192M  916K  191M   1% /run
tmpfs           5.0M     0  5.0M   0% /run/lock
/dev/xvda16     881M   76M  744M  10% /boot
/dev/xvda15     105M  6.1M   99M   6% /boot/efi
tmpfs            96M   12K   96M   1% /run/user/1000
sudo du -h --max-depth=1 | sort -hr
458M	./actions-runner
458M	.
8.0K	./.ssh
4.0K	./.cache

self hosted runner로 CI 실행

메모리 사용량

free -h
               total        used        free      shared  buff/cache   available
Mem:           957Mi       819Mi        72Mi        33Mi       257Mi       137Mi
Swap:          2.0Gi       142Mi       1.9Gi

디스크 사용량

df -h
Filesystem      Size  Used Avail Use% Mounted on
/dev/root       8.7G  6.5G  2.3G  75% /
tmpfs           479M     0  479M   0% /dev/shm
tmpfs           192M  908K  191M   1% /run
tmpfs           5.0M     0  5.0M   0% /run/lock
/dev/xvda16     881M   76M  744M  10% /boot
/dev/xvda15     105M  6.1M   99M   6% /boot/efi
tmpfs            96M   12K   96M   1% /run/user/1000
sudo du -h --max-depth=1 | sort -hr
1.8G	.
1.5G	./actions-runner
315M	./.gradle
12K	./.m2
8.0K	./.ssh
4.0K	./.cache

서버 실행 중, 사용자가 없을 때

메모리 사용량

free -h
               total        used        free      shared  buff/cache   available
Mem:           957Mi       532Mi       229Mi        15Mi       367Mi       424Mi
Swap:          2.0Gi       109Mi       1.9Gi

디스크 사용량

df -h
Filesystem      Size  Used Avail Use% Mounted on
/dev/root       8.7G  5.9G  2.8G  69% /
tmpfs           479M     0  479M   0% /dev/shm
tmpfs           192M  908K  191M   1% /run
tmpfs           5.0M     0  5.0M   0% /run/lock
/dev/xvda16     881M   76M  744M  10% /boot
/dev/xvda15     105M  6.1M   99M   6% /boot/efi
tmpfs            96M   12K   96M   1% /run/user/1000
sudo du -h --max-depth=1 | sort -hr
1.3G	.
945M	./actions-runner
315M	./.gradle
72M	./app
12K	./.m2
8.0K	./.ssh
4.0K	./.cache

NginX, certbot, docker 설치

아래는 크롤러

메모리 사용량

free -h
               total        used        free      shared  buff/cache   available
Mem:           957Mi       570Mi       196Mi        15Mi       361Mi       386Mi
Swap:          2.0Gi       654Mi       1.4Gi

디스크 사용량

df -h
Filesystem      Size  Used Avail Use% Mounted on
/dev/root        14G   11G  2.8G  80% /
tmpfs           479M     0  479M   0% /dev/shm
tmpfs           192M  928K  191M   1% /run
tmpfs           5.0M     0  5.0M   0% /run/lock
/dev/xvda16     881M  133M  687M  17% /boot
/dev/xvda15     105M  6.1M   99M   6% /boot/efi
tmpfs            96M   12K   96M   1% /run/user/1000
sudo du -h --max-depth=1 | sort -hr
2.1G	.
1.7G	./actions-runner
353M	./.gradle
54M	./app
32K	./.m2
20K	./.docker
8.0K	./.ssh
4.0K	./monitor
4.0K	./.cache

프로메테우스 docker 컨테이너

free -h
               total        used        free      shared  buff/cache   available
Mem:           957Mi       486Mi       147Mi       5.6Mi       496Mi       471Mi
Swap:          2.0Gi       711Mi       1.3Gi
df -h
Filesystem      Size  Used Avail Use% Mounted on
/dev/root        14G   11G  2.6G  82% /
tmpfs           479M     0  479M   0% /dev/shm
tmpfs           192M  928K  191M   1% /run
tmpfs           5.0M     0  5.0M   0% /run/lock
/dev/xvda16     881M  133M  687M  17% /boot
/dev/xvda15     105M  6.1M   99M   6% /boot/efi
tmpfs            96M   12K   96M   1% /run/user/1000

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
기타 업무가 명확하지 않을 때, 선택해 주세요.
Projects
None yet
Development

No branches or pull requests

1 participant