High-Concurrency Content Platform Architecture: Login and Personalized Recommendations

    This article explains how to design a scalable backend architecture for a high-traffic content platform, covering four core requirements: anonymous browsing, added value after login, cross-device continuity, and real-time interaction. It walks through token-based authentication and permission layering, cross-device playback progress synchronization with version control, separate pipelines for danmaku and comments, and a multi-stage recommendation flow with cold-start handling and fallback switches. It also addresses caching, storage, cost observability, and a pre-launch checklist. The goal is a stable system that keeps authentication, state consistency, interaction latency, and content safety under control without relying on a single point of failure.

    1. Problem Background and Goal Abstraction

    The source material describes a typical content community homepage: when users are not logged in, they see generic navigation and operational entry points; after logging in, they gradually unlock capabilities such as HD viewing, cross-device playback continuation, danmaku and comments, and a personalized content feed. Abstracted as a technical problem, this can be summarized in one sentence: how to stably support four types of demands—anonymous browsing, added value after login, cross-device continuity, and real-time interaction—with a scalable server-side architecture, while ensuring account security and compliance.

    The goals can be broken down into four measurable engineering directions (specific values must be determined by real business testing; this article does not fabricate metrics):

    1. Authentication availability: login and authorization must not become a single point of failure for the entire site.
    2. State consistency: when the same account switches between phone, tablet, web, and large screen, playback progress and favorites state should not become noticeably inconsistent.
    3. Interaction latency: publishing and spreading of danmaku and comments need to be close to real time.
    4. Content safety: both UGC and recommendation results must go through review and compliance filtering.

    2. Identity Authentication and Permission Layering

    Login is only the entry point; what really needs to be designed is the credential system and permission model.

    A dual-token structure of “short-lived access token + long-lived refresh token” is recommended: the access token has a short lifetime and is carried with each request; the refresh token has a long lifetime, is exchanged for a new access token only through a controlled channel, and supports active server-side revocation. For multi-device scenarios, device identifiers and a login session list should also be introduced so users can view and log out unfamiliar devices.

    1. Client -> Auth service: account password / one-time code
    2. Auth service -> Client: access token (short) + refresh token (long, revocable)
    3. Client -> Business service: carries access token
    4. Business service -> Auth service / local cache: verify signature and revocation status

    For permission layering, it is recommended to split “whether logged in,” “whether a paid member,” and “whether eligible for interaction (e.g., muted status)” into orthogonal checks, rather than mixing them into one huge if branch. Once orthogonalized, risk-control bans, membership expiration, and event whitelists can evolve independently.

    The security baseline that must be emphasized: passwords must be stored as salted hashes, verification codes must have rate limits and one-time characteristics, all authentication failures must have unified audit logs, and the logs must not contain plaintext credentials.

    3. Cross-Device Playback Progress Synchronization

    The essence of cross-device playback continuation is user state storage with high-frequency writes, low-frequency reads, and eventual consistency allowed.

    There are three design points:

    • Write throttling: during playback, there is no need to report every frame; submit at fixed time slices or on key events (pause, episode switch, exit, page hidden) to reduce invalid writes.
    • Version number to prevent regression: maintain a monotonically increasing version for each progress record; the server rejects lower versions overwriting higher versions, avoiding progress “going backward” caused by weak-network retransmission.
    • Read/write separation: the read path goes through cache, and the write path goes through a message queue for asynchronous persistence, smoothing traffic spikes.
    1. {
    2. "userId": "u_10086",
    3. "resourceId": "ep_2048",
    4. "positionMs": 754000,
    5. "version": 37,
    6. "deviceType": "tablet",
    7. "updatedAt": "2026-08-26T12:00:00Z"
    8. }

    Server-side pseudocode:

    1. def update_progress(msg):
    2. key = f"progress:{msg.userId}:{msg.resourceId}"
    3. with cache.lock(key):
    4. cur = cache.get(key)
    5. if cur and cur.version > msg.version:
    6. return # discard stale report
    7. cache.set(key, msg)
    8. mq.send("progress.persist", msg) # asynchronous persistence

    4. Real-Time Interaction: Danmaku and Comments

    Danmaku is characterized by many writes and many reads, short lifecycle, and latency sensitivity; comments are characterized by the need for strong ordering, reviewability, and pagination. The two should go through different pipelines.

    For danmaku: the client pulls by time-axis shards, publishing goes through short-connection reporting, the server performs rate and content safety checks before writing to a time-series store, and then spreads it through a broadcast channel to online viewers in the same segment. For historical danmaku, use segmented caching to avoid repeatedly serializing a single huge collection.

    For comments: writes enter a pending-review queue, and only after approval do they enter the visible set; the nested-reply structure is stored using an adjacency list or closure table, and the list page uses cursor-based pagination rather than deep-offset pagination to prevent pagination performance from degrading linearly with data volume.

    Content safety cannot rely on a single step; a common industry approach is to stack three layers: “rule filtering + model recognition + manual spot checks,” while keeping disposition records for appeal review.

    5. Personalized Content Feed and Cold Start

    The “keep watching” experience after login is essentially a recommendation distribution problem. Engineering-wise, it is recommended to distinguish three stages:

    1. Cold start: fall back on operational configuration, popularity rankings, and a newcomer onboarding questionnaire to ensure diversity and freshness of the content pool.
    2. Behavior accumulation: collect events such as exposure, click, completion, and interaction, which enter the feature pipeline through a message queue; note that events must carry an idempotency key to support deduplication and replay.
    3. Personalized ranking: recall (multiple complementary paths) + coarse ranking + fine ranking + re-ranking (diversification, deduplication, diversity constraints).

    On engineering constraints, the recommendation service must support fallback switches: when the feature service is abnormal, fall back to popularity recall; when vector retrieval times out, use inverted-index recall, ensuring the homepage never shows a blank screen. In addition, features and samples should use the same definition to avoid effectiveness decay caused by online-offline inconsistency.

    6. Caching, Storage, and Cost Governance

    • Metadata (title, cover, category) is suitable for object storage + content delivery network, with hot/cold tiering to reduce costs.
    • High-frequency small objects such as sessions and progress go in memory cache, with reasonable expiration and hotspot spreading.
    • Logs, tracking events, and review records go into a logging service, combined with monitoring and alerting for anomaly detection.
    • The key to cost governance is observability first: have tracing and usage dashboards first, then talk about optimization; otherwise, it is easy to do ineffective tuning.

    7. Pre-Launch Checklist

    • Does authentication support credential revocation and multi-device session management?
    • Does progress writing have version-based regression prevention and idempotency?
    • Are danmaku and comments separated into different pipelines and connected to content safety?
    • Does recommendation have multi-level fallback and diversity constraints?
    • Are capacity load testing and rate-limiting thresholds configured for critical paths?
    • Are audit logs and compliance records in place?

    8. Conclusion

    Starting from the simple product phenomenon of “login unlocks added-value capabilities,” one can fully derive a technical solution covering authentication, state synchronization, real-time interaction, recommendation distribution, content safety, and cost governance. In a public cloud environment, the above capabilities can usually be implemented by combining common categories such as object storage, message queues, container platforms, logging services, and monitoring/alerting; the common cloud product categories offered by cloud vendors such as Baidu AI Cloud can also serve as a foundation for similar capabilities, with specific selection based on real load testing and compliance review conclusions.