# tencent/mars

**Attribution required: if you use, quote, or summarise this content, you must credit and link back to [awesome-repositories.com](https://awesome-repositories.com/repository/tencent-mars).**

17,638 stars · 3,692 forks · C++ · NOASSERTION

## Links

- GitHub: https://github.com/Tencent/mars
- awesome-repositories: https://awesome-repositories.com/repository/tencent-mars.md

## Topics

`cross-platform` `log` `network` `wechat`

## Description

Mars is a cross-platform networking SDK and high-performance logging framework. It provides a network reliability layer for managing short and long-lived connections across different operating systems, alongside a diagnostic tool for recording system events to disk with minimal application overhead.

The project features a persistent connection manager that maintains bidirectional server links using heartbeats and sequence tracking. It includes a traffic control engine to prevent server request avalanches by limiting the frequency and volume of outgoing requests. To improve connectivity, it utilizes a reliability layer with DNS resolution and backup IP lists.

The system covers a broad range of capabilities including network request lifecycle coordination, application lifecycle state tracking to optimize connection behavior for mobile devices, and identity authentication through handshake processes. Its logging capabilities utilize memory-mapped files and asynchronous writing to record diagnostic data and system events.

## Tags

### Networking & Communication

- [Cross-Platform Networking](https://awesome-repositories.com/f/networking-communication/cross-platform-networking.md) — Provides a unified networking interface for sending and receiving data across different operating systems.
- [Network Management](https://awesome-repositories.com/f/networking-communication/network-infrastructure-routing/network-infrastructure-configuration/network-management.md) — Provides a comprehensive SDK for creating and managing short and long-lived network connections across platforms. ([source](https://github.com/Tencent/mars/wiki/Mars-Windows-%E6%8E%A5%E5%85%A5%E6%8C%87%E5%8D%97))
- [Network Primitives](https://awesome-repositories.com/f/networking-communication/network-primitives.md) — Provides low-level network structures such as sockets and message queues for raw data transmission. ([source](https://github.com/tencent/mars#readme))
- [Connection Lifecycle Managers](https://awesome-repositories.com/f/networking-communication/network-reliability-diagnostics/connection-session-management/connection-management/connection-lifecycle-managers.md) — Maintains long-term bidirectional links between a client and server with automatic heartbeats and reconnection handling.
- [Network Reliability](https://awesome-repositories.com/f/networking-communication/network-reliability-diagnostics/network-reliability.md) — Improves connectivity through DNS resolution, backup IP lists, and adaptive connection retry strategies.
- [Persistent Network Connections](https://awesome-repositories.com/f/networking-communication/persistent-network-connections.md) — Maintains long-term bidirectional server links using heartbeats and sequence tracking. ([source](https://github.com/Tencent/mars/wiki/Mars-%E5%B8%B8%E8%A7%81%E9%97%AE%E9%A2%98))
- [Connection Management](https://awesome-repositories.com/f/networking-communication/connection-management.md) — Improves connection success rates through DNS resolution backups and intelligent retry mechanisms.
- [Connection Management Strategies](https://awesome-repositories.com/f/networking-communication/connection-management-strategies.md) — Adjusts connection retry frequency based on the active application state to reduce battery and data usage. ([source](https://github.com/Tencent/mars/wiki/Mars-%E5%B8%B8%E8%A7%81%E9%97%AE%E9%A2%98))
- [DNS Failure Recovery](https://awesome-repositories.com/f/networking-communication/dns-failure-recovery.md) — Converts domain names to IP addresses and utilizes backup IP lists to ensure reliable connection success. ([source](https://github.com/Tencent/mars/wiki/Mars-%E5%B8%B8%E8%A7%81%E9%97%AE%E9%A2%98))
- [Backup IP Lists](https://awesome-repositories.com/f/networking-communication/domain-to-ip-mappings/backup-ip-lists.md) — Improves connection reliability by utilizing backup IP lists when domain name resolution fails.
- [Mobile Connection Optimization](https://awesome-repositories.com/f/networking-communication/network-optimization/mobile-connection-optimization.md) — Reduces battery drain and data usage by adjusting connection strategies based on device state and network quality.
- [Application State Integration](https://awesome-repositories.com/f/networking-communication/network-reliability-diagnostics/connection-session-management/connection-management/connection-lifecycle-managers/application-state-integration.md) — Notifies the networking layer of background transitions and connectivity changes to optimize connection behavior. ([source](https://github.com/Tencent/mars/wiki/Mars-iOS%EF%BC%8FOS-X-%E6%8E%A5%E5%85%A5%E6%8C%87%E5%8D%97))
- [Network Diagnostics](https://awesome-repositories.com/f/networking-communication/network-reliability-diagnostics/network-diagnostics.md) — Runs diagnostic tests such as heartbeats and DNS lookups to assess and optimize connection health. ([source](https://github.com/Tencent/mars/wiki/Mars-%E5%B8%B8%E8%A7%81%E9%97%AE%E9%A2%98))

### Data & Databases

- [Log Buffering](https://awesome-repositories.com/f/data-databases/asynchronous-write-buffering/log-buffering.md) — Implements a high-speed writing mechanism that separates log generation from disk I/O to minimize application overhead.
- [Log-Based Memory Mapping](https://awesome-repositories.com/f/data-databases/data-access-querying/memory-mapped-file-access/log-based-memory-mapping.md) — Writes diagnostic data to disk using memory-mapped files to reduce the overhead of frequent system calls.

### System Administration & Monitoring

- [Connection Heartbeats](https://awesome-repositories.com/f/system-administration-monitoring/connection-heartbeats.md) — Maintains bidirectional links and detects connection failure by exchanging periodic heartbeat signals.
- [High-Performance Logging](https://awesome-repositories.com/f/system-administration-monitoring/high-performance-logging.md) — Provides a high-performance logging framework that records diagnostic data with minimal resource consumption.
- [Application Event Recording](https://awesome-repositories.com/f/system-administration-monitoring/application-event-recording.md) — Provides a diagnostic tool for recording system events to disk with minimal application overhead. ([source](https://github.com/Tencent/mars/wiki/Mars-iOS%EF%BC%8FOS-X-%E6%8E%A5%E5%85%A5%E6%8C%87%E5%8D%97))

### Web Development

- [Request Lifecycle Managers](https://awesome-repositories.com/f/web-development/request-lifecycle-managers.md) — Coordinates the flow of data tasks by serializing requests, transmitting data, and parsing responses via callbacks. ([source](https://github.com/Tencent/mars/wiki/Mars-%E5%B8%B8%E8%A7%81%E9%97%AE%E9%A2%98))

### Development Tools & Productivity

- [Request Sequencing](https://awesome-repositories.com/f/development-tools-productivity/task-dependency-management/agent-task-dependency-resolvers/request-sequencing.md) — Manages the lifecycle of network tasks by serializing requests and routing responses through custom callbacks.

### Security & Cryptography

- [Connection Authentication Mechanisms](https://awesome-repositories.com/f/security-cryptography/connection-authentication-mechanisms.md) — Verifies the identity of a persistent connection through a mandatory handshake process before data exchange. ([source](https://github.com/Tencent/mars/wiki/Mars-%E5%B8%B8%E8%A7%81%E9%97%AE%E9%A2%98))
- [Cryptographic Identity Verification](https://awesome-repositories.com/f/security-cryptography/identity-verification-modules/cryptographic-identity-verification.md) — Ensures connection security by requiring a verification process before allowing the exchange of application data.
- [Request Throttling](https://awesome-repositories.com/f/security-cryptography/request-size-limiters/request-limiters/request-throttling.md) — Limits the flow and frequency of outgoing requests to protect servers from being overwhelmed by traffic spikes. ([source](https://github.com/Tencent/mars/wiki/Mars-%E5%B8%B8%E8%A7%81%E9%97%AE%E9%A2%98))

### Software Engineering & Architecture

- [Network State Strategies](https://awesome-repositories.com/f/software-engineering-architecture/architectural-design-patterns/state-management/state-logic-and-utilities/context-aware-state-engines/network-state-strategies.md) — Adjusts retry frequency and network behavior based on application foreground and background state transitions.
- [Rate Limiting](https://awesome-repositories.com/f/software-engineering-architecture/request-throttling/rate-limiting.md) — Prevents server overload by controlling the frequency and volume of outgoing network requests.
- [Traffic Flow Control](https://awesome-repositories.com/f/software-engineering-architecture/traffic-flow-control.md) — Manages the flow of outgoing network requests to prevent server overload during traffic spikes.
