This article was originally published on Alibaba Cloud. Thank you for supporting the partners who make possible.

Deploying a highly available and scalable on a traditional data center is a complex and expensive undertaking. One must invest a lot of effort and resources into capacity management. But more often than not, it ends up in over or under-provisioning of resources, further resulting in inefficient investment in underutilized hardware. To tackle this challenge, Alibaba Cloud offers a reliable, scalable, and high-performing infrastructure for most demanding web application deployment scenarios. This document intends to provide practical solutions and best when it comes to scaling your web application on Cloud.

Traditional Solution for Common Web Application

In a traditional web hosting space, designing a scalable architecture is always a challenge. The below diagram depicts a traditional web hosting model. The purpose of this diagram is to help you compare it with a similar architecture hosted on the cloud.

Traditional web hosting usually follows a three-tier design that divides the architecture into presentation, application, and persistence layers. The design achieves scalability through the inclusion of additional servers at each of these layers. The architecture also has built-in high availability features. The section below examines the means of deploying this traditional web hosting in Alibaba Cloud.

Simple Web Application Hosting Architecture on Alibaba Cloud

The diagram below shows how the traditional web hosting architecture looks like when deployed using various Alibaba Cloud products and services:

The key components of this architecture include:

  • Elastic Compute Service (ECS) — Built on Alibaba Cloud’s own large-scale distributed computing system, Elastic Compute Service or ECS is a scalable and highly-efficient cloud computing service. Alibaba Cloud ECS helps you to quickly build more stable and secure web applications to adapt to your business’ real-time needs.
  • Object Storage Service (OSS) — Alibaba Cloud offers various options to store, access, and backup your data on the cloud. For static storage, it provides Object Storage Service (OSS) to facilitate automatic data replication and failure recovery.
  • ApsaraDB for RDS — Relational Database Service or RDS is a stable, reliable, elastic and high-performance online database service based on Alibaba Cloud’s own distributed system. It supports MySQL, SQL Server, PostgreSQL, and PPAS. Furthermore, it provides a comprehensive set of features including disaster recovery, data backup, monitoring, and migration.
  • DNS — Alibaba Cloud DNS service provides a highly available and scalable DNS service for your domain management needs. It automatically reroutes requests for your domain to the nearest DNS server.
  • Server Load Balancer (SLB) — Server Load Balancer is a web traffic distribution service that maximizes and extends the external service capabilities of your web applications. By seamlessly distributing traffic across multiple cloud servers and eliminating single points of failure, SLB enhances the reliability, usability, and availability of your applications.

Leveraging the Cloud for Web Application Hosting

When deploying a web application on Alibaba Cloud, you should consider making modifications in your deployment to fully utilize the advantages of the cloud. Below are some key considerations of when hosting an application on Alibaba Cloud.

Multiple Data Centers in a Region

Within a certain region, Alibaba Cloud usually operates at least two data centers called Availability Zones (AZs). Elastic Compute Service (ECS) in different AZs are both logically and physically separated. Alibaba Cloud provides an easy-to-use model for deploying your applications across AZs for higher availability and reliability.

High Security for Web Applications and Servers

Web application security is one of the primary concerns for organizations today, with more than 90% of the applications being vulnerable to security attacks. These attacks can exploit websites and inherent servers, which puts businesses at the risk of financial loss. To protect your web applications from such attacks, Alibaba Cloud provides a suite of network and application security services, such as Anti-DDoS (Basic and Pro), Web Application Firewall (WAF), and Server Guard.

In addition to these services, users can proactively limit external traffic by defining firewalls and permissions. The diagram below depicts the Alibaba Cloud web application hosting architecture that comes with a group firewall to secure the entire infrastructure.

  • For the web server cluster, a firewall security group allows access only on ports 80 and 443 (HTTP and HTTPS).
  • To protect the application server cluster, the security group allows access only from the web servers.
  • For the DB server, its security group permits access to app data requests from the application servers. Additionally, the security group for DB servers permits access only from the application layer. To ensure complete security, access to port 22 (SSH) for direct host management is allowed only from the whitelisted IPs configured in the security group’s firewall rules.

Treating ECS as Dynamic Resources

To build and host a fault-tolerant and a scalable application on Alibaba Cloud, you will need a flexible system that takes the dynamic nature of ECS into account. It is essential to understand that cloud resources may become unavailable or lost in case of a failure. Moreover, once a new virtual server is provisioned, you cannot assume anything about the IP address allocated to it. To handle such scenarios, Alibaba Cloud allows you to select the location of resources and provides Elastic IPs. They are procured for keeping the IP address of a resource as static. In case you provision a new ECS instance, you can map the same EIP to the new instance.

With all these factors in mind, let’s look at some of the best practices for deploying your web applications based on specific scenarios.

Best Practice #1: Application Hosting with Content Delivery

Up until this point, the above web application architecture was best suited to serve all the user requests from a single central location. However, in case of high traffic volume, Content Delivery Network (CDN) helps to optimize the performance of your web application ensuring a latency-free experience.

Reference Architecture

With Alibaba Cloud CDN, a growing network of global edge locations is responsible for caching static and streaming content. CDN fetches original content from OSS and caches the content at edge nodes. Once cached, future requests are automatically routed to the nearest edge location to ensure content delivery with the best possible performance. This process, in turn, frees up extra load from servers due to the traffic hitting servers directly, allowing an efficient consumption of compute resources.

The following architecture diagram illustrates a typical web application hosting with CDN.

Alibaba Cloud CDN can also work seamlessly with any non-Alibaba Cloud origin server. There are also no financial commitments for using Alibaba Cloud CDN – you pay only for as much or as little content that actually gets delivered through the service.

Best Practice #2: Web Application Hosting with Auto Scaling

In a traditional infrastructure hosting model where you require to provision a fixed number of servers, you are forced to stand up servers based on demand spikes. This method relies on accurate capacity planning, or else would lead to considerable expenditure on unused server capacity. In the real world, a typical traffic experienced on a website looks like this:

Reference Architecture

On Alibaba Cloud, a web application can leverage on-demand provisioning of additional servers, or downward adjustment during less traffic period to minimize utility cost. All of these are performed automatically by Alibaba Cloud Auto Scaling service. Instead of a traffic forecasting model to provision servers ahead, Alibaba Cloud Elastic Compute Service (ECS instances are provisioned on the fly according to a set of triggers for scaling the fleet out and back in. Addition or removal of servers managed by Auto Scaling from Server Load Balancer occurs automatically, making this deployment option a genuinely robust setup. The diagram below illustrates a typical web application hosting along with auto-scaling:

Let us now briefly discuss the key component of this architecture, Auto Scaling. You can set up Auto Scaling triggers depending on metrics data obtained directly from Alibaba Cloud Monitor. For example – you can set Auto-scaling to trigger if the CPU utilization has been at 75% or above for the past five minutes or in case your current application uses up to 35% of the memory. Moreover, you can also provision a set number of instances at a particular time according to the expected load and your organization’s requirements.

Best Practice #3: Web Application Hosting with Higher IO Performance

In the face of growing business demands, the need to maintain your application’s high performance is crucial. Even the minutest of failures can lead to extreme response time and hamper user experience. The traditional single instance database design may not be sufficient enough to meet a large volume of I/O requests.

To reduce the burden from the database, you should separate write and read requests into different database instances. While you carry out the separation, don’t forget to include a memcached layer between the web hosting servers and the database.

There are two key components in this architecture:

  • ApsaraDB for Memcache: It is an online open caching service that provides high-speed access to queries and data while accessing hotspot data. Additionally, it supports key-value databases and is compatible with ECS service. You can retain hotspot data and reduce the stress on the database to shorten read response time.
  • ApsaraDB for Read-only RDS: In case the read requests exceed the write requests, a single instance will fail to handle them, impacting the performance of the application. To achieve a smoother reading and writing ability, ApsaraDB can create replicas of master instances with read-only accounts for RDS in a particular region. This offers faster response to read/write requests. Additionally, the replicas handle the read requests while the master instance only caters to write requests.

Best Practice #4: Web Application Hosting with Multi-DC Disaster Recovery

For businesses with large-scale, mission-critical web applications, the need to maintain high availability for a seamless user experience is crucial. In spite of the fact that cloud infrastructure ensures protection through security services you still need cross-data center deployments to provide additional security. This becomes even more imperative in case of data center downtime.

Reference Architecture

The key feature of this cloud architecture design is to distribute all the servers and database services across multiple DCs or Available Zones. This distribution is done as long as the servers are among the same region and can serve as one single web application system.

Let us look at the key considerations of Alibaba Cloud Web Application Hosting with Multi-DC Disaster Recovery.

Complete Automation: This architecture detects server-related problems and ensures recovery by switching the production environment with the disaster recovery environment. ApsaraDB for RDS maintains a data backup but and also turns databases endpoints automatically in case the master database machine fails to function, ensuring excellent availability.

Full Resource Utilization: In the suggested cloud architecture, there are no resources dedicated to the DR environment. As soon as any problem occurs, the system uses resources from the production environment to ensure disaster recovery. This facilitates the full utilization of resources, which makes it a cost-effective solution for businesses.

Best Practice #5: Web Application Hosting with Multi-Region Deployment

For businesses operating in multiple countries or planning to expand globally, having a flexible IT architecture is essential for business growth. Such companies need highly stable and superior quality networks to keep up with technology and changing demands. For such firms, the primary concern relates to the critical need for an efficient and secure network through which they can connect their global businesses. Leasing lines from telecom service providers can be a costly option for small or mid-sized enterprise companies. To address this, Alibaba Cloud offers an easy and cost-effective way to connect with different regions of the world through dedicated lines. It also provides several other solutions to address data replication/synchronization across regions.

Reference Architecture

The architecture below matches the need of multi-node deployments across different regions. An application that is deployed in China can also be deployed in the U.S. region simultaneously. The two applications interact with each other at the service and data layers. Using Alibaba Cloud Express Connect, the two VPCs in multiple regions are connected through a dedicated line. This allows a secure connection via the internet between ECS instances located in the China region and those located in the U.S. region. Despite being in different locations, the two RDS instances can also synchronize data in real time. Alibaba Cloud OSS allows cross-region data replication to meet the demands of a large volume of data replication through the Internet.

A multi-region deployment based on this architecture is simple and cost effective.Users can quickly build their multi-region application and maintain all the cloud resources around the world with a single Alibaba Cloud account. Alibaba Cloud also offers multiple data transmission solutions to address most users’ business scenarios requirement.

Conclusion

On comparing the traditional and cloud web hosting methods, as an organization, it is imperative for you to look beyond hardware and price to leverage the true inherent value of the hosting solution and the associated business benefits. A traditional web hosting system requires you to purchase, install, manage, and maintain the hardware setup and infrastructure to host your site; a task that can take an extremely long duration. Such necessities make the traditional hosting solution cumbersome, time-consuming, and extortionate.

Moreover, most of the large-scale enterprises have a presence in multiple locations, each needing a dedicated vendor/staff. Managing these vendors from a remote location further adds up to the organizational cost. Also, there are other hidden costs such as extra taxations to procure hardware, delivery charges, and along with operational overheads.

In contrast, cloud web hosting offers multiple advantages with a potential to yield significant business benefits. Also, cloud web hosting ensures SLAs that promise high availability for your website. Besides, it lets you pay as you consume the resources with no hidden costs enabling you to plan your IT budget efficiently.



Source link https://www.sitepoint.com/best-practices-of-web-application-hosting-in-alibaba-cloud/

LEAVE A REPLY

Please enter your comment!
Please enter your name here