> For the complete documentation index, see [llms.txt](https://tech.x2bee.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://tech.x2bee.com/dev-guide/developer-guide-en/pjt-prepare/architecture-guide/performance-improvement-assurance-measures.md).

# Performance Improvement/Assurance Measures

## Display, Product <a href="#undefined" id="undefined"></a>

<figure><img src="https://tech.x2bee.com/download/attachments/2654357/%EC%A0%84%EC%8B%9C_%EC%83%81%ED%92%88.png" alt=""><figcaption></figcaption></figure>

<table data-header-hidden><thead><tr><th width="166.22216796875"></th><th></th></tr></thead><tbody><tr><td>Resource Configuration</td><td>Content</td></tr><tr><td>Summary Table</td><td><p>Table structures where data frequently queried from the front end causes Full Scans, Sorts, etc.</p><p>For product, display, and promotion price tables that cannot be resolved through denormalization, a summary table can be created to allow retrieval via Index Range Scan</p><ul><li>Modified in the admin panel, queried from the front end</li><li>Data can be queried after the summary table is created and propagated</li><li>Summary table generation batch</li></ul></td></tr><tr><td>Master-Replica</td><td><p>Provided by AWS RDS (or configured using PostgreSQL technology); Master data is replicated and synchronized to the Replica using CDC</p><ul><li>Master and Replica have identical data</li><li>1 Master</li><li>Replica can be scaled out</li><li>Master and Replica have identical data</li><li>If the Master fails, one of the Replicas takes over the Master role</li></ul></td></tr></tbody></table>

## Application <a href="#application" id="application"></a>

<figure><img src="https://tech.x2bee.com/download/attachments/2654357/%EC%84%B1%EB%8A%A5%ED%96%A5%EC%83%81_%EB%B3%B4%EC%9E%A5%EB%B0%A9%EC%95%88_Application.png" alt=""><figcaption></figcaption></figure>

<table data-header-hidden><thead><tr><th width="141.7777099609375"></th><th></th></tr></thead><tbody><tr><td>Resource Configuration</td><td>Content</td></tr><tr><td>Spring Cache</td><td><p>Caches the call response object using &#x3C;Method + Parameter> as the key</p><ul><li><p>Available storage</p><ul><li>EhCache (Heap Memory)</li><li>Redis</li><li>Caffeine</li><li>Hazelcast</li><li>Infinispan</li></ul></li></ul></td></tr><tr><td>EHCache</td><td><ul><li>Can be used without a separate server configuration</li><li>Fast response on cache hit</li><li>Cache required per individual VM (lower hit rate)</li><li>Relatively small cache memory</li></ul></td></tr><tr><td>Redis</td><td><ul><li>Once cached, multiple Pod Replicas share the cache (increased hit rate)</li><li>Can use large-capacity cache memory</li><li>Relatively slower lookup speed on cache hit</li><li>Requires a separate Redis server (increased cost)</li></ul></td></tr></tbody></table>

## CDN <a href="#cdn" id="cdn"></a>

<figure><img src="https://tech.x2bee.com/download/attachments/2654357/%EC%95%84%ED%82%A4%ED%85%8D%EC%B2%98_CDN.png" alt="" width="563"><figcaption></figcaption></figure>

<table data-header-hidden><thead><tr><th width="134"></th><th></th></tr></thead><tbody><tr><td>Resource Configuration</td><td>Content</td></tr><tr><td>CDN</td><td><p>Content Delivery Network. For static content that returns the same content for the same requested URL, instead of processing every request all the way to the file system (S3), a CDN clustered at the front of the network is used to deliver content to users quickly, improving client-side speed.</p><p>– CDN used: CloudFront</p></td></tr><tr><td>Purge</td><td>Function to immediately update cached content when there is a large-scale content change or an urgent change</td></tr></tbody></table>

## Front - End <a href="#front-end" id="front-end"></a>

To improve the loading speed of the Front-End UI, three plug-ins (PWA / Lazy-Load / Skeleton UI) will be applied.

#### 1) PWA <a href="#id-1-pwa" id="id-1-pwa"></a>

* What is a PWA (Progressive Web App)?\
  It refers to an app built using web technologies such as HTML, CSS, and JavaScript.
* Advantages of PWA
  * Low barrier to entry since familiar web technologies can be used as-is
  * Uses push notifications, offline caching, and HTTPS
  * Can be deployed anywhere as long as a web browser is available
  * Can be installed as an application by adding it to the home screen
  * Fast execution speed
  * Provides a user experience similar to native apps
* Disadvantages of PWA
  * Requires a browser that supports web standards, since it communicates via web APIs
  * Cannot be distributed via the App Store or Play Store
  * Only some features are available on iOS

<figure><img src="https://tech.x2bee.com/download/attachments/2654357/%EC%95%84%ED%82%A4%ED%85%8D%EC%B2%98_Front-End.png" alt=""><figcaption></figcaption></figure>

| Resource Configuration | Content                                                                                                                                                                                                                                                                                   |
| ---------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| PWA Caching            | <ul><li>The application calls the API server</li><li>The Service Worker checks whether cached data exists; if so, it sends the cached data to the screen first, then makes the API request</li><li>The Service Worker caches the API's response and sends it to the application</li></ul> |

#### 2) Lazy - Load <a href="#id-2-lazy-load" id="id-2-lazy-load"></a>

* What is Lazy-Load?
  * Instead of loading all content in bulk when accessing a page, content can be loaded when the user accesses the specific part of the page they need
  * Mainly used for components, images, etc.
* Advantages of Lazy-Load
  * Provides content faster since only part of the site is downloaded when the user first opens the web page
  * Reduces resource costs since not all content is loaded
* Disadvantages of Lazy-Load
  * Relatively weak for SEO (Search Engine Optimization) since not all content on the page is loaded

#### 3) Skeleton UI <a href="#id-3-skeleton-ui" id="id-3-skeleton-ui"></a>

* What is Skeleton UI?\
  A loading animation that first draws the outline of the screen to be displayed before the actual data is rendered.
* Advantages of Skeleton UI
  * Perceived loading time is shorter because, once loading is complete, the data replaces the outline for a smooth screen transition
* Disadvantages of Skeleton UI
  * Requires significant time and cost to apply to all pages

| <img src="https://tech.x2bee.com/download/attachments/2654357/image-20220331-020335.png?version=1&#x26;modificationDate=1648692217742&#x26;cacheVersion=1&#x26;api=v2" alt="" data-size="original"> | <img src="https://tech.x2bee.com/download/attachments/2654357/image-20220331-020344.png?version=1&#x26;modificationDate=1648692226136&#x26;cacheVersion=1&#x26;api=v2" alt="" data-size="original"> |
| --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |

### Performance Assurance Measures (AutoScaling) <a href="#id-5.-autoscaling" id="id-5.-autoscaling"></a>

<figure><img src="https://tech.x2bee.com/download/attachments/2654357/%EC%95%84%ED%82%A4%ED%85%8D%EC%B2%98_AutoScaling.png" alt=""><figcaption></figcaption></figure>

| Resource Configuration | Content                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                |
| ---------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| HPA                    | <p>Horizontal Pod Autoscaling</p><p>When configuring a service with Pods, specifying a minimum and maximum count allows the service to run with the minimum number of Pods when there is no load, and automatically scale the number of Pods up to the maximum, within the limits allowed by the Node's resources, as the load increases.</p><p>– Since only the Pods of the services that need it are increased among the entire set of services, this shows very efficient utilization and fast scale-out performance in an MSA.</p> |
| Node Autoscaling       | In Kubernetes on AWS, when all resources of the allocated Nodes are used (i.e., new Pods cannot be scheduled), Nodes are automatically scaled out up to the specified Node count to guarantee service performance.                                                                                                                                                                                                                                                                                                                     |
