![](https://csdnimg.cn/release/download_crawler_static/9647144/bg13.jpg)
2 CHAPTER 1 Introducing Akka
simply define this as not single-threaded. That’s not really correct, but it’s good enough
for the moment.)
Scalability is the measure to which a system can adapt to a change in demand for
resources, without negatively impacting performance. Concurrency is a means to
achieve scalability: the premise is that, if needed, more CPUs can be added to servers,
which the application then automatically starts making use of. It’s the next best thing
to a free lunch.
Around the year 2005 when Herb Sutter wrote his excellent article, you’d find
companies running applications on clustered multiprocessor servers (often no more
than two to three, just in case one of them crashed). Support for concurrency in pro-
gramming languages was available but limited and considered black magic by many
mere mortal programmers. Herb Sutter predicted in his article that “programming
languages ... will increasingly be forced to deal well with concurrency.”
Let’s see what changed in the decade since! Fast-forward to today, and you find
applications running on large numbers of servers in the cloud, integrating many sys-
tems across many data centers. The ever-increasing demands of end users push the
requirements of performance and stability of the systems that you build.
So where are those new concurrency features? Support for concurrency in most
programming languages, especially on the JVM, has hardly changed. Although the
implementation details of concurrency APIs have definitely improved, you still have to
work with low-level constructs like threads and locks, which are notoriously difficult to
work with.
Next to scaling up (increasing resources; for example, CPUs on existing servers),
scaling out refers to dynamically adding more servers to a cluster. Since the ’90s, noth-
ing much has changed in how programming languages support networking, either.
Many technologies still essentially use RPC (remote procedure calls) to communicate
over the network.
In the meantime, advances in cloud computing services and multicore CPU archi-
tecture have made computing resources ever more abundant.
PaaS (Platform as a Service) offerings have simplified provisioning and deploy-
ment of very large distributed applications, once the domain of only the largest play-
ers in the IT industry. Cloud services like AWS EC2 (Amazon Web Services Elastic
Compute Cloud) and Google Compute Engine give you the ability to literally spin up
thousands of servers in minutes, while tools like Docker, Puppet, Ansible, and many
others make it easier to manage and package applications on virtual servers.
The number of CPU cores in devices is also ever-increasing: even mobile phones
and tablets have multiple CPU cores today.
But that doesn’t mean that you can afford to throw any number of resources at any
problem. In the end, everything is about cost and efficiency. So it’s all about effectively
scaling applications, or in other words, getting bang for your buck. Just as you’d never
use a sorting algorithm with exponential time complexity, it makes sense to think
about the cost of scaling.