可扩展性是否取决于编程语言?

发布于 2024-09-24 03:50:15 字数 1431 浏览 4 评论 0原文

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

雪若未夕 2024-10-01 03:50:15

这似乎是一个典型的将巧合与因果混为一谈的例子。 Twitter 改变了他们的架构,解决了他们的可扩展性问题。与此同时,他们也碰巧引入了一种新的编程语言,但这并不意味着这负责解决他们的问题。

Twitter 最初被设想为一个 CMS 平台。因此,它被构建为一个 CMS,以数据库为中心。然而,用户并没有将其用作 CMS,而是将其用作消息传递平台。对于消息传递平台来说,数据库几乎是最坏的情况:消息传递平台需要一个位于中心的消息队列。因此,Twitter 编写了一个消息队列来补充他们的数据库,这在一定程度上缓解了他们的可扩展性问题。

这个消息队列实际上是用 Ruby 编写的。所以,那里没有 Scala。 (顺便说一句:语言的名称是 Scala,而不是 SCALA。它不是缩写词。)

第一个消息队列也存在可扩展性问题。并不是因为它是用 Ruby 编写的,而是因为这是开发人员第一次编写消息队列。于是,他们又写了一个消息队列。这一次,他们已经有了第一个消息队列的所有经验,所以这个更好。而且它恰好是用 Scala 编写的。

Twitter 之所以一开始出现可扩展性问题,并不是因为 Ruby,而是因为之前从来没有 Twitter,没有人知道如何扩展它。

现在它之所以能够扩展,是因为他们学会了如何扩展它,而不是因为 Scala。 (事实上​​,Twitter 的大部分内容仍然是用 Ruby 实现的。其他部分是用 C++ 实现的,我相信还有一些 Erlang。)

架构规模。好的语言可以更容易地发现性能和可扩展性瓶颈(只需查看更少的代码),并且更容易进行大规模架构重构(同样:更少的代码),但最终,它与架构有关。

This seems to be a typical instance of conflating coincidence and causality. Twitter changed their architecture, which solved their scalability problems. At the same time, they also happened to introduce a new programming language, but this doesn't mean that this was responsible for fixing their problems.

Twitter was originally envisioned as a CMS platform. So, it was architected as a CMS, with a database at the center. However, users didn't use it as a CMS, they used it as a messaging platform. A database is pretty much the worst case scenario for a messaging platform: a messaging platform needs a message queue at the center. So, Twitter wrote a message queue that complements their database, and that helped their scalability problems somewhat.

This message queue was actually written in Ruby. So, no Scala there. (BTW: the name of the language is Scala, not SCALA. It's not an acronym.)

This first message queue also had scalability problems. Not because it was written in Ruby, but because it was the first time that any of the developers had ever written a message queue. So, they wrote another message queue. This time, they had all the experience from the first message queue, so this one was better. And it happened to be written in Scala.

The reason why Twitter had scalability problems at the beginning was not because of Ruby, it was because there had never been a Twitter before, and nobody knew how to scale it.

The reason why it scales now, is because they learned how to scale it, not because of Scala. (In fact, large parts of Twitter are still implemented in Ruby. Others are in C++, and there's some Erlang, too, I believe.)

Architecture scales. Good languages can make it easier to find performance and scalability bottlenecks (by simply having less code to look through), and make it easier to do large scale architecture refactoring (again: less code), but ultimately, it's about the architecture.

如梦亦如幻 2024-10-01 03:50:15

一个简单的反例:在 Assembly 中编写 Web 服务器实际上是不可能的。

然而,我怀疑这种转变的原因是 Scala 比 Ruby 更具可扩展性。我希望这两种语言具有相似的可扩展性因素。我能想到他们想要转向 Scala 的唯一原因可能是从 Java 虚拟机中受益; Java VM 调整得非常好并且速度很快。一直以来,Scala 都比 Java 具有更具表现力的语法,并且通常是一种更好的语言。

one simple counterexample: writing a web server in Assembly is for all practical purpose impossible.

However, I doubt that the reason for the shift is because Scala is more scalable than Ruby. I would expect both language to have similar scalability factor. The only reason I can think of why they want to move to Scala is probably to benefit from Java Virtual Machine; Java VM is very well-tuned and fast. All the while, Scala has a more expressive syntax than Java, and is generally a nicer language.

黯淡〆 2024-10-01 03:50:15

良好的可扩展性取决于良好的架构(即不共享架构),并记住可扩展性=/=性能。

另外,由于我总是可以向您展示如何使用任何语言设计不可扩展的系统,因此没有任何语言可以保证可扩展性。

Good scalability depends on good architecture (i.e. share nothing architecture), and bear in mind scalability =/= performance.

Also, since I can always show you how to design an unscalable system using any languages, therefore, no language guarantee scalability.

稳稳的幸福 2024-10-01 03:50:15

性能≠可扩展性。然而,您的代码执行速度越快,您需要购买的机器/处理器就越少,并且 Scala 速度更快。因此,我认为你可以原谅有人不准确地说 Scala 更具可扩展性,因为它的扩展成本更低。

Performance ≠ scalability. However, the faster your code performs speed-wise, the less machines/processors you have to purchase, and Scala is faster. Thus, I think you can forgive someone imprecisely saying that Scala is more scalable because it's less costly to scale.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文