✌️
Studylog
See More
Studylog
Studylog
  • INTRO
  • AWS
    • AWS101
      • Virtualization and the AWS structures
      • AWS account and free-tier
      • AWS IAM
      • AWS EC2
        • EC2 basic
        • ENI and EIP
        • Elastic Block Storage
        • Auto Scaling
        • Elastic Load Balancer
  • IaC
    • Terraform
      • License Change
      • Tutorial
      • Module
      • Versioning
  • Airflow
    • Airflow-Ninja
      • Introduction and Goal
      • Tutorial: Settings
      • Tutorial: Module Import, Alert
  • Docker
    • Production with Docker
      • Customizing root directory
  • Network
    • Network-Handbook
      • Introduction and Goal
      • OSI7Layer
      • DNS
      • SSL/TLS
  • Comupter Architecture
    • Basic
      • Introduction and Goal
      • Chapter 1. The Internal Language of Computers
      • Chapter 2. Combinatorial Logic
      • Chapter 3. The Essentials of Memory and Disk Sequential Logic
    • Hands-on
      • Introduction and Goal
      • theory
        • Chapter 1. Logic Gates
        • Chapter 2. ALU
      • project
        • Project 1. Elementary logic gates implement
        • Project 2. Boolean Arithmetic
  • Java
    • Readable Code
      • 학습 목적
      • 추상화
      • 논리적 사고 흐름
      • 객체지향 이론
      • 객체지향 코드 적용하기
      • 코드 다듬기
      • 읽기 좋은 코드를 도와줄 조언들
  • Spring Boot
    • Practical Testing
      • 테스트 사전 지식
      • 스프링 레이어드 아키텍처 테스트하기
        • Persistence Layer
        • Business Layer
    • 스프링 핵심 원리 - 기본편
      • 객체 지향 설계와 스프링
      • 스프링 핵심 원리 이해
        • 예제 만들기
        • 객체 지향 원리 적용
        • 스프링 컨테이너와 스프링 빈
  • Python
    • Effective Python
      • Introduction and Goal
      • Closure: Lazy Evaluation And Eager Evaluation
      • Python public attributes are better getter-setter
      • No refactoring attribute, we can use property decorator
      • You can do it, but it means you don't have to
  • Playgrounds
    • Java Playground
      • 학습 목적
      • 숫자 야구 게임
        • 학습 테스트
        • 문자열 계산기
        • 숫자 야구 게임 구현
        • 숫자 야구 게임 다시 구현하기
      • 자동차 경주
        • 문자열 덧셈 계산기
        • 자동차 경주 미션 구현
      • 좌표 계산기
        • 연료 주입
        • 좌표 계산기 미션 구현
    • Infra Playground
      • VPC: 망분리 그리고 테스트
      • 컨테이너 사전 지식
      • 화면 성능 개선 전 학습 테스트
      • SSM: Session Manager
      • SQL, 이 정도는 알아야지 😎
      • Subway-Map
        • 망 구성하기
        • 서버 구성하기
        • 화면 성능 개선하기
      • Conference Platform
        • 망 구성하기
        • 서버 구성하기
        • 화면 성능 개선하기
  • Tools
    • SOPS
    • Bruno
    • 🖥️FCK-NAT
    • 🧊Pulumi
Powered by GitBook
On this page
  1. Playgrounds
  2. Infra Playground
  3. Conference Platform

화면 성능 개선하기

어플리케이션의 성능을 개선할 수 있는 요소를 찾아서 개선 해보아요

Previous서버 구성하기

Last updated 4 months ago

사용자의 경험을 위해 어플리케이션의 성능을 검사 하고 개선점을 만들어봅시다.

화면 성능 개선하기 목록

  • 웹 성능 테스트

  • Reverse Proxy 개선하기

  • Tomcat 개선하기

웹 성능 테스트


TODO

  • 페이지 성능은 우선 기본적으로 가장 많이 방문하는 페이지나 트래픽이 많이 발생할 것으로 예상되는 페이지 등 중요하다는 페이지로 웹 성능 테스트 진행 해보아요

평가는 전체적인 점수와 각 측정 항목별 반응시간을 나타낸다.

  • First Contentful Patin : 첫번째 텍스트 혹은 이미지가 표시되는 시간

  • Speed Index : 컨텐츠가 얼마나 빨리 표시되는지 보여준다.

  • Largest Contentfull Paint : 최대 텍스트 혹은 이미지가 표시되는 시간

  • Total Blocking Time : FCP와 상호작용 시간 사이의 모든 시간의 합

  • Cumulative Layout Shift : 표시 영역 안에 보이는 요소의 이동을 측정

사이트
FCP
SI
LCP
TBT
CLS

지하철 노선도

3.1 s

3.2 s

3.1 s

0 ms

0

네이버 지도

0.7 s

3.6 s

4.0 s

1,240 ms

0.001

카카오 지도

0.8 s

0.9 s

0.8 s

0 ms

0

Reverse Proxy 개선하기


TODO

  • gzip 압축 설정

  • cache 설정

  • HTTP/2 설정


1

Gzip 압축 설정

http {
  gzip on; ## http 블록 수준에서 gzip 압축 활성화
  gzip_comp_level 9;
  gzip_vary on;
  gzip_types text/plain text/css application/json application/x-javascript application/javascript text/xml application/xml application/rss+xml text/javascript image/svg+xml application/vnd.ms-fontobject application/x-font-ttf font/opentype;

   ## Proxy 캐시 파일 경로, 메모리상 점유할 크기, 캐시 유지기간, 전체 캐시의 최대 크기 등 설정
  proxy_cache_path /tmp/nginx levels=1:2 keys_zone=mycache:10m inactive=10m max_size=200M;

  ## 캐시를 구분하기 위한 Key 규칙
  proxy_cache_key "$scheme$host$request_uri $cookie_user";
2

Cache 설정

server {
    listen 443 ssl;
    ssl_certificate /etc/letsencrypt/live/infra.myadvent-calendar.com/fullchain.pem;
    ssl_certificate_key /etc/letsencrypt/live/infra.myadvent-calendar.com/privkey.pem;

    # Disable SSL
    ssl_protocols TLSv1 TLSv1.1 TLSv1.2;

    # 통신과정에서 사용할 암호화 알고리즘
    ssl_prefer_server_ciphers on;
    ssl_ciphers ECDH+AESGCM:ECDH+AES256:ECDH+AES128:DH+3DES:!ADH:!AECDH:!MD5;

    # Enable HSTS
    # client의 browser에게 http로 어떠한 것도 load 하지 말라고 규제합니다.
    # 이를 통해 http에서 https로 redirect 되는 request를 minimize 할 수 있습니다.
    add_header Strict-Transport-Security "max-age=31536000" always;

    # SSL sessions
    ssl_session_cache shared:SSL:10m;
    ssl_session_timeout 10m;

    # Proxy 캐시 설정 (정적 파일 요청 캐싱)
    location ~* \.(?:css|js|gif|png|jpg|jpeg)$ {
      proxy_pass http://app;

      # 캐시 존 및 상태 정보 헤더 추가
      proxy_cache mycache;
      add_header X-Proxy-Cache $upstream_cache_status;

      # 캐싱 조건
      proxy_cache_valid 200 302 10m;
      expires 1M;
      access_log off;
    }
3

HTTP/2 설정

server {
    listen 443 ssl http2;  // http2 추가
    ssl_certificate /etc/letsencrypt/live/infra.myadvent-calendar.com/fullchain.pem;
    ssl_certificate_key /etc/letsencrypt/live/infra.myadvent-calendar.com/privkey.pem;

    # Disable SSL
    ssl_protocols TLSv1 TLSv1.1 TLSv1.2;

    # 통신과정에서 사용할 암호화 알고리즘
    ssl_prefer_server_ciphers on;
    ssl_ciphers ECDH+AESGCM:ECDH+AES256:ECDH+AES128:DH+3DES:!ADH:!AECDH:!MD5;

    # Enable HSTS
    # client의 browser에게 http로 어떠한 것도 load 하지 말라고 규제합니다.
    # 이를 통해 http에서 https로 redirect 되는 request를 minimize 할 수 있습니다.
    add_header Strict-Transport-Security "max-age=31536000" always;

    # SSL sessions
    ssl_session_cache shared:SSL:10m;
    ssl_session_timeout 10m;

    # Proxy 캐시 설정 (정적 파일 요청 캐싱)
    location ~* \.(?:css|js|gif|png|jpg|jpeg)$ {
      proxy_pass http://app;

      # 캐시 존 및 상태 정보 헤더 추가
      proxy_cache mycache;
      add_header X-Proxy-Cache $upstream_cache_status;

      # 캐싱 조건
      proxy_cache_valid 200 302 10m;
      expires 1M;
      access_log off;
    }

Tomcat 개선하기


server.compression.enabled: true
server.compression.mime-types: text/html,text/plain,text/css,application/javascript,application/json
server.compression.min-response-size: 500

미션 진행 코드