
Mars – A cross-platform network component developed by WeChat - qixinghaitang
https://github.com/Tencent/mars
======
johnhenry
Pardon my ignorance, but I tried reading through the page and could not figure
out what this is or does. Can someone point me to a quick summary or overview?

~~~
wjruoxue
It has a lot of overlaps with other network frameworks such as OkHttp,
AFNetworking, cronet, etc., but I think it main contributions are these two
components:

Xlog: in memory mmap log for fast logging and also supports encryption. Xlog
log enables them to log everything fast and "safely" even in production build
to quickly identify bugs.

STN: short and long TCP connection manager, which is optimized for various
networks in China.

Plus other network utilities to make development easier.

~~~
virmundi
Out of curiosity, is XLog better than the app simply logging everything to STD
out, then let the invoker worry about the storage?

~~~
wjruoxue
Depends on what the invokers wants. If the invoker only wants to log things to
disk and read those logs later, surely he can do it himself. What XLog
provides for the invoker under the hood is essentially performance: the
invoker can log lots of things and does not need to worry about IO speed, disk
space, and log safety. And of course it's cross platform. A detailed
performance analysis is here (in Mandarin Chinese):
[http://mp.weixin.qq.com/s/cnhuEodJGIbdodh0IxNeXQ](http://mp.weixin.qq.com/s/cnhuEodJGIbdodh0IxNeXQ)

------
sandGorgon
This looks like a cross between OkHTTP and a jobqueue (like
[https://github.com/WhisperSystems/jobmanager](https://github.com/WhisperSystems/jobmanager)
or [https://github.com/yigit/android-priority-
jobqueue](https://github.com/yigit/android-priority-jobqueue)).

But I think this is the first cross platform framework that does this.

~~~
piracyde25
Can you explain what is the definition of cross platform here, I mean in which
part of it is "cross-platform"? Is Realm also consider a cross-platform
database solution for mobile?

~~~
sandGorgon
The library itself claims to be cross platform. It has libraries available for
iOS/Android/windows mobile.

I'm not sure about Realm..But I was talking in context of the job manager and
network libraries.

But I suppose you could SQLite as cross platform.

------
tluyben2
I hope this contains the code that makes Wechat connections work so well on
the often intermediate/slow/bad connections in China. Because then most
companies can learn something from it (looking at Skype, Slack etc here which
are horrible with bad connections).

~~~
neximo64
Im surprised no one brings up how bad Slack's infrastructure or backend design
is. It's my slowest app from launch to signed in and can see the latest
message.

In the old days MSN messenger was faster.

~~~
mercer
So it's not just me! I have issues with Slack quite regularly, from messages
simply not appearing on web (usually iOS works fine) to the app not being able
to reconnect without a hard refresh. Add to that the slow 'boot-up' and memory
usage and all in all the experience is quite disappointing, especially for
such a loved product where good connectivity should be a core requirement.

~~~
tluyben2
I think I read somewhere the client is hybrid? That does not explain the very
bad connectivity but could explain boot up and memory. I find it quite weird
that so many techies adore it to be honest.

~~~
mercer
Oh yeah, it's most definitely a 'web app' packaged as an executable.

I mean, I get why people like it. When it works it's a pretty decent
experience (and I grew up with IRC).

------
nullnilvoid
Great to see a open source project from WeChat. WeChat is extremely viral in
China. I am sure there is some amazing engineering work underneath.

~~~
org3432
The language barrier has been their main issue, they'd definitely would love
to collaborate more with teams outside of China I know. They have an
astonishing amount of dev resources as well, they wrote an entire cloud
platform (they're at maybe 10% of AWS) from scratch, in C.

~~~
dm3730
> entire cloud platform (they're at maybe 10% of AWS) from scratch, in C

Impressive. Any link to this? I'd love to take a look.

~~~
org3432
Their public cloud is [http://qcloud.com/](http://qcloud.com/), I don't think
everything they've written on the backend is public however.

~~~
kristianov
It has nothing to do with WeChat. qcloud is developed by TEG (Tech.
Engineering Group), and the cloud service for WeChat is developed by WXG
(Weixin Group).

------
chenster
What is China's Super-App "WeChat" and how China is changing your Internet
[https://www.youtube.com/watch?v=f-YuU3J-YV0](https://www.youtube.com/watch?v=f-YuU3J-YV0)

