Node and ARM
Reposted from Medium
ARM: A Quick Primer
ARM is a tricky beast to describe because it's more than one thing. In common parlance, we use it to describe a CPU architecture, akin to x86 from Intel and AMD. The ARM name comes from its designer, ARM Holdings, but they don't actually make the hardware, unlike Intel and AMD. ARM is primarily an intellectual property company which licenses their technology to manufacturers to form a vibrant ecosystem of processor and SoC (System on a Chip) products.
An ecosystem of manufacturers
Companies such as Samsung, Qualcomm, Broadcom and even AMD (traditionally known for their x86 products) license core CPU designs from ARM, largely made up of the "Cortex" range. A number of CPU design licensees release Cortex-based processors under their own branding, which is where you see familiar names such as the Qualcomm Snapdragon, the Samsung Exynos or Nvidia Tegra.
In addition, ARM offers an architectural license that gives licensees permission to design their own CPUs that fully comply with the ARM architecture to ensure instruction set architecture (ISA) compatibility. Companies such as Applied Micro and Cavium currently hold architectural licenses and are producing their own processor designs. Apple uses an architectural license to produce its Ax series of processors, including the A7 and A8 which power the current iPhone and iPad range.
The ARM architecture
Due to the compact nature of the ARM architecture, it has traditionally been used for small devices. ARM processor designs tend to focus on efficiency as their current primary uses are in devices where power draw is a major concern. Most smartphones and tablets in the market today are based around ARM processors and they are even showing up in laptops, with many of the current Chromebook range using ARM processors.
ARM's architecture designs are broken up in to generational versions. The most common ARM architecture generation used in smartphones, tablets and other small computers today is ARMv7. For instance, the newest incarnation of the Raspberry Pi uses an ARMv7 processor, while the original Pi used an ARMv6 processor, the previous generation.
There's a new generation that's starting to roll out, ARMv8 and this represents a major shift in architecture design and also a shift in the commercial potential that ARM Holdings sees for its processors.
The HiKey development board from 96Boards using an HiSilicon Kirin 6220 eight-core ARMv8 Cortex-A53 CPU
Until now, ARM's range of processors and architecture designs have all been 32-bit, meaning they have limitations in their ability to scale to uses beyond small devices. But even our smartphones are starting to push up against the barriers that 32-bit processors present, most notably the limitations to the amount of RAM you can couple with the processor. ARMv8 is a new 64-bit design that alleviates the barriers presented by 32-bits. The ARM family of processors already reaches deep into the low-power and small-size end of the market (as demonstrated b the Cortex-M0+ pictured above), but with ARMv8, there is a new target: the server market.
ARM on the Server
The phenomenal success of the Raspberry Pi saw the dawn of a whole new class of computers gaining wide acceptance: "single-board computers". There is now a huge range of products in this market, all vying for the attention of hobbyists and commercial users alike. Even Intel is in on the game with their low-power x86 incarnation, the Atom. The low cost and surprising versatility of these small computers have lead to some interesting new uses. DataStax like to show off their 32-node Rasperry Pi Cassandra Cluster as a way to demonstrate the versatility of Cassandra but even more, it shows the potential uses that low-cost single-board computers can be put to. Online Labs have rolled out a new IaaS (Infrastructure as a Service) product named Scaleway based completely around ARMv7 servers and are finding strong interest from customers wanting smaller and simpler cloud infrastructure.
miniNodes, another IaaS company, has jumped straight to ARMv8 in its offering by using early development ARMv8 boards. The University of Utah, in its contribution to the scientific computing cloud research project CloudLab, are rolling out a cluster of 315 HP Moonshot m400 cartridges, with which HP are claiming the title of “The World’s First Enterprise-ready 64-bit ARM Server”.
Also getting in on the ARMv8 hardware action is Gigabyte, Lenovo, Hyve Solutions, SoftIron, StackVelocity and E4 who specifically target HPC applications. As 2015 rolls on, expect a flourish of new hardware to appear, pushing us to rethink some traditional approaches.
The new ARMv8 processors are intended to further bridge the gap between traditional ARM uses and the new forms of server computers that there is an obvious demand for. Their low-power profile will mean that their natural target will still be smaller servers but we will likely see many cluster-style products come on to the market where many ARMv8 boards are combined into a unified cluster.
The Software Stack
Just as we are seeing shifts in the hardware market, with new demand for clusters of smaller servers rather than simply continuing to push at Moore's Law to make servers ever-bigger, we are also seeing shifts in the traditional trajectory of the software stack. Monolithic applications are now viewed as both business and technical risks. SOA (Service Oriented Architecture) is the new best-practice with experimentation all the way down to micro-services. We’re in the midst of a great ‘unbundling’ in the software world.
There is an interesting intersection between the changes in the hardware market and the changes in best-practice software development. Smaller, more nimble software is perfectly suited to smaller, more nimble and low-power hardware. What’s more, Node’s development model encourages developers to think multi-process from the beginning because we know that without the crutch of threads, the only way we can scale our applications is to multiply the number of processes (have you ever noticed how you rarely hear Node developers talk about “sticky-sessions” while Java developers obsess about them?). This means that Node applications scale as easily across clusters of servers as they do within a single server. Not only does the Node development model buy you free scalability, it also buys you resilience by fitting better on larger numbers of smaller servers instead of smaller numbers of larger servers as you typically see in the JVM world (although, the typical Node application performance profile means that you need significantly less total hardware investment as well).
One of the common patterns that NodeSource encounters across the enterprise as companies start waking up to the potential that Node offers them is that they need to start rethinking their hardware needs. Typically, large companies will have a homogeneous production environment, with one or two types of server available for deploying applications. Commonly these are tuned to the needs of the JVM and other monolithic application stacks so there is a priority placed the on speed and size of each hardware unit. An average server might have 16 cores and 32G of RAM and be a perfect match for a JVM application that makes liberal use of threads and is a natural memory hog. Unfortunately, this doesn’t translate very well to Node, particularly on the memory side. So we see a lot of wasted hardware in these environments with architects exploring new ways to make use of all of the free RAM they now have available. This is not ideal from a cost perspective but understandable where Node is only at the beginning of its journey into these environments.
Node and ARM: A Perfect Match
As argued above, Node is a great fit for the changes occurring in the hardware stack:
- Node isn’t a resource hog, it’s at home in smaller environments with its low memory profile and single-threaded nature.
- Node is nimble; for example, we advise our clients to kill & quickly restart when their applications enter an unexpected-error state. You can’t do this with a runtime that takes minutes to properly start and warm-up.
- Node’s development model and culture is naturally SOA; if you’re building a large application and it’s not made up of small services then you’re doing Node wrong. Node applications are generally scalable by default.
io.js, the community fork of Node.js, released its 1.0 earlier this year. ARM has been second-class for Node.js until now so we encouraged a new focus on ARM as a first-class platform target for the io.js project. ARM hardware has been a fixture in the io.js CI system from the beginning and the project has been shipping ARM binaries since 1.0. Today you can download both ARMv6 and ARMv7 optimized binaries for io.js releases and nightlies right from the downloads directory. Through this focus, io.js has even been able to feed patches back in V8 to fix and improve support for ARM.
Because io.js is using current V8 releases and we have made it clear that ARM as a platform with primary support, ARM Holdings has taken an interest in the project. It's clear that they see similar synergies to us between Node and ARM hardware, particularly with their new focus on server use of their architecture. ARM has stated publicly that their goal is to carve out 20% of the server market with its new architecture within five years, up from less than 1% today.
ARMv6 and ARMv7 boards in the current io.js ARM test and build cluster
We have been working with ARM to get access to test hardware for the io.js CI system to bring the codebase up to scratch on the new ARMv8 architecture. The not-for-profit Linaro organization was set up by ARM and its partners to work on bringing better ARMv7 and ARMv8 support to open source software. The organization maintains a server cluster which the io.js project currently has access to for ARMv8 test hardware and has used this resource to understand and solve the technical hurdles involved. io.js is likely to be shipping 64-bit ARMv8 binaries by the time single-board computers are available on the general market. Keep an eye on 96Boards, a project by Linaro, if you are interested in affordable ARMv8 hardware.
Of course, any embrace of the combination of smaller servers and Node for the enterprise is likely to be part of a longer, multi-year strategy. As of right now, Node adoption is still in the early stages at most companies that are choosing to embrace it. Their immediate concerns are more about the basic architecture questions relating to unbundling monolithic structures. As new SOA models emerge, questions about the optimization of hardware platforms will arise and it’s likely that ARM will be in serious consideration.
Aside from enterprise concerns, it’s clear that ARM at least has a future in new-style, low-cost cloud platforms that may be very attractive to start-ups and those of us who are looking for cheap hosting for our side-projects.
Node is still young, and adapting to a changing hardware landscape should be easy. Through io.js, Node’s future on ARM hardware is looking very positive. NodeSource will be keenly watching how the community and companies, both small and large, react to the new possibilities as they emerge.