TIL
-
2024.09.13 hikaricp autoreconnectTIL 2024. 9. 14. 21:19
HikariCP/src/main/java/com/zaxxer/hikari/pool/HikariPool.java at 0a6ccdb334b2ecde25ae090034669d534736a0de · brettwooldridge/Hik光 HikariCP・A solid, high-performance, JDBC connection pool at last. - brettwooldridge/HikariCPgithub.com hikari cp는 커넥션을 얻을 때, 커넥션이 유효하지 않으면 다시 do while로 커넥션을 얻으려고 한다.매 쿼리마다 커넥션을꺼내서 사용할 텐데(저장 위치는 mybatis의 경우는 springManagedTransaction안에 있는데 이건 sqlSession안에 들어있다. 쿼리를 실행할 때..
-
2024.09.12 Check If a UsernameTIL 2024. 9. 12. 00:19
How to Efficiently Check If a Username Exists Among Billions of UsersHow to Efficiently Check If a Username Exists Among Billions of Usersmedium.com 데이터가 수백만 수십억을 넘어가면 RDB의 쿼리만으로는 원하는 성능을 얻을 수 없다. 확장에도 비용적인 한계가 존재하고..레디스를 쓰자니 메모리 비용을 생각할 때 효과적이지는 않다. 여기서는 Bloom filter를 추천.가끔 값이 없어도 있음을 나타낼 수 있음.필터는 비트배열로 이루어져 있고.이름을 작은 집합으로 만들고 이를 필터와 비교해 모든 값이 1이 나오면 유저가 존재한다고 칠 수 있겠습니다. 음 Bloom filter 자료 구조는 ..
-
2024.09.09 Architecture DisadvantagesTIL 2024. 9. 9. 23:38
Lessons Learned From The Trenches Developing Event-Driven SystemsPeople hear phrases like “modern microservices architectures” and jump bandwagons without knowing what they’re getting intoblog.stackademic.com Microservices Architecture, The Hard Parts : Trap of Distributed MonolithWhen conversing with seasoned Senior Software Engineers who leverage Microservices Architecture for their product d..
-
2024.09.03 Double ChargesTIL 2024. 9. 3. 23:03
How To Prevent Double Charges In eCommerce PaymentsSeveral topics like this are discussed on my YouTube channel. Please visit. I appreciate your support.medium.com커머스 서비스에서 네트워크 이슈등으로 여러번 결제요청이 들어올때 중복결제가 이뤄질 수 있다는 것 입니다.글에서 제시한 해결법으로는 멱등성을 활용하는 것 입니다.클라이언트에서 uuid를 서버에 제공하면 서버는 uuid를 기반으로 멱등성을 유지합니다.글을 읽다 우려되는 것은 새로고침등으로 uuid가 바뀌면 의미없다는 생각입니다..음 새로고침은 새결제로 판단하는 것이 맞을까요
-
2024.09.02 data replicatedTIL 2024. 9. 3. 00:14
https://medium.com/@_sidharth_m_/how-is-data-replicated-in-distributed-systems-0fe7dd8af904 How is Data Replicated in Distributed Systems?Understanding Single Leader, Multi-Leader, and Leaderless Replicationmedium.com 데이터베이스 복제 관련 글을 읽었습니다. 단일 리더, 멀티 리더, 리더 없음의 방식을 소개합니다. 단일리더는 노드 하나만 업데이트문을 수신하는 것 입니다. 리더 다운 시 리더의 복구를 기다리거나 새 리더를 선출합니다. 그 간격동안은 장애시간이 됩니다. 복제 방법도 동기복제와 비동기 복제가 있습니다. 멀티 리더는 모드 노드..
-
2024.08.28 system design interviewsTIL 2024. 8. 28. 23:50
I conducted system design interviews at Meta. Here’s how to prep.When coordinating your interview at Meta (formerly Facebook), you’ll be asked whether you want to do a System Design Interview (“Pirate”)…grokkingtechinterview.com시스템 디자인 면접에서는 커뮤니케이션이 중요합니다. 커뮤니케이션을 통해 명확한 요구사항을 파악해야 하고 특정 컴포넌트에 대해서 깊이 있는 지식을 가지고 있다고 어필해야 합니다.디자인 후 질문 시간을 충분히 남겨둬야 깊은 커뮤니케이션을 할 수 있다고 한다. 질문과 예제를 보면 요구사항을 정리하고 기능적 ..
-
2024.08.23 Deadlock on rollback, but not on commit, when using ON DUPLICATE KEYTIL 2024. 8. 23. 22:37
MySQL :: MySQL 8.4 Reference Manual :: 17.7.3 Locks Set by Different SQL Statements in InnoDB17.7.3 Locks Set by Different SQL Statements in InnoDB A locking read, an UPDATE, or a DELETE generally set record locks on every index record that is scanned in the processing of an SQL statement. It does not matter whether there are WHERE conditions indev.mysql.com오늘은 insert on duplicate key update를 봤습..
-
2024.08.20 foreign keyTIL 2024. 8. 20. 23:35
foreign key 에 의한 부모, 자식 테이블의 잠금관계http://blog.naver.com/parkjy76/220588832494 에서도 잠깐 언급을 했는데 foreign key 제약을 사용할 경우...blog.naver.com오늘도 외래키에 대해서 봤습니다..외래키로 인해서 dead lock이 나는 경우가 있습니다.쿼리에 사용된 외래키에 s lock을 걸기 때문입니다.서로다른 트랜잭션이 서로 부모,자식 테이블에 잠금을 획득하려할 때 발생할 수 있습니다.잠금 해결법에는 트랜잭션 시작시 사용될 잠금을 모두 획득한 후 쿼리를 진행하는 방법이 있을 거 같습니다.