Run python! on Grumpy:go

Source: Internet
Author: User
Tags hhvm

Google runs millions of lines of Python code to drive YouTube.com and the YouTube API's front-end server, which can provide millions requests per second! YouTube's front-end runs on CPython 2.7, so we've put in a lot of work to improve the runtime and make our applications work well with them. These efforts have yielded a lot of results over the years, but one problem has not been solved: high concurrency, high workload work is difficult to run well on CPython.

To solve this problem, we looked at a number of other Python runtimes. Each has a tradeoff, does not resolve concurrency issues, and does not introduce other issues.

So we have a crazy idea: what if we implement a real-time service that replaces runtime optimization? Go seems to be a smart platform choice because its operational characteristics match our use cases (such as lightweight threading) nicely. We want first-class language interoperability, and go's powerful runtime type reflection system makes this very simple, and Python will be natural on go, so grumpy was born.

Grumpy is a Python to Go source code compiler and runtime, designed to replace CPython 2.7.

The key difference is that it compiles the Python source code into the Go source code, and then compiles it into native code instead of bytecode. This means that grumpy does not have a VM. The compiled go source code is a series of calls to the grumpy runtime, and the Go Library service is similar to the Python C API (although it does not directly support the C API).

Some content compiled from: opensource.googleblog.com

Dylan Trotter,youtube Project

Http://www.oschina.net/news/80693/go-running-python

------------------------------------------------------------------------------------

Https://github.com/google/grumpy

Ben Linders, who works for Ali, now dominates similar projects (HIPHOP) when he works on Facebook.
is to use HPHPC to convert the PHP code into C + + code, and then use g++ compiled into machine code to execute.
Later practice found that this is not conducive to deployment and debugging, so back to the idea of the VM, made HHVM (based on LLVM JIT).
Later, PHP's official development of PHP7 and Zend-jit is a strong response to HHVM.

In fact Mr Chen they started with PHP to develop YouTube, it was later changed to Python.
Https://www.quora.com/Which-Python-web-framework-was-YouTube-built-with-when-they-started-off
Contrary to popular belief, YouTube is first built with PHP if it started, and not Python.

Looked carefully, found that the project is really not simple, incredibly can go directly with the standard library, afraid of

From __go__.net.http import Listenandserve, Redirecthandler

Handler = Redirecthandler (' http://github.com/google/grumpy ', 303)
Listenandserve (' 127.0.0.1:8080 ', handler)

Run python! on Grumpy:go

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.