explaingit

weibocom/motan

5,882JavaAudience · developerComplexity · 4/5LicenseSetup · hard

TLDR

Motan is Weibo's RPC framework that lets services written in Java, Go, PHP, and Lua call each other over a network as easily as calling a local function, with built-in service discovery and load balancing.

Mindmap

mindmap
  root((motan))
    What it does
      RPC framework
      Service discovery
      Load balancing
      Cross-datacenter routing
    Tech stack
      Java core
      Go companion
      PHP companion
      Zookeeper or Consul
    Use cases
      Microservice comms
      Async RPC calls
      Multi-language services
    Setup
      Maven dependency
      XML config
      Registry required
Click or tap to explore — scroll the page freely

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

Things people build with this

USE CASE 1

Connect microservices in different languages so they can call each other without writing manual network code.

USE CASE 2

Spread traffic automatically across multiple server instances using built-in load balancing.

USE CASE 3

Route service calls across data centers with automatic failover when a service goes down.

USE CASE 4

Replace hand-rolled HTTP calls between services with typed, auto-discovered remote procedure calls.

Tech stack

JavaGoPHPLuaZookeeperConsulMaven

Getting it running

Difficulty · hard Time to first run · 1h+

Requires a running Zookeeper or Consul instance for service discovery before any RPC calls work.

Use freely for any purpose, including commercial use, keep the copyright notice and the Apache 2.0 license file.

In plain English

Motan is a framework built by Weibo (the Chinese social media company) that lets separate software services talk to each other over a network as if they were calling a local function. The underlying idea is called RPC, remote procedure call, which means one program can trigger a function in another program running on a different machine without needing to manually manage the network communication in between. The framework works across multiple programming languages. The core is written in Java, but companion projects cover Go, PHP, and Lua, so teams using different languages can still communicate through the same system. This matters when a company runs many services built in different languages and needs them to coordinate reliably. Motan handles several things that would otherwise be painful to build from scratch. It connects to service-discovery tools like Consul or Zookeeper, which are directories that keep track of where each service is running so callers can find them automatically. It also manages load balancing, spreading requests across multiple server instances, and can route traffic across different data centers. Both synchronous calls (wait for a reply before continuing) and asynchronous calls (send the request and move on) are supported. Setting up a basic server and client requires adding a few dependencies to a Java project and writing short XML configuration files that declare which service to expose and where to find it. The README walks through this step by step with working code examples, including how to enable async mode with a single annotation. The project is open source under the Apache 2.0 license and available on Maven Central, the standard package registry for Java projects.

Copy-paste prompts

Prompt 1
I'm using Motan in a Java project. Write the XML configuration that exposes a UserService over Motan with Zookeeper as the registry, and the matching client config to call it.
Prompt 2
Show me how to make an async Motan RPC call in Java using the @MotanAsync annotation so I don't block the calling thread.
Prompt 3
I have services in Java and Go that need to talk via Motan. What are the steps to set up cross-language RPC using the motan-go companion project?
Prompt 4
Help me configure Motan to load balance across 3 server instances and automatically reroute traffic to a backup data center on failure.
Open on GitHub → Explain another repo

← weibocom on gitmyhub — every repo by this author, as a profile.

Verify against the repo before relying on details.