2022-03-22-TIL

Today I Learned

Microservice에서 서비스간 통신

  • https://wonit.tistory.com/506?category=854728
  • https://taes-k.github.io/2019/06/16/spring-msa-3/
  • https://jangcenter.tistory.com/35
  • https://www.baeldung.com/spring-webclient-resttemplate
  • https://velog.io/@dhk22/Spring-Cloud-MSA%EA%B0%84-%ED%86%B5%EC%8B%A0-RestTemplate-Feign-Client
  • https://javaetmoi.com/2018/10/architecture-microservices-avec-spring-cloud/

Netflix Eureka

  • https://velog.io/@jkijki12/Eureka%EB%9E%80
  • https://azure.github.io/AppService/2020/08/18/Netflix-Eureka-On-App-Service.html#:~:text=Netflix%20Eureka%20is%20a%20REST,running%20correctly%20in%20App%20Service.

Pub-Sub Architecture Pattern

메시지의 발신자(Publisher)와 수신자(Subscriber)가 사이에 메시지 브로커를 두어서 비동기 메시징을 수행하는 구조이다. 발신자는 특정 채널로 메시지를 전달하고, 해당 채널을 구독중인 수신자만 메시지를 수신한다. 이때 수신자는 발신자에 대한 정보 없이도 원하는 메시지를 수신할 수 있다.

✓ 장점: 낮은 결합도로 인해 안정적이고 확장에 용이하다. ✓ 단점: 브로커를 통해서 메시지를 전달하므로 성능이 상대적으로 조금 떨어질 수 있다.

  • https://2kindsofcs.tistory.com/6
  • https://honglab.tistory.com/61
  • https://medium.com/@tunacan252/pub-sub-model-290206099146
  • https://www.ibm.com/docs/ko/oala/1.3.5?topic=SSPFMY_1.3.5/com.ibm.scala.doc/config/iwa_cnf_scldc_cnf_kfk_t.html
  • https://cloud.google.com/pubsub/docs/overview?hl=ko-KR
  • https://needjarvis.tistory.com/599
  • https://www.redhat.com/architect/pub-sub-pros-and-cons
  • https://towardsai.net/p/systems/observer-pattern-vs-pub-sub-pattern
  • https://ably.com/topic/pub-sub

Testing using in-memory DB

테스트는 인메모리 DB보다는 실제 DB로 하는게 낫다는 의견이 많다. 그 이유는 실제 DB의 동작환경에 대한 동일성을 보장할 수가 없다는 것이다. -> 대안은 DB를 위한 도커 컨테이너를 활용하는 것이다. 테스트 할때만 도커 DB를 띄워서 테스트를 수행하는 방식으로 실제 DB와 동일성을 보장할 수 있다.

  • https://umbum.dev/1127
  • https://minkukjo.github.io/framework/2020/07/13/Spring-134/
  • https://jimmybogard.com/avoid-in-memory-databases-for-tests/
  • https://github.com/dotnet/efcore/issues/18457
  • https://phauer.com/2017/dont-use-in-memory-databases-tests-h2/
  • https://github.com/phauer/blog-related/tree/master/dont-use-in-memory-databases-tests/db-container-managed-by-the-test