Chapter 8. Introducing distributed Erlang/OTP


This chapter covers

  • The basics of distributed Erlang
  • Working with Erlang nodes and clusters
  • Implementing a simple resource discovery system

In this chapter, we take a break from adding functionality to the cache application. Instead, we explore the distributed programming capabilities of Erlang, in order to prepare you for the next chapter. Although Erlang/OTP makes distribution a lot simpler than it is in most other languages, it’s still a complex topic. This chapter will teach you the basics of working with distributed Erlang, but it can take a lot of experience to get the hang of it and realize how few of the lessons from traditional sequential programming remain valid. But don’t worry—above all, it’s a lot of fun!

8.1. The fundamentals of Erlang distribution

Let’s say you have an instance of the Simple Cache application running on machine A and another instance running on machine B. If would be great if, when you insert a key/value pair into the cache on machine A, it would automatically become available on machine B as well. Obviously, machine A would somehow have to communicate that information to machine B. There are many ways you can go about propagating this information, some easier and more straightforward than others. All of them, however, imply distribution, because you need to communicate between separate computers.

8.2. Nodes and clustering

8.3. The nuts and bolts of resource discovery

8.4. Summary