Designing a Flexible Backend Architecture on Alibaba Cloud for Early‑Stage Projects
This article outlines a cost‑effective, scalable backend architecture built on Alibaba Cloud services—including VPC, RDS, ECS, OSS, and security measures—to support the early stages of a mobile and web application and to enable gradual performance upgrades as traffic grows.
After nearly a year of development, the project has stabilized and the author summarizes the initial backend architecture to prepare for the next phase, emphasizing the need for a flexible, quickly deployable, and continuously integrated design.
The frontend consists of an iOS app and several web admin systems, while the backend provides data APIs; the author is responsible for the entire backend design, server operations, and PHP development.
The overall architecture uses Alibaba Cloud services: an RDS master‑slave cluster with a disaster‑recovery instance, ECS instances that can auto‑scale based on load, and other services deployed as single‑instance remote calls.
VPC is set up to place the database and servers in the same private network, improving security and allowing free internal traffic, which reduces operational costs; a cost comparison image illustrates the savings.
Business data layer includes RDS (initially a shared single instance, later expanded with read replicas and a disaster‑recovery instance), Redis (single‑instance cache with high speed and internal‑network security), and MongoDB (document storage for user behavior, versioned data, and complex relationships).
Static resources are stored in OSS and accelerated via CDN; client applications retrieve resource URLs through backend APIs.
Server security is addressed at both the operations level (Alibaba Cloud web firewall, threat detection, firewalld configuration) and the business level (signature verification, rate‑limiting counters built with phpredis, HTTPS, and RSA encryption for sensitive data).
The server cluster consists of a master ECS (managing other ECS instances with Ansible, optional whitelist access) and multiple slave ECS instances that host only business logic; load balancing can be achieved either with an Alibaba Cloud SLB instance (with public IP) or by deploying Nginx on a public‑IP ECS.
Third‑party services used include Coding (private Git repository with webhook‑driven automatic deployment and CI), Yuntongxun for SMS/verification codes, and RongCloud IM for iOS instant messaging and push notifications.
The backend logic layer started with the Phalapi framework (lightweight, easy DI, many extensions) and is gradually migrating to Laravel 5.3; custom extensions were built for Workman and Gearman, the latter providing asynchronous request processing.
Performance can be improved by adding more ECS instances for HTTP concurrency, using Gearman for long‑running tasks, increasing database connection limits or adding read‑only replicas, and eventually adopting Hadoop for TB‑scale data; additional optimizations include Nginx tuning, kernel tweaks, and SSD storage.
In summary, the architecture fully meets early‑stage business needs at a low cost, and can be incrementally upgraded to handle higher traffic, saving money, time, and effort.
Note: The final block promotes the SDCC 2017 Shanghai conference and includes discount codes, which is an advertisement rather than technical content.
Architecture Digest
Focusing on Java backend development, covering application architecture from top-tier internet companies (high availability, high performance, high stability), big data, machine learning, Java architecture, and other popular fields.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.