gitwtfhub

wtf is mars?

tencent/mars — explained in plain English

Analysis updated 2026-06-24

17,631C++Audience · developerComplexity · 4/5Setup · hard

TL;DR

Mars is WeChat's open-source networking and logging library for mobile apps, providing reliable low-battery push messaging and async compressed logging on iOS, Android, macOS, and Windows.

Mindmap

mindmap
  root((mars))
    Components
      Xlog logging
      STN networking
      SDT diagnostics
      comm utilities
    Tech Stack
      C++
      Android Gradle
      iOS Python build
      zlib
    Use Cases
      Mobile chat
      Push messaging
      Network diagnostics
    Platforms
      iOS macOS
      Android Windows

Code map

Detail Auto

An interactive map of this repo's files and how they connect — its source is parsed live in your browser. Click Visualize to build it.

filefunction / class

Why would anyone build with this?

REASON 1

Build a mobile chat app with persistent server connections that reconnect automatically on flaky networks.

REASON 2

Add high-performance async logging with automatic compression and log-directory cleanup to an iOS or Android app.

REASON 3

Detect network connection failures in a mobile app and surface helpful diagnostics to the user.

REASON 4

Replace a custom networking stack with WeChat's battle-tested STN connection manager for push-style messaging.

What's in the stack?

C++PythonAndroidiOSGradlezlib

How it stacks up

tencent/marsmicrosoft/cntkapache/brpc
Stars17,63117,59717,501
LanguageC++C++C++
Setup difficultyhardhardhard
Complexity4/55/55/5
Audiencedeveloperresearcherdeveloper

Figures from each repo's GitHub metadata at analysis time.

How do you spin it up?

Difficulty · hard Time to first run · 1h+

iOS, macOS, and Windows builds require Python 3.10+ and platform-specific toolchains, Android is simpler via Gradle.

Wtf does this do

Mars is a cross-platform networking and logging component built by the WeChat mobile team at Tencent. WeChat handles billions of users, and Mars is the low-level plumbing it relies on to send small messages between phones and servers reliably while using as little battery and mobile data as possible. The project open-sources that plumbing so other apps can adopt the same approach instead of writing their own stack. Mars has four pieces. comm is a shared library of utilities such as sockets, threads, message queues, and coroutines. Xlog is a high-performance, reliable log component that writes log files asynchronously, compresses them with zlib, and automatically cleans up its log directory. SDT is a network-detection component that helps diagnose why a connection failed. STN, the largest part, is the signalling network component: it manages long-lived connections to a server (a long-link) for push-style messaging and short-link requests for one-shot calls, handles reconnection, and adapts to a mobile app's lifecycle, including background/foreground transitions and network changes. You would use Mars when building a mobile app that needs a small but reliable conversation with a backend (chat messages, signals, presence) and you care about battery and data usage on flaky mobile networks. It is suitable for small-volume data transmission, not large file transfer. The codebase is written in C++ and builds on iOS, OS X, Android, and Windows. Android integration is offered as a Gradle dependency (mars-wrapper for a quick start, mars-core or standalone mars-xlog for production), while iOS, OS X, and Windows builds use Python build scripts requiring Python 3.10 or higher.

Yoink these prompts

Prompt 1
I'm building an Android chat app and want to use Mars STN for persistent server connections. Show me the Gradle dependency setup and basic initialization code.
Prompt 2
How do I integrate Mars Xlog into my iOS app to write compressed async log files that clean themselves up automatically?
Prompt 3
Use Mars SDT in my Android app to detect network problems when a server connection fails and log a diagnostic report.
Prompt 4
What are the Python build requirements for compiling Mars on macOS or iOS, and how do I run the build script?

Frequently asked questions

wtf is mars?

Mars is WeChat's open-source networking and logging library for mobile apps, providing reliable low-battery push messaging and async compressed logging on iOS, Android, macOS, and Windows.

What language is mars written in?

Mainly C++. The stack also includes C++, Python, Android.

How hard is mars to set up?

Setup difficulty is rated hard, with roughly 1h+ to a first successful run.

Who is mars for?

Mainly developer.

View the repo → Decode another repo

This repo across BitVibe Labs

Don't trust strangers blindly. Verify against the repo.