Why use Erlang?
What's so awesome?
Erlang was developed at Ericsson and was designed from the ground up for writing scalable, fault-tolerant, distributed, non-stop, soft-realtime applications. Everything in the language, runtime and libraries reflects that purpose, which makes Erlang the best platform for developing this kind of software.
Use Erlang if you want your application to:
- handle very large number of concurrent activities
- be easily distributable over a network of computers
- be fault-tolerant to both software & hardware errors
- scale with the number of machines on the network
- be upgradable & reconfugurable without having to stop & restart
- be responsive to users within certain strict timeframes
- stay in continuous operation for many years
Because Erlang is oriented around concurrency, it's also naturally good at utilizing modern multicore systems.
Erlang has been successfully used in production systems for over 20 years (with reported uptimes of 9-nines — that's 31ms of downtime a year). It's been proven to work well in both large-scale industrial software development, and in small agile teams in startups.
Ericsson themselves have used Erlang extensively for many projects of varying sizes, both commercial and internal. The AXD301 ATM, one of Ericsson's flagship products, may be the largest Erlang project in existence at over 1.1 million lines of Erlang.
Erlang users in the telecoms industry: Motorola, Nokia, T-Mobile, BT. Large software companies & startups: Amazon, Yahoo!, Facebook, Last.fm, Klarna,
Erlang lets you deliver kick-ass software faster, on smaller budgets and with smaller teams, and reduce TLC & TCO.
This is made possible by a number of reasons:
- The OTP libraries provide a complete set of easy-to-use components for building robust distributed applications, that have been used in hundreds of projects, and thouroughly tested & debugged over the last 10 years.
- A large number of high-quality open-source libraries is available for many other tasks, such as XML processing or interacting with database systems such as PostgreSQL. Interfacing with existing code in Java, C, Python or Ruby is straightforward too.
- Erlang code tends to be conscise & readable, which is made possible by the simplicity of the language & powerful abstraction mechanisms available.
- Erlang scales well to large & small teams, and makes both top-down and bottom-up approaches to building software natural.
- Erlang is easy to learn. An experienced programmer can start writing useful code after a couple of days of learning Erlang.
- Availability of high-quality tools such as documentation generators, testing frameworks, debuggers, graphical diagnostics tools, and IDEs.
Erlang has a simple & consistent core which makes it easy to pick up. Experienced programmers can start writing useful code after a couple of days with Erlang. There are no complicated concepts to understand or arcane theories to master. The syntax may look a little different if you're coming from Ruby, Python, or Java, but it doesn't take long to get used to.
In fact, making the language easy to pick up was one of the original design goals of the Erlang development team. Erlang is very pragmatic & has been made by working programmers, for working programmers.
Processes are very lightweight, with only about 500 bytes of overhead per-process. This means that millions of processes can be created, even on older computers.
Because Erlang's processes are completely independent of OS processes (and aren't managed by the OS scheduler), your programs will behave in exactly the same way regardless of whether they run on Linux, FreeBSD, Windows or any of the other systems that Erlang runs on.
Because of Erlang's great support for concurrency it becomes natural to model applications around multiple independent communicating agents, which is just how things are in the real world.
In a real-time control system we often don't want to stop the system in order to upgrade the code. In certain real-time control systems we may never be able to turn off the system to perform upgrades, and such systems have to be designed with dynamic code upgrades in mind. An example of such system is the X2000 satellite control system developed by NASA.
When you write your app in Erlang, you get dynamic code upgrade support for free when you use OTP. The mechanism itself is very straightforward and easy to understand.
This can save hundreds of hours of time in development:
This is a common Erlang development workflow:
- Start the app.
- Edit the code.
- Recompile. (one keystroke)
- That's it! There is no restart step. The app gets updated with the new code while it's running and tests get run automatically to ensure there are no regressions. This of course works great with TDD too.
Erlang programs can be easily ported from a single computer to a network of computers. With the exception of timing all operations in the distributed system will work in exactly the same way as they worked in a single-node system.
OTP, the Open Telecom Platform, is a collection of standard libraries that distill years of real-world experience of building scalable, distributed, fault-tolerant applications.
- Free & open-source. Erlang is distributed under a permissive open-source license, and is free to use for any open-source, freeware, or commercial projects.
- Cross-platform. Erlang runs on Linux, FreeBSD, Windows, Solaris, Mac OS X, and even embedded platforms such as VxWorks.
- Well-supported. A dedicated team of engineers is employed by Ericsson to work on Erlang. Commercial support & services are available from Erlang Solutions and a number of other companies. There is also a responsive community around the world, centered around the Erlang Mailing List & IRC (#erlang on Freenode).
- Plays well with the outside world. Integration with existing Java, .NET, C, Python, or Ruby code is straightforward. There is an interface to the underlying OS should you need one. Solid libraries to work with XML, JSON, ASN.1, CORBA etc are also available.
- HiPE. The High Performance Erlang Compiler can compile Erlang to native code on Windows, Linux and Mac OS X and comes in the standard Erlang distribution.
- Static typing, when you need it. You can annotate your code with type information & use Dialyzer, a powerful typechecker, to ensure the correctness of your code and gain performance. Dialyzer comes bundled with Erlang, and also supports gradual typing to give you maximum flexibility.
- Bit syntax. Another feature unique to Erlang that makes working with binary data a breeze. Writing programs such as binary file readers or network protocol parsers is easier in Erlang than in any other language. Erlang code that uses the binary syntax is compiled into very efficient machine code, often beating hand-written C code in performance.