O0oO0Oo / Coin

비트코인 프로젝트 리팩토링
1 stars 0 forks source link

docs: list of tasks to be refactor #9

Open O0oO0Oo opened 9 months ago

O0oO0Oo commented 9 months ago

이슈 개요

리팩토링 작업 메모

작업 목록

O0oO0Oo commented 8 months ago

빈 데이터, 큐에 들어가지 않게

CPU 사용량, 메모리 피크가 현저히 줄어들었다. CPU : 20\~30% -> 0\~10% 메모리 : 300MB이상 -> 100MB이하 개선 전 image image 개선 후 image image

O0oO0Oo commented 8 months ago

소비속도 느림

무선 연결

--- 192.168.35.247 ping statistics ---
175 packets transmitted, 175 received, 0% packet loss, time 174121ms
rtt min/avg/max/mdev = 12.730/188.073/427.028/95.848 ms

대부분의 시간 소모가 네트워크에서 발생한다.

Redis 를 다음과 같이 개발 환경에 구성했을떄 BTC를 소비 후 다시 BTC로 되돌아 오는데 0.5초로 단축된다. 전 : Redis <-무선-> 공유기 <-무선-> 개발환경 후 : Redis <-유선-> 공유기 <-무선-> 개발환경

유선 연결

--- 192.168.35.179 ping statistics ---
75 packets transmitted, 75 received, 0% packet loss, time 74159ms
rtt min/avg/max/mdev = 0.703/1.720/2.265/0.333 ms
O0oO0Oo commented 8 months ago

구매/판매 주문 시 필요하지 않은 데이터 제거

  1. 코인 구매 주문이 처리되어, 유저의 지갑에 넣기위해서는 다음과 같은 항목이 필요하다.

기존 key : order:{type}:{coinName}:{price} member : {orderId}:{walletId}:{userId}:{quantity}

wallet 테이블의 보유 수량에 반영하기 위해 2가지 항목 -> walletId, quantity 여기에서 userId 는 필요하지 않음.

개선 key : order:{type}:{coinName}:{price} member : {orderId}:{walletId}:{quantity}

  1. 코인 판매 주문이 처리되어, 유저의 잔고를 증가시키기 위해서는 다음과 같은 항목이 필요하다.

기존 key : order:{type}:{coinName}:{price} member : {orderId}:{walletId}:{userId}:{quantity}

user 테이블 잔고에 반영하기 위해 2가지 항목 -> userId, price * quantity 여기에서 walletId 는 필요하지 않음.

개선 key : order:{type}:{coinName}:{price} member : {orderId}:{userId}:{quantity}