cloud run 반응시간 단축방법

Dongsung Kim·2022년 11월 2일
1

결론



  • cloud run 이 해주는 것
    • HTTP endpoint
    • routing requests to container
    • container 갯수 늘였다 줄였다

idle instance

  • min idle service setting 할 수 있으나, 돈든다.

cloud run container startup

  1. start the service
    • container 시작
    • entrypoint command to start 서버
  2. open service port 체크

#1. leaner service

  • 파이썬... 아마 모듈 import 할 때 시간 걸리는 거 말 하는 듯.
  • 중간에 필요하면 import 하는 걸로 바꾸자

#2. leaner base image

  • 사이즈가 문제는 아닌데, OS-level packages 가 느리게 만들어 줄 수 있다.

  • 용량은 크지만, OS가 simple해서 금방 스타트 할 수 있다.

  • alpine, distroless 등 추천

#3. 글로벌 변수 써라

  • global variable
  • cold start 시간 단축 과는 큰 상관이 없다.
  • container init 되어있으면, cached object 가능함
  • global state --> Memorystore에 저장하는 것도 하나의 방법

  • 참고
profile
Pick one

0개의 댓글