Skip to content

vlingo platform

Vaughn Vernon edited this page Aug 29, 2018 · 8 revisions

About the vlingo/platform

The vlingo/platform is a set of open source (OSS) computing tools that simplify distributed, concurrent, reactive, event-driven, and microservices architectures, and which facilitate the contemporary ways that Domain-Driven Design fluent models are expressed.

Industry challenge

Obsolete and brittle architecture, and deficient software design, have resulted in the competitive paralysis of the software industry. It is quite common for large enterprises, that once enjoyed competitive distinction, to be hamstrung by Big Ball of Mud systems that prevent more than a few releases per year.

These legacy monoliths have generated profit for decades. Yet, the gradual myriad of changes to these revenue generators have led to a paralyzing tangle. The recurring plea for help? Teams are demoralized by the mud, and hardware has outpaced software architecture. Large companies that have experienced stagnation need liberating relief and mobility through enterprise modernization and transformation.

Introducing the vlingo/platform

Use the open source (OSS) vlingo/platform to achieve the simplification of distributed, concurrent, reactive, event-driven, and microservices architectures. Along with Domain-Driven Design, this is the crossroads where business strategy and modern technology meet. This means that the vlingo/platform doesn’t get in your way as you build your Bounded Context with its Ubiquitous Language. Rather, the vlingo/platform facilitates the explicit and fluent linguistic expressions of your core business models. Together with simplified multi-core enablement, your teams are supplied with a powerful toolbox full of versatile components supporting innovation.

vlingo/platform components

Built on vlingo/actors

In 1973, Dr. Carl Hewitt and his colleagues formulated the Actor Model. In recent years, the inventor of object orientation, Alan Kay, has stated that the Actor Model retained more of what he thought were the important object ideas. So, when you think of the Actor Model, think of objects done right.

vlingo/actors

The vlingo/actors toolkit is an implementation of the Actor Model. The ideas behind the Actor Model are powerful, and the vlingo/actors toolkit elegantly implements the concepts behind it with simplicity. The vlingo/actors toolkit is type safe by design, and services use it by defining and implementing domain-specific interfaces as actors. This box shows how actors work and what they do.

How actors work and what they do
An actor receives messages in its mailbox, and processes one message at a time when a thread is available.
Fundamentally, actors are non-blocking and share none of their mutable state with the outside, not even with other actors.
Actors use available threads, and you can’t run more threads simultaneously than there are available cores.
The basic unit of computation is expressed through actors. Actors send and receive messages asynchronously.
As objects create other objects, actors can create other actors.
Each actor can designate the behavior it will exhibit for the next message it receives. With vlingo/actors this can be accomplished by actors implementing multiple type-safe domain-specific interfaces.

As objects are typically used, software developers have become accustomed, even addicted, to the blocking paradigm. In the blocking diagram a Client object invokes a method on a Server object. This is an in-process (in-VM) invocation, not a remote client and a remote server. The point is, when a method invocation occurs, the Client is blocked until the Server returns from the method invocation. This means that the Client can perform no additional operations while the Server is handling its request. In contrast, the Actor Model works differently as is shown in the message-driven diagram.

Blocking objects

When the Sender actor wants another actor to provide a service, it sends that actor a message. The message is sent to the Receiver actor and handled asynchronously when a thread is available. The Sender is not blocked, but continues moving forward with its current activities, and when those complete, it returns from its own message handling. As a result the thread previously used by the Sender is now available for another actor. This achieves maximum efficiency across all actors in your service instance. The more cores that are available, the greater the overall throughput.

With vlingo/actors, type-safe messages are the fundamental building block, not an experimental afterthought. For those that depend on static typing, a strongly-typed Actor Model implementation is crucial to reassure developers that they are sending the correct and intended message to each actor. This is guaranteed by the compiler, and adds no overhead beyond a typeless implementation.

Type-safe actor messaging

There is far too much complexity in the software industry. The overarching vision for the vlingo/platform puts extreme emphasis on simplicity. In a few moments you can download the platform components through your build definition, with the whole platform fully configured for common use cases. You can be productive within minutes, rather than the typical untold number of weeks or months. Try it!

The vlingo/actors toolkit is the bedrock on which our other platform tools are implemented.

Scale and Resilience with vlingo/cluster

The vlingo/cluster is a key component that sits on top of vlingo/actors to support the development of scalable and fault-tolerant tools and applications. Other tools that build out the vlingo/platform will often be constructed on top of vlingo/cluster. Typically, you will implement and deploy your services/applications in clusters.

In addition to scalable fault-tolerance, the vlingo/cluster also provides cluster-wide, synchronizing attributes. This enables the cluster to share live and mutating operational state among all nodes.

Clustering on the vlingo/platform

Referring to the cluster diagram, if one of the three nodes is lost, the cluster will still maintain a quorum and remain healthy. However, if two nodes are lost and only one node remains in a running state, the quorum is lost and the cluster is considered unhealthy. In that case the one remaining node will enter an idle state and await one or more of the other nodes to return to active operation. When that occurs, the cluster will again constitute a quorum and reach a healthy state. Although many service/application clusters will require only three nodes for optimal use, clusters can support far more than three nodes. Yet, because of the performance and efficiencies of our platform, you may rarely need many nodes. Even a 9-node, 21-node, or 49-node cluster may be considered quite large due to our efficiency standards.

Reactive REST with vlingo/http

The vlingo/http component supports reactive, scalable, and resilient HTTP servers and RESTful services running on vlingo/cluster and vlingo/actors. Thus, this component does not run standalone, but is meant to provide very lightweight and high-performing HTTP support within a microservice-based Bounded Context.

Reactive REST

Although this does not suggest that your services should be primarily REST-based, it is quite common for user interfaces and even distribution of event streams to be based on REST. The vlingo/http component can get you there rapidly and with great simplicity. One glance at the REST request mappings to Java objects is all it takes to understand this.

In only a few lines of request mapping and target handler source code, you get a high-performing RESTful service design fully based on your DDD Ubiquitous Language.

action.user.register.method = POST
action.user.register.uri = /users
action.user.register.to = register(body:sample.user.UserData userData)

action.user.contact.method = PATCH
action.user.contact.uri = /users/{userId}/contact
action.user.contact.to = changeContact(String userId, body:sample.user.ContactData contactData)
public class UserResource extends ResourceHandler {
  public void register(final UserData userData) {
    final User user =
            User.from(
                    Name.from(userData.nameData.given, userData.nameData.family),
                    Contact.from(userData.contactData.emailAddress, userData.contactData.telephoneNumber));

    repository.save(user);
    
    completes().with(Response.of(Created, headers(of(Location, userLocation(user.id))), serialized(UserData.from(user))));
  }

  public void changeContact(final String userId, final ContactData contactData) {
    final User user = repository.userOf(userId);
    if (user.doesNotExist()) {
      completes().with(Response.of(NotFound, userLocation(userId)));
      return;
    }
   
    final User changedUser = user.withContact(new Contact(contactData.emailAddress, contactData.telephoneNumber));
    
    repository.save(changedUser);
   
    completes().with(Response.of(Ok, serialized(UserData.from(changedUser))));
  }
}

vlingo/directory

The vlingo/directory component supports service registration and discovery. When a new Bounded Context, implemented as a microservice, is started, it registers itself with the vlingo/directory.

Service registration and discovery

As a result, other Bounded Contexts will discover the services that they must collaborate with. This happens when the vlingo/directory broadcasts the registration details, including hosts and ports, around the enterprise.

vlingo/auth

The vlingo/auth service provides security for the various components of the vlingo/platform.

Authentication and authorization

It supports the following authentication and authorization concepts: Tenants, Users with Profiles, Groups, Roles with Permissions and Constraints. The vlingo/auth service may also be used by any service/application that you create, but it is not a requirement that your organization adopt it as your security standard.

There are more exciting platform components on the way, and they will be announced in the coming weeks, so stay tuned!