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

random String 로직개선 #6

Open
yongseok-dev opened this issue May 26, 2023 · 0 comments
Open

random String 로직개선 #6

yongseok-dev opened this issue May 26, 2023 · 0 comments
Assignees

Comments

@yongseok-dev
Copy link
Owner

고민이 필요한 부분

  • 사용이 많아질 경우 miss 되는 경우가 자주 발생해 불필요한 비용이 발생

기존 로직

  • l, I, 1 식별 이 어려울 것으로 생각하여 대문자만 사용
  • 6개 문자 랜덤 값으로 출력할 경우 26^6(약 3억)개 대응
  • 문자를 생성하고, DB에서 해당 문자열이 사용 되었는지 체크

개선 방향

  1. 날짜와 같은 고유값 추가
    • 매일 3억건 가까이 view가 찍히면...
  2. 문자열 길이 증가
  3. 문자 추가

추가 의견

  • 고유값 없이 DB에 미리 값을 넣어두면 운영시 miss 발생에 대한 해결 가능

기억하기

  • 이른 최적화, 불필요한 범위에 대한 고민은 낭비일 수 있다.
  • 능력이 있는 개발자라면 설계를 하면서 대규모 사용을 고려할 필요가 있다.
  • 미리 고민한 많은 선배들의 Tip이 참 많다.
@yongseok-dev yongseok-dev self-assigned this May 26, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant