Table of Contents
回复内容:
Home Backend Development Python Tutorial 像 Dropbox 这样从 Python 转到 Go 语言是不是新的趋势?

像 Dropbox 这样从 Python 转到 Go 语言是不是新的趋势?

Jun 06, 2016 pm 04:23 PM
python

为了更好的后端效能,Dropbox 一年前便开始从 Python 转到 Go.

> Dropbox owes a large share of its success to Python, a language that enabled us to iterate and develop quickly. However, as our infrastructure matures to support our ever growing user base, we started exploring ways to scale our systems in a more efficient manner. About a year ago, we decided to migrate our performance-critical backends from Python to Go to leverage better concurrency support and faster execution speed. This was a massive effort–around 200,000 lines of Go code–undertaken by a small team of engineers. At this point, we have successfully moved major parts of our infrastructure to Go.

Source: Open Sourcing Our Go Libraries

回复内容:

看来回答问题的多是程序员。我从一个前运维人员的角度提供一下思路。

Go从设计上就已经偏向工程化,对自动集成、部署和运维都相当友好。
当资源限制已经不再局限于一台或一组服务器后,偏工程化的编程语言会开始显现出更大的威力。
设备水平扩展的速度越快,对运维不友好的编程语言的弱点会被放大得越明显。 go本来是想吸引c++程序员,结果反而是Python程序员转go的比较多。
Python 的生态比go成熟,这在早期可以节约开发时间,但项目进行到后期阶段,项目会越来细化,复杂度会越来越高,省的开发时间就不明显了。这时候架构或性能这样的其它需求就出来了。详细情况下文有描述:
“这背后大约是200,000(二十万)行Go语言代码。此时,我们成功地把架构的大部分迁移到了Go语言。”
This was a massive effort–around 200,000 lines of Go code–undertaken by a small team of engineers. At this point, we have successfully moved major parts of our infrastructure to Go.
Dropbox 开源其 Go 语言库

另外最近node.js里express的作者TJ Holowaychuk最近也转向了golang
ExpressJS作者弃用Node.js,转向Go语言

这两个标志性事件应该会加速python和node.js 程序员向golang的转移。
附:python之父在dropbox,dropbox也是python的标杆案例之一。
tj是node.js开源社区贡献量最大的人,没有之一。
在github平台上,他的followers排在第三位,第一是linus.

=================================================================
徐酿泉,底层不熟
如果一个项目越来越大,正常而言会越来越模块化接口化,把一个性能要求高的模块重写一下算什么大事……

回复如下:
python这边使用go重构的是架构模块20多万行代码,不是仅仅性能提升。写过项目的都应该知道架构是什么意思。都应该知道架构的重要性。 估计Python程序员嫌Python太慢,又喜欢被逼着遵循特定的排版规范,所以都转向go了。
可以预见接下来go社区里会就缩进一个tab还是4个空格的问题爆发一场圣战 这个问题我要答,不邀自答。
  1. 先回答题目:是一种新的趋势,全世界都在往更“现代化”的编程语言转型,包括转到 go 以外的其它新语言。
  2. go 很难吸引到 c++ 程序员,在 c++ 程序员看来这货有点“半残”的样子,用起来难免觉得自己智力过剩。rust 更受他们欢迎,看看 rust 的第一个应用社区居然是 rust-gamedev 就知道了。
  3. @李四保 说得对,go 很符合 python 程序员的习惯、审美,而且同样不能利用多核,简直就是 python+gevent 的加强版。如果我不是 c++ 程序员出身,我也会喜欢的。
  4. 但 @柳杰 说“golang 天生就适合服务器端开发”,我表示不认同。go 的字符处理能力个人表示呵呵,做 web 开发的人甘苦自知;没有泛型支持,处理复杂的业务逻辑(如 game play)更要表示呵呵。
  5. dropbox 使用 go 的做法是对的:1、写性能相关的代码,如 hash2;2、写业务逻辑简单的代码,如 net2、caching 等。知其长,避其短,用得老道。
  6. 以上是个人愚见,欢迎探讨。但是请认识到个人是 go 黑,立场可能有偏颇。
更换语言应该是项目需要(性能或者其他)
最讨讨厌盲目跟风的 dropbox用户量已经巨大,需要更智能的语言来帮助处理复杂的分布式问题 不会只是python, golang天生就就适合服务器端开发,我们实际使用下来也比较满意,个人认为未来会成为服务器端的主流语言之一。

目前,肯定会有很多脚本语言开发的项目用golang重写,虽然golang比脚本语言要增加一些开发工作量,但性能会提高好几倍。

c/c++项目基本不会用golang重写,因为与之相比,golang性能上没有优势。开发新的项目时才会考虑用golang替代。
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

PHP and Python: Different Paradigms Explained PHP and Python: Different Paradigms Explained Apr 18, 2025 am 12:26 AM

PHP is mainly procedural programming, but also supports object-oriented programming (OOP); Python supports a variety of paradigms, including OOP, functional and procedural programming. PHP is suitable for web development, and Python is suitable for a variety of applications such as data analysis and machine learning.

Choosing Between PHP and Python: A Guide Choosing Between PHP and Python: A Guide Apr 18, 2025 am 12:24 AM

PHP is suitable for web development and rapid prototyping, and Python is suitable for data science and machine learning. 1.PHP is used for dynamic web development, with simple syntax and suitable for rapid development. 2. Python has concise syntax, is suitable for multiple fields, and has a strong library ecosystem.

PHP and Python: A Deep Dive into Their History PHP and Python: A Deep Dive into Their History Apr 18, 2025 am 12:25 AM

PHP originated in 1994 and was developed by RasmusLerdorf. It was originally used to track website visitors and gradually evolved into a server-side scripting language and was widely used in web development. Python was developed by Guidovan Rossum in the late 1980s and was first released in 1991. It emphasizes code readability and simplicity, and is suitable for scientific computing, data analysis and other fields.

Python vs. JavaScript: The Learning Curve and Ease of Use Python vs. JavaScript: The Learning Curve and Ease of Use Apr 16, 2025 am 12:12 AM

Python is more suitable for beginners, with a smooth learning curve and concise syntax; JavaScript is suitable for front-end development, with a steep learning curve and flexible syntax. 1. Python syntax is intuitive and suitable for data science and back-end development. 2. JavaScript is flexible and widely used in front-end and server-side programming.

Can vs code run in Windows 8 Can vs code run in Windows 8 Apr 15, 2025 pm 07:24 PM

VS Code can run on Windows 8, but the experience may not be great. First make sure the system has been updated to the latest patch, then download the VS Code installation package that matches the system architecture and install it as prompted. After installation, be aware that some extensions may be incompatible with Windows 8 and need to look for alternative extensions or use newer Windows systems in a virtual machine. Install the necessary extensions to check whether they work properly. Although VS Code is feasible on Windows 8, it is recommended to upgrade to a newer Windows system for a better development experience and security.

How to run sublime code python How to run sublime code python Apr 16, 2025 am 08:48 AM

To run Python code in Sublime Text, you need to install the Python plug-in first, then create a .py file and write the code, and finally press Ctrl B to run the code, and the output will be displayed in the console.

Can visual studio code be used in python Can visual studio code be used in python Apr 15, 2025 pm 08:18 PM

VS Code can be used to write Python and provides many features that make it an ideal tool for developing Python applications. It allows users to: install Python extensions to get functions such as code completion, syntax highlighting, and debugging. Use the debugger to track code step by step, find and fix errors. Integrate Git for version control. Use code formatting tools to maintain code consistency. Use the Linting tool to spot potential problems ahead of time.

Where to write code in vscode Where to write code in vscode Apr 15, 2025 pm 09:54 PM

Writing code in Visual Studio Code (VSCode) is simple and easy to use. Just install VSCode, create a project, select a language, create a file, write code, save and run it. The advantages of VSCode include cross-platform, free and open source, powerful features, rich extensions, and lightweight and fast.

See all articles