Quickstarts > 10. Optimize scalability and performance
In this learning module, you will learn how to architect for scalability and performance optimization of applications in the NHN Cloud environment. Leverage NHN Cloud RDS to design efficient, flexible, and scalable systems for auto-scaling, load balancing, and reliable data management.

Learning objectives
In this learning module, you'll learn
- Create a load balancer
- Create load balancers in L4 routing mode for traffic balancing and connect floating IPs to ensure accessibility of web services
- Configure an autoscale group
- Set up autoscale groups to automatically add or delete instances based on traffic changes
- Apply CPU usage-based scale-up and scale-down policies to maintain a minimum of one and maximum of three instances
- Set up web server access
- Make the created web server accessible via the floating IP connected to the load balancer
Before you begin
Before you begin this learning module, here's what you need to know
- Standard Internet browser
- You must have the latest version of a browser installed, such as Google Chrome, Microsoft Edge, Firefox, or Safari.
- JavaScript and cookies must be enabled in your browser settings.
- Internet connection environment
- A stable internet connection is required, with a recommended bandwidth of at least 5 Mbps.
- You must be able to communicate securely over HTTPS.
- Member account
- You must have an NHN Cloud account with a registered payment method.
- You must be logged in to the NHN Cloud portal.
This guide starts with the steps after 9. Backup and restore.
Traffic balancing with scaling groups and load balancers
Step 1. Create a load balancer
Use the Load Balancer service to create a MyLB load balancer, and then create a floating IP to connect to it.
- From the top menu of the NHN Cloud console, select the organization
(MyORG), project(MyPRJ), and Korea (Pyeongchon) regionthat you want to use for your lab.
- In the left menu of the console window, click Network - Load Balancer.
- + Create Load Balancer.
- On the Select Load Balancer Creation Mode screen, select
L4 Routing Mode, and then click Confirm.
- On the Create Load Balancer screen, set the information below and then click Create Load Balancer.
- Settings
- Name:
MyLB
- Type:
General
- VPC:
MyVPC(192.168.0.0/16)
- Subnet:
Auto-assign MySubnet (192.168.0.0/24)
- Static routes:
Not applicable
- Listeners
- Name:
http-listener
- Connection limit:
60000
- Keep-Alive timeout:
300
- Protocol:
HTTP
- Block invalid requests:
Enabled
- Load balancer port:
80
- Member groups
- Name:
linux-server-member
- Health check protocol:
HTTP
- Health check port:
80
- Protocol:
HTTP
- HTTP method:
GET
- Port:
80
- HTTP status code:
200
- Load balancing method:
ROUND_ROBIN
- URL:
/
- Session persistence:
No session persistence
- Health check interval:
30
- Maximum response latency:
5
- Maximum number of retries:
2
- Host Header:
Empty
- IP access control group:
None (default)
- Erasure protection:
Disabled
- In the Success window, click OK.
- After a few moments, when the creation is complete, select
MyLBand click Manage Floating IPs at the top.
- In the Manage Floating IPs window, under Create Floating IP, click + Create.
- In the Create Floating IP window, click Create.
- In the Success window, copy and record the floating IP address.
- Click OK.
- In the Manage Floating IP s pane, under the Connect/Disconnect Floating IPs item, click Set up and connectas shown below.
- Select Floating IP:
The floating IP address you created and confirmed above.
- Select network interface:
MyLB
- In the Success window, click OK.
- Click Close.
Step 2. Create an auto-scaling group
Utilize the Auto Scale service to create a scaling group and then create two instances that can be made available.
- Click Compute - Auto Scalein the left menu of the console window.
- On the Auto Scale screen, click + Create scaling group.
-
On the Create Scaling Group screen, set the information below and then click Create Scaling Group.
- Instance Templates
- Image
- Click Personal Images > Image Name:
linux-server-basic-image
[Note]
The linux-server-basic-image private image can be created through step 1 of 9.Backup and Restore.
- Instance information
- Availability zones:
Any availability zone.
- Instance name:
linux-server-autoscale
- Instance Types > click Select Instance Type > click Instance Type Name:
t2.c1m1 > click Select
- Keyfair >
MyKey
- For more information on creating a key pair, see the Key pair user guide.
- Root block storage
- Block storage type:
HDD
- Block storage size (GB):
20 GB
- Network settings: Select
Create network interface
- Network
- Under Available subnets, click the
MySubnet (192.168.0.0/24 ) resource to use it as the selected subnet.
- Floating IP:
Disabled
- Security groups
- Select a security group: Select
MySG-HTTP
- Additional block storage:
Disabled (default)
- User scripts:
Blank (default)
- About scaling groups
- Name:
MyASGroup
- Minimum Instances:
1
- Maximum instances:
3
- Running Instances:
2
- Scaling policies
- Condition:
instance cpu > 50% condition persists for 1 minute
- Adjust instances:
1 instance is created.
- Reuse latency: No attempt to create an instance for
1 minute after it is created.
- Reduction policies
- Condition:
instance cpu < 10% condition persists for 1 minute
- Instance reconciliation:
1instance is deleted.
- Reuse latency: No attempt to create an instance for
1 minute after it is created.
- Automatic recovery policies
- Automatic recovery:
Enabled
- Load balancers
- Under Available load balancers, click
MyLB resource to use as the selected load balancer
- Deploy association:
Disabled (default)
-
In the Success window, click OK.
- In the list of images on the Auto Scale screen, you'll see
MyASGroup being created. When creation is complete, the status light for that scaling group will be green.
- In the left menu of the console window, click Compute - Instance.
- On the Instance screen, verify that two
linux-server-autoscalehave been created among the list of instances.
Step 3. Use a load balancer to distribute traffic
Learn how to use MyLB load balancer to distribute traffic across multiple instances.
- Click Network - Floating IPin the left menu of the console pane.
- Copy and recordthe IP address from the floating list of IP resources to which the connected device
is MyLB.
- Open a new window in your web browser and enter
http://the copied MyLB floating IP addressto access the changed web page.
- Verify that the Server IP Address valuein the body of the web page matches the virtual private IP address of
the linux-server-autoscale instance youcreated.
- Repeat the web browser refresh to verify that the Server IP Address valuechanges to the virtual private IP address of another
linux-server-autoscale instance.

Result 1

Result 2
Tips
- Verify the Server IP Address value change value
- The
linux-server-autoscale instance may change state from time to time depending on the AutoScale group's grow/shrink policy settings. This may result in only one Server IP Address due to the reduction from two instances to one instance.
- The load balancer associated with an autoscale group periodically checks the status values of the instances in the group and connects to them. As a result, the health value information is updated, which can expose Server IP Address values that have changed after a period of time.
- If a changed web page is not visible
- If you see the old page even though the web page has changed, the problem may be caused by your web browser's cache. In this case, you can use the refresh (F5) or strong refresh provided by your browser to see the changed page. You can perform a strong refresh in the following ways.
- Windows:
Ctrl + F5 or Shift + F5
- Mac:
Cmd + Shift + R
Step 4. Apply the autoscale group growth and reduction policy
Learn how to auto-scale the number of instances based on application demand.
- Open a new window in your web browser and connect to
http://복사한by entering your MyLB floating IP address.
- Click Start Stress Testin the body of the web page and wait 2 minutes.
[Note]
- Stress Test
- This feature places a random CPU load on the web server to ensure that the scaling policies you create in the autoscale group work.
- Click Compute - Instance in the left menu of the console window.
- On the Instance screen, verify that
linux-server-autoscaleis added to the list of instances.
- Open a new window in your web browser and enter
http://the copied MyLB floating IP address to view the web page.
- Verify that the Server IP Address value in the body of the web page is the virtual private IP address of
the linux-server-autoscale instance youcreated.
- Repeat the web browser refresh to verify that the Server IP Address value changes to the virtual private IP address of another
linux-server-autoscale instance.
- Click to select the
linux-server-autoscale instance from the Compute - Instance menu and click the Monitoring tab in the split pane below to see the CPU utilization.
- Click to select the
MyASGroup scaling group from the Compute - Auto Scale menu and click the Statistics tab in the split pane below to see the CPU utilization.
- If the
linux-server-autoscale instance was automatically spawned, wait again for 2 minutes.
- On the Instances screen, verify that
linux-server-autoscaleis removed from the list of instances.
- Repeat the web browser refresh to verify that the Server IP Address value is output as the virtual private IP address of the
linux-server-autoscale instance you are maintaining.
References
Previous step
Next step