I have been looking into Java cloud hosting for my Groovy on Grails application, and I am quite pleased at what has been happening in this space. I last explored cloud hosting a couple of years ago. By contrast, today's PaaS (Platform as a Service) options look quite promising, particularly Cloud Foundry and Jelastic.
Then -- and now -- Amazon Web Service (AWS) was the big IaaS (Infrastructure as a Service) vendor. IaaS cloud services offered a great deal of flexibility, but it meant you were responsible for every aspect of your virtual instance. I did not want to deal with OS configuration, installing my own base software (JVM, database, Tomcat) nor keep up with the never-ending stream of updates and OS patches. Moreover, AWS had this odd behavior where everything you wrote to your filesystem evaporates when your AMI shuts down. While there were other IaaS options -- notably Rackspace but also a whole bunch of VPS vendors -- they all needed your tender loving care.
By contrast, Google's App Engine (GAE) was the major PaaS vendor, offering a solid developer's abstraction. You only needed to worry about your code, and you could deploy straight from Eclipse. But you had to code specifically for GAE. For example, you could only use a limited subset of the Java API. You had to use their datastore. There is a limit to how long a request could run. GAE offered you a gilded cage: it looks pretty from a developer's perspective, but vendor lock-in makes it hard to move your application elsewhere.
The new breed of PaaS for Java are a lot more attractive. They tend to have the following characteristics:
- Portability: you build standard Java wars not tied to any vendor-specific features. Goodbye, vendor lock-in.
- Standard services: your typical web app cannot stand alone. These PaaS options let you provision conventional services such as a MySQL database. Vendors might provide services such as a load balancer, messaging, caching and even building from source.
- Mainstream NoSQL: you don't have to use SQL to be portable. Instead of a proprietary datastore, you can use a mainstream NoSQL solution. For example, whether you sign up for Cloud Foundry, Jelastic, Heroku, CloudBees, OpenShift or Elastic Beanstalk, you can find MongoDB waiting there.
- Scalability: this, of course, is the big attraction behind "cloud". You can quickly provision new instances, or in many cases the PaaS will automatically scale -- horizontally or vertically -- for you.
I have been playing with Cloud Foundry and Jelastic. I like their promise both individually and what they represent collectively as representatives of the new PaaS offerings for Java. I did not have to change my application code to get my Groovy on Grails application to run on either of them. Apart from specifying a datasource for the database I provisioned in Jelastic, there was no vendor-specific code. All they needed was a war. In both cases, provisioning and deploying was easy. The only thing missing now is pricing -- they are both in free beta -- but as there is no vendor lock-in, I am free to move to elsewhere if pricing is prohibitive.
Cloud Foundry was an obvious first choice for me. It is backed by a big name, VMWare. This is the same company behind everything I'm using: Groovy, Grails, Spring Framework and my current IDE, SpringSource Tool Suite. What's interesting is that Cloud Foundry is open source, sort of an operating system for PaaS. PaaS vendors like AppFog will be offering Cloud Foundry based services.
Cloud Foundry offers services like MySQL, PostgreSQL, Redis, MongoDB, RabbitMQ, and will run applications running on many platforms: Java, Ruby, Node.js, PHP and Python. It is becoming the One Cloud to rule them all: all services, all platforms, all vendors. It's an ambitious, impressive project that has gained the support of a number of companies.
The primary provisioning is a Ruby-based command line tool, but other plugins are available. I have been using the plugin for SpringSource Tool Suite, which lets me deploy from the IDE with just a click. There is also a Grails plugin. What it does not have is a web UI. Deploying with Cloud Foundry is pretty slick, especially with the auto configuration. If I provision a specific database, the act of pushing out my Grails app will automatically configure it with a datasource for that database. I did not need to specify the database connection parameters.
Cloud Foundry has been in a free beta stage for a long time now. One one hand, this allowed it to build a big following. It's so easy to get an app up and running there, and it's been free all this time. On the other hand, it still lacks some things for true production use. The deal breaker for me is the lack of custom domain name support. While you can provision multiple instances of your application node, I also don't know what their plans are for scaling their services, such as when you need a clustered database backend.
Jelastic seems like a less ambitious, Java-only counterpart to Cloud Foundry. While not open source, it is also a PaaS "operating system" that can be used by multiple PaaS vendors. The difference seems to be that while Cloud Foundry is software that is used by PaaS vendors like AppFog, Jelastic seems to be software used by IaaS vendors like ServInt to offer PaaS services. The launch vendors are ServInt and Host Europe: both hosting companies.
There are no developer tools like Cloud Foundry, but Jelastic does have a web console. Deploying on Jelastic is very easy: just upload your war file with the web UI. The Jelastic web UI also lets you provision a load balancer (NGINX), app server instances (Tomcat, Jetty, Glassfish) and databases (MySQL, MariaDB, MongoDB, PostgreSQL). Jelastic also exposes the databases through their respective web admin UIs, such as phpPgAdmin.
Jelatic has an interesting take on auto-scaling. Jelastic will scale the CPU and memory allocations for the app server up and down depending on the server load. This is vertical scaling, and you pay only for the time spent at those allocation levels. You can also manually scale horizontally by specifying the number of app server instances.
Like Cloud Foundry, Jelastic is still in its free beta stage. They are lacking a few things, and you can even vote for your desired feature. But it seems further along in some ways -- I can actually use custom domains -- and they have been talking about launching commercially this month.
The Amazon question
Let's talk about the Beanstalk. If you have read all the right fairy tales as a child, you will know what waits for you at the top of the beanstalk: a giant. And indeed, one shouldn't talk about PaaS without considering the industry's cloud giant, Amazon AWS. Amazon now has its own PaaS offering called AWS Elastic Beanstalk. This is Amazon's integration of their existing AWS pieces -- EC2, EBS, S3, load balancer, RDS -- into a cohesive product. You just upload your war.
What I wonder about the Elastic Beanstalk is what it means for most PaaS vendors. Many PaaS vendors don't have their own infrastructure: they are themselves a layer over AWS. Cloud Foundry may be free, but the commercial vendors like AppFog will be running Cloud Foundry on AWS. Such PaaS vendors have charged for PaaS functionality as an extra cost on top of existing AWS costs. Now that Amazon is offering PaaS as a free service on top of AWS, how can these vendors make money?
I don't think this affects Jelastic: it will be used by independent hosting companies that already have their own infrastructure. These are the sort of companies that already offer managed or VPS hosting today. But for those companies that depend on AWS for their infrastructure, the same AWS that is now their competitor, I have to wonder how they expect to survive.