Ballerina, which treats cloud native middleware as a programming language, has reached 1.0.
Paul Fremantle, WSO2 CTO and co-founder, demonstrated Ballerina at ApacheCon North America in Las Vegas on Tuesday. While Ballerina grew out of WSO2 as a way to address the shortcomings of the enterprise service bus (ESB), the code is open and freely available to everyone on GitHub.
At the same time, WSO2 in the coming weeks will be releasing a new version of its commercial Enterprise Integrator, which will include Ballerina. It has been released under the Apache License 2.0, but is not an Apache Software Foundation project, Fremantle said.
“We don’t have a big enough community for that,” he said. “That’s one of the reasons we’re here [at ApacheCon].”
A Programming Language with Networking Built In
Though many developers are using and/or creating APIs, existing languages generally don’t know or care about networking. While IO libraries seek to add networking in, Ballerina is designed to treat networking as a first-class aspect of programming.
It can tell the difference between a local network call and a call over a distributed system, and respond accordingly, he said.
“We tried to build in the concept of network, some of the challenges networking [brings] into the language. So that’s really why there’s a new language,” he said.
It’s a compiled, type-safe, concurrent language modeled on the notion of sequence diagrams. Ballerina programs are self-documenting and fit cleanly into the patterns of microservices and cloud native development, making it simpler to create RESTful and gRPC APIs. The syntax is designed around services; endpoints; network types, such as JSON and ProtoBuf; and simple annotations automatically create deployments for Kubernetes, Docker and Istio.
“In 2016 we decided that the only real way to make integration programming dramatically better was to invent a full programming language. We figured, oh, it should take maybe 6-8 months and we’d be done,” he wrote.
At the demo, Alex Karasulu, CTO and founder of OptDyn, seemed amazed at the speed at which it was produced.
“I spent five years writing a set of libraries called [Apache] Mina to do this, and [Ballerina] just blows that away,” he said. “This will revolutionize the way people write networking code.”
“Six friggin’ lines of code. It takes it down to six lines of code,” added Bruce Snyder, director of software development for SAP Hybris and vice president for Apache ActiveMQ.
Fremantle said not every audience to which he has presented Ballerina has been quite so enthusiastic.
“I think this audience is right on target for this. You could tell they were like, ‘I can use this. I’m going to use this,’” he said, especially those who saw the ease of deploying with Kubernetes.
Ballerina is production-ready, he said, with 95% of the spec marked stable. The other 5% is made up of experimental features that will throw up a flag, he said, and it’s likely that code will change.
The Evolution of Ballerina as a Cloud Native Language
Much has changed since Ballerina was first profiled in The New Stack in May 2018, he said.
“[Then] we were on a path to say this is just a really useful language to replace an ESB. … I was talking about the WSO2 use case, what you might call the integration use case. And just after that, we got on board a very experienced language designer,” he explained.
James Clark, one of the original XML designers, “meant to just do like a little validation check, say it’s OK,” Fremantle said. “And he and the team sort of suddenly realized that there was an opportunity to really make this into quite a nice language.”
“He just went through the language and said, ‘Guys, you’ve got an OK language here, but it’s just never going to be a great language.’ And so the biggest change since May 2018 is that we’ve really just spent 18 months cleaning it up, making sure it’s consistent, it’s logical. When a computer scientist comes and looks at it, they might not agree with everything, but they’re not going to say it’s just a mess. So that’s the one big piece.”
They also realized they were not going to get the performance they wanted. The original version was based on WSO2’s virtual machine.
They had basically written a VM on top of another JVM, then ran their own byte code, so effectively, it was interpreted. It was compiled into an intermediate form, but that intermediate form was interpreted, so it was kind of like when Java 1.0 came out, not taking advantage of all the advances in the past 20 years. So they decided to rebuild it to generate JVM bytecode instead.
“Just to give you an idea, the old version was maybe doing 20,000 requests a second on my laptop; the new one’s doing 55. So it’s at least a factor of two faster. But it’s also more importantly, it’s tuning, it’s improving. And particularly if you build more complex logic, all the kind of cleverness comes in from the JVM,” he said.
New Features in Ballerina 1.0
Java interoperability, which allows users to call Java code from Ballerina, is part of version 1.0 as well as redesigned developer tools.
Overall, Ballerina provides:
- Language constructs specifically for consuming and providing network services.
- Abstractions and syntax for concurrency and network interaction that closely correspond with sequence diagrams, which enable bidirectional mapping of Ballerina source code between text and graphical representation.
- A structural type system that is more flexible and allows for looser coupling than traditional statically typed languages.
- Design to fit into a modern development lifecycle, including with continuous integration and continuous delivery (CI/CD) tools, such as Jenkins, Travis and Codefresh; observability tools, such as Prometheus, Zipkin and Honeycomb; and cloud orchestration systems like Kubernetes.
The Ballerina platform includes a framework for package/module management, including dependency and version management, a public web service for sharing modules, IDE tool plugins, a framework for documentation and testing, a resource library and more.
“We were attracted by Ballerina’s cloud native features, such as the automatic generation of Docker, Kubernetes and Helm artifacts, as well as its small footprint and faster boot times. It’s also capable of running a Lambda function (serverless) in AWS. Together, these capabilities have enabled us to easily run microservices in containers at scale and integrate with CI/CD tools with less effort,” said Sri Harsha Pulleti, integration architect and senior manager at Motorola, one of Ballerina’s early adopters.
WSO2 is a sponsor of The New Stack.
Feature image via Pixabay.