The Ergo Framework is an implementation of ideas, technologies, and design patterns from the Erlang world in the Go programming language. It is based on the actor model, network transparency, and a set of ready-to-use components for development. This significantly simplifies the creation of complex and distributed solutions while maintaining a high level of reliability and performance.
-
Actor Model: enables the creation of scalable and fault-tolerant systems using isolated actors that interact through message passing. Actors can exchange asynchronous messages as well as perform synchronous requests, offering flexibility in communication patterns.
-
Network Transparency: actors can interact regardless of their physical location, supported by a high-performance implementation of the network stack, which simplifies the creation of distributed systems.
-
Observability: framework includes built-in observability features, including service discovery and static routes, allowing nodes to automatically register themselves and find routes to remote nodes. This mechanism simplifies managing distributed systems by enabling seamless communication and interaction between nodes across the network.
-
Ready-to-use Components: A set of ready-to-use actors simplifying development, including state management and error handling.
-
Support for Distributed Systems: framework includes built-in mechanisms for creating and managing clustered systems, distributed events (publish/subscribe mechanism), remote actor spawning, and remote application startup. These features enable easy scaling, efficient message broadcasting across your cluster, and the ability to manage distributed components seamlessly.
-
Reliability and Fault Tolerance: the framework is designed to minimize failures and ensure automatic recovery, featuring a supervisor tree structure to manage and restart failed actors, which is crucial for mission-critical applications.
-
Flexibility: This framework offers convenient interfaces for customizing network stack components, creating and integrating custom loggers, managing SSL certificates, and more.
In the https://github.com/ergo-services/examples repository, you will find examples that demonstrate a range of the framework's capabilities.
On a 64-core processor, Ergo Framework demonstrates a performance of over 21 million messages per second locally and nearly 5 million messages per second over the network.
You can find available benchmarks in the following repository https://github.com/ergo-services/benchmarks.
-
Messaging performance (local, network)
-
Memory consumption per process (demonstrates framework memory footprint).
To inspect the node, network stack, running applications, and processes, you can use the observer
tool
To install the Observer tool, you need to have the Go compiler version 1.20 or higher. Run the following command:
$ go install ergo.services/tools/observer@latest
You can also embed the Observer application into your node. To see it in action, see example demo
at https://github.com/ergo-services/examples. For more information https://docs.ergo.services/tools/observer
For a quick start, use the ergo
tool — a command-line utility designed to simplify the process of generating boilerplate code for your project based on the Ergo Framework. With this tool, you can rapidly create a complete project structure, including applications, actors, supervisors, network components, and more. It offers a set of arguments that allow you to customize the project according to specific requirements, ensuring it is ready for immediate development.
To install use the following command:
$ go install ergo.services/tools/ergo@latest
Now, you can create your project with just one command. Here is example:
Supervision tree
mynode
├─ myapp
│ │
│ └─ mysup
│ │
│ └─ myactor
├─ myweb
└─ myactor2
To generate project for this design use the following command:
$ ergo -init MyNode \
-with-app MyApp \
-with-sup MyApp:MySup \
-with-actor MySup:MyActor \
-with-web MyWeb \
-with-actor MyActor2 \
-with-observer
as a result you will get generated project:
mynode
├── apps
│ └── myapp
│ ├── myactor.go
│ ├── myapp.go
│ └── mysup.go
├── cmd
│ ├── myactor2.go
│ ├── mynode.go
│ ├── myweb.go
│ └── myweb_worker.go
├── go.mod
├── go.sum
└── README.md
to try it:
$ cd mynode
$ go run ./cmd
Since we included Observer application, open http://localhost:9911 to inspect your node and running processes.
Starting from version 3.0.0, support for the Erlang network stack has been moved to a separate module and is distributed under the BSL 1.1 license - https://github.com/ergo-services/proto. You can find detailed information on using this module in the documentation at https://docs.ergo.services/extra-library/network-protocols/erlang.
- Go 1.20.x and above
Fully detailed changelog see in the ChangeLog file.
v3.0.0 2024-09-04 [tag version v1.999.300]
This version marks a significant milestone in the evolution of the Ergo Framework. The framework's design has been completely overhauled, and this version was built from the ground up. It includes:
- Significant API Improvements: The
gen.Process
,gen.Node
, andgen.Network
interfaces have been enhanced with numerous convenient methods. - A New Network Stack: This version introduces a completely new network stack for improved performance and flexibility. See https://github.com/ergo-services/benchmarks for the details
Alongside the release of Ergo Framework 3.0.0, new tools and an additional components library are also introduced:
- Tools (observer, saturn) https://github.com/ergo-services/tools
- Loggers (rotate, colored) - https://github.com/ergo-services/logger
- Meta (websocket) - https://github.com/ergo-services/meta
- Application (observer) - https://github.com/ergo-services/application
- Registrar (client Saturn) - https://github.com/ergo-services/registrar
- Proto (erlang23) - https://github.com/ergo-services/proto
Finally, we've published comprehensive documentation for the framework, providing detailed guides to assist you in leveraging all the capabilities of Ergo Framework effectively. Its available at https://docs.ergo.services.
To enable Golang profiler just add --tags debug
in your go run
or go build
(profiler runs at
http://localhost:9009/debug/pprof
)
To disable panic recovery use --tags norecover
.
To enable trace logging level for the internals (node, network,...) use --tags trace
and set the log level gen.LogLevelTrace
for your node.
To run tests with cleaned test cache:
go vet
go clean -testcache
go test -v ./tests/...
please, contact [email protected] for more information