TIL
-
2024.11.05 uuidTIL 2024. 11. 6. 00:45
Should You Use UUIDs for Database Keys?UUIDs offer uniqueness in databases but come with performance costs. Learn when to use them, their drawbacks, and alternatives loved by…medium.comuuid가 많은 저장공간, index로 사용, 사입할 때 정렬로 인한 성능저하.uuidv7이란 게 있구나. 이걸 사용하면 time base로 정렬이 가능하다. 또 ulid도 있는데 이건 사전식 정렬이 가능하고.근데 128비트니까 칼럼 조회하고 쿼리의 성능이 다른 것보다는 안 좋을 수 있다. 정렬할 때 많은 메모리를 잡아먹기도 하고. 근데 분산 시스템이 아니면 auth increm..
-
2024.11.04 rate limiting systemTIL 2024. 11. 5. 00:10
https://levelup.gitconnected.com/system-design-rate-limiting-system-with-bloom-filters-f540f19152ef System Design: Rate Limiting System ⏳🚦 with Bloom FiltersDesigning an Efficient Rate Limiting System with Bloom Filters, Count-Min Sketches, and Sliding Windows for Scalable Traffic Controllevelup.gitconnected.com bloom filter로 rate limit를 구현했다.일단 ip기반으로만 rate limit를 할 거면 LB로도 충분하지 않을까 싶다.유저의 정보나..
-
2024.11.01 Query tuningTIL 2024. 11. 2. 00:18
[Backend Interview Qn] Which Data Structure Does SQL Tables Use To Store Data?If you’re interviewing for a backend position dealing with lots of data, your interview might ask you this question.levelup.gitconnected.com 글에서는 tree 구조인지 모르고 해쉬 맵이나 리스트이줄 알았다고 한다.mysql의 스캔을 보면 결구 노드에서 포함되는 범위를 체크하고 자식 노드로 가는 찾아가는 것이다.uk는 스캔 중에 첫 번째 값이 나오면 찾는 거 종료고, 나머지 인덱스는 다음 값이 조건에 맞지 않으면 종료고.인덱스 풀스캔과 테이블 풀스캔은 비슷하면..
-
2024.10.29 JWTTIL 2024. 10. 30. 23:27
Why do many people not recommend using JWT?My article is open to everyone; non-member readers can click this link to read the full text.blog.stackademic.com JWT에 대해서 비판적인 글입니다.단순 문자에 비해 JWT는 너무 길어서 네트워크 대역폭을 낭비하고, JWT의 sign은 프레임워크에서 지원하는 Cokkie Signature로 대체될 수 있다고 말합니다.또 서버에서 제어하지 않아서 발생하는 문제에 대해서도 비판합니다. 글의 내용 보다도 댓글에서 더 많은 정보를 얻을 수 있습니다.댓글에서 열띤 토론이 벌어졌었고, 읽어보았습니다. 중간자공격 man in middle attack..
-
2024.10.28 AOP InheritanceTIL 2024. 10. 29. 10:29
추상클래스와 @transactional 질문입니다. - 인프런 | 커뮤니티 질문&답변누구나 함께하는 인프런 커뮤니티. 모르면 묻고, 해답을 찾아보세요.www.inflearn.com 관련해서 개발하다가 궁금한 점이 생겼습니다. 자식 클래스에 @Transactional 이 있고, 부모의 메서드를 오버라이딩하지 않았으면 그 메서드는 @Transactional AOP 범위에 포함되지 않습니다.Spring considers transactional. Note that a class-level annotation does not apply to ancestor classes up the class hierarchy; Using @Transactional :: Spring FrameworkThe @Transacti..
-
2024.10.23 ElasticSearch, Apache LuceneTIL 2024. 10. 23. 22:52
음 데이터가 많은 RDB의 경우 검색이 느려질 수 있다.익덱스 설계를 한다고 해도, 1억 ~ 억 단위로 넘어가면 느려진다.수평 파티셔닝, 샤딩으로 해결할 수 있지만 이건 비용이 많이 드는 일이다. 검색이 문제라면 ElasticSearch, Apache Lucene의 도움을 받아서 빠르게 처리할 수 있을 거 같다.ElasticSearch, Apache Lucene을 사용해 보지 않아서 동작법을 몰랐다. ElasticSearch, Apache Lucene들이 인덱스, 검색만 빨리되고 결국 데이터는 RDB에서 가져오는 구조인줄 알았는데, 그게 아니라 데이터를 가지고 있는 형태더라. +계속해서.. ssl그냥 궁금해서.. https://security.stackexchange.com/questions/20105..
-
2024.10.22 system designTIL 2024. 10. 22. 22:29
목표로 하는 dau, 동시접소자 수, 초당 메시지 수, 메시지 평균/최소/최대크기, 메시지 휘발여부기타 등등. 설계를 하기 전에 먼저 요구사항을 확인했어야 했다.무작정 해답을 내놓기보다는 질문을 더 했어야했다. MVP로 뭔가를 만들려고 할 때는 익숙한 기술을 사용해도 된다. 다만 목표, 요구사항이 명확하다면 새로운 기술을 써서 문제를 해결하는 것도 선택지에 있어야 한다.서비스가 커질 것을 염두에 두고 있는가? 티키타카 + Why using the premaster secret directly would be vulnerable to replay attack?Reading from this question Why does the SSL/TLS handshake have a client and serv..
-
2024.10.21 ssl replay attackTIL 2024. 10. 21. 23:54
https://security.stackexchange.com/questions/218491/why-using-the-premaster-secret-directly-would-be-vulnerable-to-replay-attack Why using the premaster secret directly would be vulnerable to replay attack?Reading from this question Why does the SSL/TLS handshake have a client and server random?, the OP asks why he can't use the premaster secret directly and the accepted answer says: ... preven..