Why do large services such as Dropbox use Python as the primary language, even if its efficiency is several orders of magnitude lower than other compiled languages?

Source: Internet
Author: User

Reply content:

Any "XXX language is too slow" concept is to generalize.
The application is divided into many kinds, CPU bound, I/O bound, Memory bound, and so on. If your program is an I/O bound, even if you replace the entire program with a manually optimized C, the speed will not be substantially improved.
For Dropbox, its business logic is not complex, and performance bottlenecks are obviously in I/O. Except I estimate the heavy SHA operation is relatively large, but the CPython advantage is that it is easy to use C write module, find hot spot and then use C to write is not too late. "Premature optimization is the root of all evil."
That being said, it is logical to use a language that is slightly less powerful but easy to read, easy to write, ecosystem-perfect, cross-platform, and fast to iterate.
Moreover, Guido, the author of Python, has been dug away by Dropbox.
Python is indeed a few orders of magnitude slower than the compiled languages (compiled language), but this is only relevant for CPU-bound applications.
Dropbox is primarily subject to disk and network constraints. Therefore, using a compiled language does not significantly speed up Dropbox, because most of the time is spent reading and writing data rather than counting.

The advantage of interpretive languages is the speed of development, which is why most websites are developed using interpreted language. When these drawbacks are marginalized, programmers benefit from these advantages.

Resources:
William Ting's answer to Python (programming language): What can some really large services (like Dropbox) afford-use Py Thon as a primary language, if it's one to both orders of magnitude slower than other, compiled languages? Large services using Python as the main language, I know the more famous is Dropbox,youtube,quora and know. In fact, it is not very important to analyze why Dropbox and YouTube use Python, because the core features of Dropbox's file sync and YouTube's online video, I believe, are not done in Python.

Instead of analyzing Quora and knowing why Python is used as the primary language, relatively more accurate, Quora Why use Python, I quote Quora founder Adam D ' Angelo and Charlie Cheever In the Quora, you know why Python is used, and you have to tell them about it.

In his answer, Adam mentions that he first ruled out PHP because he left the Quora on Facebook, because he knew PHP's pain as a former CTO of Facebook, and he also considered C#,java, even Scala,ocaml and Haskell. , excluding C # is a protocol stack that does not want to be limited to Microsoft, and Java requires a longer development cycle while finding skilled is difficult. The last reason to choose Python is really simple: Adam and another founder, Charlie, are more familiar with Python!

After years of use, Adam was thankful for his choice: all the employees were happy with Python, no matter what the primary language was; Tornado such as the introduction of the framework, so that the update and other real-time services have a good place; pypy There may be a big boost to Python performance in the near future, and Quora performance-sensitive back-end code is written in C + + prior to this ideal implementation. Charlie also added that the good frameworks such as Django and pylons benefited them, and Python and Javascript had a very harmonious data structure, as well as excellent third-party libraries such as mail services, task queues, and so on.

Citation Source:
Quora infrastructure:why did Quora choose Python for its development? I remember saying something like this:
The amount of water in a cask does not depend on the tallest piece of wood on the wall, but on the shortest piece of the bucket wall .
There is one more word to say:
The weight of a chain is determined by its weakest link .

Yes, there is a diagram here, I think the most appropriate:

In combination with the answers above, the master should understand that now large systems are seldom written in a single language. Each language has a unique and applicable environment for each language.
Businesses can choose different languages for different components based on their specific usage environment (IO-intensive or compute-intensive, development efficiency, etc.).
For those where the efficiency requirements are very high, but rarely changed in a compiled language. For the development efficiency requirements are very high, Zooey to join the new features of the components, on-line required "time cost" than to improve the speed of the required "hardware investment" is much more valuable.
The primary environment for using interpreted languages is an economic behavior in the "(Hardware footprint) space for (development) time". For such a relatively simple logic, the requirement is the large concurrent use of the network, the performance of the language itself is not significant, more bottlenecks in the IO performance, so what language difference is not particularly large, then use rapid development, rapid iteration , the language of rapid deployment is more appropriate for the development efficiency and overall cost than the language that pursues performance in C. The key is that the IO is slow and it doesn't show that Python is slow. Dropbox this client uses the algorithm part of the use of C EXT, even its UI library Wxwidget is also Python shell, the speed bottleneck is the C code, so fortunately.
As for the server side, Dropbox is not very clear, for example, Quora has been fully cython to withstand the larger load, I think the Dropbox server side is not possible to achieve pure python. The initial launch was to see who was more agile and had seen several blogs from the Dropbox developer. Their main reason for using Python is that they can be simpler to implement across platforms, and the speed of development is fast, thus enabling fast online. You can search the Dropbox technology stack with Google, and you'll find the blog post I'm talking about.
  • 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.