Erlang and OTP in Action
An enormous amount of experience, combined.
Erlang and OTP in Action teaches you the concepts of concurrent programming and the use of Erlang's message-passing model. It walks you through progressively more interesting examples, building systems in Erlang and integrating them with C/C++, Java, and .NET applications, including SOA and web architectures.
Table of Contents detailed table of contents
foreword
preface
acknowledgments
about this book
introduction
Part 1 Getting past pure Erlang: the OTP basics
1. The Erlang/OTP platform
1.1. Concurrent programming with processes
1.2. Erlang’s fault tolerance infrastructure
1.3. Distributed Erlang
1.4. The Erlang runtime system and virtual machine
1.5. Functional programming: Erlang’s face to the world
1.6. Summary
2. Erlang language essentials
2.1. The Erlang shell
2.2. Data types in Erlang
2.3. Modules and functions
2.4. Variables and pattern matching
2.5. Functions and clauses
2.6. Case and if expressions
2.7. Funs
2.8. Exceptions, try, and catch
2.9. List comprehensions
2.10. Bit syntax and bitstring comprehensions
2.11. Record syntax
2.12. Preprocessing and include files
2.13. Processes
2.14. ETS tables
2.15. Recursion: it’s how you loop
2.16. Erlang programming resources
2.17. Summary
3. Writing a TCP-based RPC service
3.1. What you’re creating
3.2. Implementing the RPC server
3.3. Running the RPC server
3.4. A few words on testing
3.5. Summary
4. OTP applications and supervision
4.1. OTP applications
4.2. Adding fault tolerance with supervisors
4.3. Starting the application
4.4. Generating documentation with EDoc
4.5. Summary
5. Using the main graphical introspection tools
5.1. Appmon
5.2. Pman
5.3. Debugger
5.4. TV, the Table Viewer
5.5. Toolbar
5.6. Summary
Part 2 Building a production system
6. Implementing a caching system
6.1. The background story
6.2. The design of your cache
6.3. Creating the basic OTP application skeleton
6.4. From application skeleton to a working cache
6.5. Summary
7. Logging and event handling the Erlang/OTP way
7.1. Logging in Erlang/OTP
7.2. A custom event handler with gen_event
7.3. Adding a custom event stream to the Simple Cache
7.4. Summary
8. Introducing distributed Erlang/OTP
8.1. The fundamentals of Erlang distribution
8.2. Nodes and clustering
8.3. The nuts and bolts of resource discovery
8.4. Summary
9. Adding distribution to the cache with Mnesia
9.1. Distributing the cache
9.2. Distributed data storage with Mnesia
9.3. Distributing the cache with Mnesia
9.4. Summary
10. Packaging, services, and deployment
10.1. Applications from a system viewpoint
10.2. Making a release
10.3. Release packaging
10.4. Installing a release
10.5. Summary
Part 3 Integrating and refining
11. Adding an HTTP interface to the cache
11.1. Implementing a TCP server
11.2. Building a web service from the ground up
11.3. Summary
12. Integrating with foreign code using ports and NIFs
12.1. Ports and NIFs
12.2. Integrating with the parser through a port
12.3. Making a linked-in driver
12.4. Implementing the parser as a NIF
12.5. Summary
13. Communication between Erlang and Java via Jinterface
13.1. Integrating Erlang with Java using Jinterface
13.2. Installing and configuring HBase
13.3. Building the bridge between Simple Cache and HBase
13.4. Integrating HBase with Simple Cache
13.5. Running the integrated system
13.6. Summary
14. Optimization and performance
14.1. How to approach performance tuning
14.2. Profiling Erlang code
14.3. Erlang programming language caveats
14.4. Summary
Appendix A: Installing Erlang
Appendix B: Lists and referential transparency
index
About the Technology
Erlang is an adaptable and fault tolerant functional programming language originally designed for the unique demands of the telecom industry. With Erlang/OTP's interpreter, compiler, database server, and libraries, developers are finding they can satisfy tough uptime and performance requirements in all kinds of other industries.
What's inside
Build apps that...
- Never deadlock on a shared resource
- Keep running, even during code upgrades
- Recover gracefully from errors
- Scale unchanged from one to many processors
- Handle many simultaneous connections, and
- Maintain fast response times