Why do large services such as Dropbox use Python as the main language, even though it is several orders of magnitude less efficient than other compiled languages?

Source: Internet
Author: User
Php Chinese network (www.php.cn) provides the most comprehensive basic tutorial on programming technology, introducing HTML, CSS, Javascript, Python, Java, Ruby, C, PHP, basic knowledge of MySQL and other programming languages. At the same time, this site also provides a large number of online instances, through which you can better learn programming... Reply: any concept of "XXX language is too slow" is partial.
There are many types of applications, such as CPU bound, I/O bound, and Memory bound. If your program belongs to I/O bound, even if you change the entire program to a manually optimized C, the speed will not be substantially improved.
For Dropbox, its business logic is not complex, and the performance bottleneck is obviously in I/O. in addition to the SHA statement that I estimate when determining the weight, CPython has a major advantage in that it is easy to use the C writing Module. it is not too late to use C to write the code after finding the hot spot. "Premature optimization is the root of all edevil ."
In this case, the use of a language with poor performance but easy to read and write, perfect ecosystem, cross-platform, and fast iteration is just a matter of course.
What's more, the author of Guido and Python has been dug by Dropbox.
Python is indeed several orders of magnitude slower than compiled languages, but it is only related to applications restricted by CPU.
Dropbox is mainly subject to disk and network constraints. Therefore, the use of compiled languages does not significantly speed up Dropbox, because most of the time is spent on reading and writing data rather than computing.

The advantage of interpreted language is the development speed, which is why most websites use interpreted language for development. Programmers benefit from these advantages when these disadvantages are marginalized.

References:
William Ting's answer to Python (programming language): How can some really large services (like Dropbox) afford to use Python as a primary language, if it's one to two orders of magn1_slower than other, compiled ages? Large services use Python as the main language. I know Dropbox, YouTube, Quora, and Zhihu. In fact, it doesn't make much sense to analyze why Dropbox and YouTube use Python. Because Dropbox file synchronization and YouTube's core online video functions, I believe they are not implemented using Python.

Instead, it is more accurate to analyze why Quora and Quora use Python as the main language. Why does Quora use Python? I reference Adam D'Angelo, founder of Quora. And Charlie Cheever The appearance statement on Quora tells us why Python is used.

Adam mentioned in his answer that he first ruled out PHP after leaving Facebook to start Quora, because as a CTO before Facebook, he knew the pain brought by PHP; he also considered C #, Java, and even niche Scala, OCaml, and Haskell. excluding C #, I don't want to be limited by Microsoft's protocol stack. Java requires a longer development cycle, at the same time, it is difficult to find skilled users. The reason for choosing Python is actually very simple: Adam and another founder, Charlie, are familiar with Python!

From the usage of the following years, Adam is very glad to have chosen his own choice: all employees are very happy to use Python, no matter what the previous major language is; Tornado With the launch of other frameworks, real-time services such as updates have a good place; PyPy The Python performance may be greatly improved in the near future. before this ideal implementation, Quora's performance-sensitive back-end code was written in C ++. Charlie also added that good frameworks such as Django and Pylons have benefited a lot. The data structures of Python and Javascript are very harmonious, as well as excellent third-party libraries such as email service and task queue.

Reference Source:
Quora Infrastructure: Why did Quora choose Python for its development? I remember a saying like this:
The amount of water in a bucket does not depend on the highest block on the bucket wall, but on the shortest block on the bucket wall.
There is another saying:
The bearing capacity of an iron chain is determined by its weakest ring.

By the way, there is another figure, which I think is the most appropriate:

According to the answers given above, the subject should understand that large systems are rarely written in a single language .. Each language has its own characteristics and applicable environment.
Enterprises will select different languages for different components based on the specific use environment (IO intensive or computing intensive, development efficiency, etc.
Compile-type languages are used for areas that require high efficiency but few changes. For components with extremely high development efficiency that need to be added to new functions in three days, the "time cost" required for launching is much more valuable than the "hardware investment" required to increase the speed.
The main environment in which explanatory languages are used is an economic act of "changing (developing) time with (hardware footprint) space .. This logic is relatively simple and requires a large number of concurrent network applications. The performance of the language itself is not significantly affected. more bottlenecks lie in IO performance, therefore, the differences between different languages are not very large. Therefore, rapid development and iteration are used. A fast deployment language is more suitable for development efficiency and overall cost than a language that pursues performance like C. The key is that the IO speed is slow, so python is not slow. the algorithm used by the Dropbox client uses c ext, and even its UI Library wxwidget is a Python shell, the speed bottleneck is the C code, so it's okay.
As for the server side, it is not clear about the Dropbox situation. for example, Quora has been fully switched to Cython to handle a larger load. I think the Dropbox server side cannot be implemented in Python alone. In the early stage, we started to see who is more agile. we once saw several blog posts by dropbox developers. The main reason for their adoption of python is that it can be relatively simple to implement cross-platform, and the development speed is fast, so as to achieve the goal of fast online. You can use Google to search for the dropbox technology stack and find my blog post.

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.