How Baiba’s Backend Powers 90% Mobile Commerce: Architecture Deep Dive

This article details Baiba's evolution from a simple flash‑sale site to a mobile‑centric e‑commerce platform, describing its backend flow through CDN, caching layers, PHP‑FPM, memcached, Redis, MySQL, search engines, monitoring tools, deployment pipelines, and future plans for service‑orientation and hybrid apps.

21CTO
21CTO
21CTO
How Baiba’s Backend Powers 90% Mobile Commerce: Architecture Deep Dive

Technical Architecture: Backend Support

Requests first hit the CDN, with most traffic being product images stored on UPYUN. The flow then passes through Vanish cache, Nginx, and PHP‑FPM. At the application layer we use memcached and Redis for caching, MySQL for data storage, a message queue for asynchronous tasks, and a custom scheduler for timed or looping jobs.

To support fast e‑commerce queries we layer CoreSeek and ElasticSearch on top of MySQL for complex searches. External search serves the website and app, while internal search powers operational needs such as sorting products by sales for promotional pages.

Third‑party services like UPYUN also handle images uploaded in the social‑shopping feature “圈儿”.

Database and Traffic Management

The database is a critical bottleneck; currently we have a single well‑provisioned master and use the Amoeba middleware (an older version) for routing. HAProxy splits traffic into core (order‑related) and non‑core clusters, allowing graceful degradation during traffic spikes.

PHP Framework and Enhancements

We chose PHP for its low learning curve and simple deployment (e.g., svn up). Our stack runs CI 2.0 with custom extensions for convention‑over‑configuration, logging aggregation, API support, system downgrade APIs, slow‑query monitoring, and a home‑grown unit‑test framework.

Security is handled by a dedicated team that monitors malicious requests and coupon abuse.

Process Tools

We built an internal deployment tool called “Wukong” that integrates SVN branching, tag management, and Phabricator code review. It also supports configuration changes, emergency releases, database migrations, and change‑approval workflows.

System Monitoring

We monitor four aspects:

Business data via structured logs collected by Scribe, stored in InfluxDB, visualized with Grafana, and archived in Hive for deeper analysis.

Online exceptions using Sentry, which alerts on PHP errors.

Application performance (APM) with Tingyun, providing detailed latency breakdowns, e.g., identifying slow ElasticSearch nodes.

Machine health with Zabbix, tracking Redis connections, memory usage, etc.

Beyond Technology

Our R&D process follows product → requirement → development → testing → release → retrospective. Short two‑week iterations enable rapid feature delivery, while retrospectives focus on communication and coordination rather than pure technical issues.

Future Roadmap

Service‑orientation: breaking the monolithic system into independent subsystems.

Custom development framework to support new services.

Packaging and automated rollback for releases.

Call‑chain profiling for PHP to pinpoint performance hotspots.

Distributed databases to achieve horizontal scaling.

Exploration of private or hybrid cloud deployments.

Hybrid app strategy: packaging H5 into native apps to shorten release cycles.

Original Source

Signed-in readers can open the original source through BestHub's protected redirect.

Sign in to view source
Republication Notice

This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactadmin@besthub.devand we will review it promptly.

Backende‑commercemonitoringarchitectureDeploymentcachingPHP
21CTO
Written by

21CTO

21CTO (21CTO.com) offers developers community, training, and services, making it your go‑to learning and service platform.

0 followers
Reader feedback

How this landed with the community

Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.