ChinAI 106: Douyu Open Sources Jupiter — a Microservices Architecture
Plus, US-China relations and "the security of many stories"
Greetings from a world where sweatpants are forever…
…For the first time, we’ve had a net drop in subscribers in the past few weeks, so if you are willing and able to support keeping ChinAI content free for all, please please subscribe here to support ChinAI under a Guardian/Wikipedia-style tipping model (everyone gets the same content but those who can pay support access for all AND compensation for awesome ChinAI contributors). As always, the archive of all past issues is here.
Feature Translation: Douyu’s Jupiter, an open-source microservices framework
In Q2 of this year, people watched 5 billion hours of livestreams on Twitch, 56% more than Q1 (stay at home folks!). This is 2 billion hours more than Q2 from last year! Now here’s your weekly pop quiz: which Chinese company has more monthly active users (MAUs) than Twitch?
This week’s feature translation unpacks the tech stack of Douyu (斗鱼), the largest video live-streaming platform in China with 160 million monthly active users in 2019, about 20 million more than Twitch. *Not to be confused with the short video app Douyin (抖音), of which TikTok is the international version.
CONTEXT: Last month in June, Douyu open-sourced Jupiter, a microservices framework based on the Go language. OSChina, a very cool Wechat platform, talked with Lu Chao, an R&D engineer in Douyu’s Go team, to review Jupiter’s open source process as well as how Douyu’s technology stack has changed in recent years.
TECHNICAL TRANSLATION. This issue involves a lot of software development jargon, so let’s learn a little about: microservices:
In contrast to a “monolithic architecture” in which a small update to one part of an app service requires all other parts of an app to adjust, a “microservices architecture” means that individual services have their own code and talk to each other through APIs (application programming interfaces). Douyu, for example, probably has one service that stores all the data on livestreams you’ve watched, one that deducts payments, one that manages Internet traffic and buffering, and another that uses algorithms to recommend livestreams.
This approach was pioneered by Netflix, as Mayukhh Nair explains in a 2017 Medium post:
Netflix literally ushered in a revolution around ten years ago by rewriting the applications that run the entire service to fit into a microservices architecture — which means that each application, or microservice’s code and resources are its very own. It will not share any of it with any other app by nature. And when two applications do need to talk to each other, they use an application programming interface (API) — a tightly-controlled set of rules that both programs can handle. Developers can now make many changes, small or huge, to each application as long as they ensure that it plays well with the API. And since the one program knows the other’s API properly, no change will break the exchange of information.
The result: an ecosystem that allows a small team of operations engineers to quickly iterate changes in specific parts of the Netflix ecosystem without risking breakdowns to the entire service.
Douyu initially adopted a Go-based microservices architecture at the end of 2016. Jupiter was built on top of this original framework. Go or Golang is an open-source language, developed by a team at Google, that helps programmers write flexible and modular applications. Per OSChina, Go is known as the “container language of the cloud native era.” (云原生时代的容器语言)
The two mainstream microservices architectures on the market are Dubbo and Spring Cloud. Dubbo, a java-based RPC framework first open-sourced by Alibaba (interesting!) in 2011, was donated to Apache in 2017. Since then, the number of times it has been “Starred” on Github increased by 7429 in just 7 months (ranked 11th in Java category at Github). It’s also received recognition as a top open source software at Chinese conferences.
For more on what a RPC framework means, h/t to Girish Sastry, a researcher (policy) at OpenAI for sharing this explanation with me.
Also interesting: the list of companies that are using Dubbo are all heavy-hitter Chinese companies, including Alibaba, ICBC, and Didi Chuxing.
Jupiter is meant to be a complement to RPC frameworks like Dubbo. For instance, inside Douyu, the Java team uses the Dubbo framework and Jupiter provides a way for the Go-based applications to talk to the Dubbo-based services.
KEY TAKEAWAYS:
Jupiter itself seems pretty impressive and has gotten a lot of feedback from contributors. The article notes that Jupiter’s Github has 1066 stars. Now, it has 2100 stars. When released, it was a trending Github project on June 3, 2020. One of the benefits of an OS project is a community to help maintain and improve code.
Jupiter is also another indicator of the growing momentum for open source in China. We’ve previously covered a White Paper on China’s Development of AI Open Source Software in ChinAI #22.
The diffusion of technology is not just technical, it’s organizational. Douyu started out using PHP and only switched to Go after rapid growth in the scale of the business, which required splitting up their engineering teams. Lu Chao cites Conway’s law to explain why Douyu switched: “organizational structure determines technical architecture.”
Hey now, isn’t this a newsletter about AI? Well, microservices have been described as the operating system for AI, helping to solve problems with putting trained machine learning models into production: “When you have tens of thousands of model versions, each written in any mix of frameworks and exposed as REST API endpoints, and your users love to chain algorithms and run ensembles in parallel, how do you maintain a latency less than 20 ms on just a few servers?” A microservices architecture may be particularly suitable for increasing the scalability of AI applications, which often are composed of a multi-language stack in which data processing uses one language and modeling uses another.
FULL TRANSLATION: Douyu’s Jupiter, an open-source microservices framework
Reflection: US-China Relations and the “Security of Many Stories”
There is not a single English-language article about Douyu’s Jupiter. Yet I could convincingly make the case to you that stories like the one above about Douyu are just as important as the ones about Douyin’s forays with TikTok in the US. This gap in coverage relates to what I think is the most troubling trend in coverage of U.S.-China relations — what Chimamanda Adichie labeled years ago as “The Danger of a Single Story.”
Of course, aside from how the great power tech competition trajectory has sucked all the oxygen out of the room, there are a lot of reasons why stories about Douyu’s Jupiter don’t get told. One of these, to put it bluntly, is that US-China tech relations are being conducted and covered by lay people (like me) who don’t understand how technology actually works in key settings.
Consider this bizarre quote by American officials justifying Trump’s executive order on Wechat, taken at face value by two veteran NYT national security reporters:
WeChat is not widely used in the United States, except for by one key group — Chinese-born software engineers in Silicon Valley and other high-tech work forces, according to American officials. They use WeChat to collaborate on tough mathematical, software or engineering problems, trading solutions back and forth. Proprietary data can be scooped up by Chinese intelligence services, an American official said.
Let’s leave aside all the issues with the statement that “Chinese-born software engineers” are the key group that use Wechat in the United States. Actually, can I say one thing? For the love of God, can the U.S. newspaper of record please hire some people who have actually used WeChat or know people who use WeChat. And maybe also some people who drink bubble tea, if that’s not asking too much!
If these reporters and officials would have read this week’s feature translation or knew anything about how modern-day tech development worked, they would realize that you don’t trade solutions to tough engineering problems over Wechat. Much of it is done through open source platforms like Github, just like the Jupiter example covered above. It’s yet another example of the Trump administration’s 20th century approach to technology control. Again, as the Jupiter case shows, the tough part of adopting technological innovations is not so much in the blueprints or the IP; it’s the organizational and tacit knowledge.
More importantly, the danger of the single story of U.S.-China DECOUPLING! is that we get blinded to stories about how open source software could actually couple the U.S.-China tech ecosystems even more tightly together. The open source software movement, which is not slowing down anytime soon, is streamlining and standardizing software globalization. Open up a tutorial of the Go programming language, and you are greeted with:
“Hello 世界 (World)”
Each day hundreds of researchers and reporters think and write about AI solely in the context of two AI superpowers. On many days, I’d count myself among them. But how many stories get written about how neural machine translation could bring the U.S. and China even closer together? It’s not like we don’t have good evidence to ground these potential narratives. Econometric studies have proven that the introduction of machine translation systems has a significant effect on international trade.
Among “China-watchers” it feels like there are some resign themselves to the Trump admin’s “fuck China” strategy as a normal re-adjustment. “It is what it is”: This is a new Cold War, and we are destined to repeat history. But history is always being reshaped and changed. That’s why we can draw on a diversity of historical analogies for this current moment. And if history is what we make of it, why can’t the present and the future be just as malleable? Drawing inspiration from the TikTok teens, it is possible to create alternative memes. Why can’t the story of the U.S. and China as #coupledforlife be just as true as the one of #decoupling?
To draw on the feature translation about Jupiter one last time, we should be wary of monolithic architectures in U.S.-China relations. In ChinAI #90 I described one of my biggest worries as:
a neoconservative-stye co-option of U.S.-China policy. Basically, the Wolfowitz Doctrine but applied to U.S.-China relations instead of the Iraq War. A key component of that failure mode would be the rise of a small group of people who become the architects of U.S.-China policy and who all read the same narratives about US-China relations — they become insulated from the wider body of discourse and debate about U.S.-China relations.
This failure mode describes the Trump administration’s approach to TikTok, WeChat, and its general China strategy. What’s the solution? Neither Sway nor I have the answers, but one starting point would be to take a page from Jupiter’s notebook and strive for a distributed microservices approach to analyzing U.S.-China relations. In this ideal world, there would be a diversity of news organizations, blogs, think tanks, and individuals all telling different pieces of the U.S.-China story. It would be a polyglot (multiple programming languages) tech stack — some would focus on Chinese-language coverage, others on Japanese, etc. And we wouldn’t have arbitrary dichotomies separating China hawks and China doves, which entrench echo chambers. After all, a key part of microservices governance are the communication protocols that connect different code bases.
I’m truly hopeful we can avoid the danger of the single story and seek the security that comes from many stories. Call me naive. I can take it. But there’s a reason we will tell our kids fairy tales until the end times. Sometimes it’s okay to believe in a better 世界.
Thank you for reading and engaging.
*I’m behind on my reading so had to skip Four to Forward this week — will make up for it next week.
These are Jeff Ding's (sometimes) weekly translations of Chinese-language musings on AI and related topics. Jeff is a PhD candidate in International Relations at the University of Oxford and a researcher at the Center for the Governance of AI at Oxford’s Future of Humanity Institute.
Check out the archive of all past issues here & please subscribe here to support ChinAI under a Guardian/Wikipedia-style tipping model (everyone gets the same content but those who can pay for a subscription will support access for all).
Any suggestions or feedback? Let me know at chinainewsletter@gmail.com or on Twitter at @jjding99
Great article. The whole "fuck china" mentality in the US is ultimately about how their government does the same in banning services (though often for reasons beyond a fuck USA mentality) and how much of US IP has in fact been stolen or ripped off in the absence of access. Though the politicians may not understand the issues deeply, their general idea that they should protect their companies is a very understandable one.