Table of Contents
Platform as a service (PaaS) is a cloud computing model allowing developers to build and deliver applications over the internet without bothering about the complexity of maintaining the infrastructure usually associated with developing and operating them. Developers can easily access and administer PaaS via a web browser but some have IDE plugins to make using them even simpler.
More elaborately, PaaS is like booking an Uber: You get in and choose your destination and the route you want to get there. How to keep the car running and figuring out the details is up to Uber’s driver. Infrastructure as a Service (IaaS), on the other hand, is like renting a car: Driving, fueling (setting it up, maintaining software, etc.), is your job but getting it repaired is someone’s else problem.
In case you prefer the IaaS model have a look at this article about the top 5 IaaS solutions for hosting Java applications.
Why use PaaS?
PaaS is a cloud application platform that runs on top of IaaS and host software as a service application. PaaS comprises of operating systems, middleware, servers, storage, runtime, virtualization and other software that allows applications to run in the cloud with many of the system administration abstracted away. This allows organizations to focus on two important things, their customers and their code. PaaS takes care of all the system administration details of setting up servers and VMs, installing runtimes, libraries, middleware, configuring build and testing tools. The workflow in PaaS is as simple as coding in the IDE and then pushing the code using tools like Git and seeing the changes live immediately.
By delivering infrastructure as a service, PaaS also offers the same advantages as IaaS but with additional features of development tools.
- Better Coding time: As PaaS provides development tools with pre-coded application components, time to code a new app is reduced.
- Dynamic allocation: In today’s competitive world, most of the IT teams need to have the flexibility of deploying a new feature or a new service of an application for quick testing or to test these on a small section of clients before making them available to the entire world. With PaaS, such tasks have now become possible.
- Develop cross-platform apps easily: PaaS service providers give us various development options for different platforms like computers, mobile devices, and tablets, making cross-platform apps easier and quicker to develop.
- Support geographically: It is useful in situations where multiple developers are working on a single project but are not located nearby.
- Use helpful tools affordable: Pay-as-you-go method allows you to be charged for what you use. Thus one can use necessary software or analytical tools as per their requirement. It provides support for complete web application lifecycle: building, testing, deploying, managing and updating.
Iaas offers storage and infrastructure resources required to deliver to cloud services whereas organizations using PaaS don’t have to worry about infrastructure nor for services like software updates, storage, operating systems, load balancing, etc. IaaS can be used by organizations which need complete control over their high performing applications, startups and small companies with time & energy constraint, growing organizations which do not want to commit to hardware/software resources, applications which see volatile demands – were scaling up or down is critical based on traffic spikes or valleys.
PaaS for Java is well suited as the JVM, the application server, and deployment archives, i.e., WARs or EARs provide natural isolations for Java applications, allowing many developers to deploy applications in the same infrastructure. As a Java developer, we should keep the following points in mind before choosing a PaaS service:
- the flexibility of choosing your application server like JBoss, Tomcat, etc
- able to control JVM tuning, i.e., GC tuning
- able to plug-in your choice of the stack like MongoDB, MySQL, Redis, etc
- the proper logging facility
In this article, we are going compare five PaaS service providers; AWS’s Elastic Beanstalk, Heroku, IBM’s Bluemix, RedHat’s OpenShift and Google App Engine from the view of a Java developer.
Amazon’s Elastic Beanstalk
Elastic Beanstalk allows users to create, push and manage web applications in the Amazon Web Services (AWS) console. With Elastic Beanstalk, just upload your code and it automatically handles the deployment, provisioning of a load balancer and the deployment of your WAR file to one or more EC2 instances running the Apache Tomcat application server. Also, you continue to have full control over the AWS resources powering your application.
There is no additional charge for Elastic Beanstalk. It follows Pay-as-you-go model for the AWS resources needed to store and run your applications. Users who are eligible for AWS free usage tier can use it for free.
Here you can get started with Java application on AWS. Once you package your code into a standard Java Web Application Archive (WAR file), you can upload it to Elastic Beanstalk using the AWS Management Console, the AWS Toolkit for Eclipse or any other command line tools. This toolkit is an open source plug-in and offers you to manage AWS resources with your applications and environments from within Eclipse. It has built-in CloudWatch monitoring metrics such as average CPU utilization, request count, and average latency that you can measure once the application is running. Through its Amazon Simple Notification Service, you can receive emails whenever there is any change in the application.
A downside of Elastic Beanstalk can be the lack of clear documentation. There are no release notes, blogs, or forum posts for new stack upgrades.
Heroku is another PaaS service for easy deployment and scalability of your code. It’s one of the oldest PaaS services but can be compared with Amazon, Google or Microsoft. Heroku allows you to build apps in your way by providing essential tools.
Let’s say you want to use standard libraries with application servers such as Tomcat, Jetty etc. You can do this kind of customization easily with Heroku. By default, Heroku supports Ruby, Node, Python, Java, Clojure, Go, Groovy, Scala, and PHP, but it is extensible, i.e., possible to work with another language by using a custom build pack.
Heroku uses Git to manage application deployments. You just need to push your Git repository to their servers for deploying your application.
Heroku gives some special security services such as the ability to manage environment-specific configurations (such as credentials for banking services). It makes sure your source code is separated from these configurations for greater safety and portability.
For Java Heroku provides automatic session sharing across server instances because each of its server instances is wrapped around a custom Jetty instance. Its developer-friendly focus and commitment allows you to learn Heroku app just in no time at all.
Regarding pricing, Heroku is free for experimenting with cloud apps, $7 per dyno/month for hobby apps and $25 – $500 per dyno/month for professional applications with high traffic. One should be aware of the constraints before developing a Java app on Heroku.
Red Hat OpenShift is based on open source applications with a wide variety of languages, databases, and components. They support a wide range of languages like Java, Ruby, Node, Python, PHP, Perl and more.
Using OpenShift one can rapidly build, deploy and manage Docker images on a robust, scalable platform. OpenShift also gives you full control to a private database instance. One can choose from different databases like MySQL, PostgreSQL, MongoDB, and SQLite. They have pre-coded repositories to a quick start. A simple “git push” command deploys your code to the application.
OpenShift does more than just deployment, and it provides sophisticated tools for managing your entire software lifecycle. It also gives you tools like application snapshots for backing up and restoring applications. Snapshots are stored in tar files which contain the application, local files, and log files. With the OpenShift platform’s built-in integration with Eclipse, JBoss Developer Studio, many developers can develop entirely within the IDE that they are comfortable.
Its pricing is structured as plans like free, bronze or silver plan. The free plan hosts up to 3 web applications in the cloud. The bronze plan is free with optional pay-per-use access to extra resources and silver plan is pay as you go with support system.
With OpenShift you can quickly deploy and run Java applications using your favorite application servers and frameworks.
You can read few blogs on “What you must know not to FAIL” or how Pioneer has adopted a cloud environment based on Red Hat OpenShift Container Platform for their latest car navigation system, Super Route Finder, or how Cisco IT got help from OpenShift when they were getting swamped with app requests.
Bluemix is an implementation of IBM’s Open Cloud Architecture. It is based on CloudFoundry to enable developers to build, deploy and manage their applications through its dashboard. Bluemix supports various programming languages like Java, Node.js, PHP and Python and is extensible to support other languages.
It’s platform also includes middleware services, and automatically provisions new instances of those services. Developers can also scale their applications as workload demands change, use the Bluemix Catalog to access services. Bluemix also has an incredible selection of composable runtime services that work with the runtimes you want to use. They are already installed and licensed on the platform which makes easier for you to instantiate and configure and also they have usage-based pricing.
Bluemix is both an enterprise production platform and a developer’s sandbox. It has virtual machine deployments via OpenStack so that you can control the whole software stack. Pricing of Bluemix is $0.07 USD/GB-Hour and you get 375GB-hours free for 30 days.
A sample app will teach you how to run, modify, test, and deploy a web app to the cloud using Java and Eclipse tools. Their documentation is good (not great, though) but what make things a little confusing are their demo apps.
Google App Engine
Google App Engine (GAE) is a PaaS offering that allows you to build and run applications on Google’s infrastructure. It’s applications are easy to build, maintain, and scale for your traffic data and storage.
As there are no servers to maintain, you can just upload your application, and it’s ready to go. Applications run in a secure, sandboxed environment, allowing GAE to distribute requests across multiple servers and scale to meet traffic demands. You can easily create, develop, test and host different versions of your app in staging and production environments.
App Engine dynamically allows you to allocate system resources whenever there is an actual demand for an application. Google Stackdriver which is a debugger tool that helps you to diagnose and monitor performance of your application. It uses Jetty Servlet container for hosting applications and supports Java Servlet API. Unfortunately version 3.0 with the support for non-blocking IO is still not available, which is the only demerit I can think of now.
You can get started with GAE for Java with the choice of your preferred environment: flexible and standard. GAE applications run as instances within these environments, so pricing is cost per hour per instance. Detailed pricing is explained here.
A few customers share their marvelous journey with Google App Engine like Floreysoft, which brings companies, colleagues, and clients together with Google App Engine, or how Best Buy slashes app development time and resources with Google App Engine.
This table will help you decide which PaaS offering works best for you:
|Properties||Elastic Beanstalk||Heroku||OpenShift(Online)||Bluemix||App Engine|
|Deployment||Public PaaS||Public PaaS, Virtual Private PaaS||Public PaaS, Virtual Private PaaS||Public PaaS, Private Paas||Public PaaS|
|Scaling||Vertical, horizontal, auto scaling||vertical, horizontal||Vertical, horizontal, auto scaling||Vertical, horizontal, auto scaling||Horizontal and auto scaling|
|Runtimes||Dotnet, Java, Ruby, Node, PHP, go, python||Java, Ruby, Node, PHP, go, Python, Groovy, Closure, Scala plus extensible||Java, Node, Perl, Php, Python, Ruby plus extensible||Java, Node, Perl, Php, Python, Ruby plus extensible||Java, Node, Perl, Php, Python, Ruby plus extensible|
|Framework selection||NA||Django, Flask, Grails, Play, Rails||Django, Drupal, Flask, Rails, Vert.x, Switchyard||Rails, Sinatra||Django, Webapp2|
|Services||NA||Postgresql, Redis||Jenkins, MongoDB, MySQL, openshift metrics,postgresql||49 services are available like workload scheduler, internet of things, data cache, API management, etc.||google cloud datastore, Google Cloud SQL, Google cloud storage|
|Infrastructure||Asia, Europe, North America, Oceania, South America||Europe, North America||Europe, North America||Europe, North America, Oceania||Europe, North America|
PaaS for Java has come a long way in these past years. Its offerings are still fast evolving and are utilised more and more. With this knowledge, I hope you will be able to decide which PaaS offering to use.
How to Inject OSGi Dependencies in Custom Portlets in Liferay 7
By Shaik Ismail,
Liferay 7 uses the OSGi framework to provide a dev environment for modular apps. We used this feature to inject Liferay functionality into our portlet.
Building a Lean Modular Monolith with OSGi
By Christian Schneider,
Most projects best start out as a modular monolith (not as costly microservices). OSGi is a good choice to ensure modularity and decoupled services.
Using Java Bean Validation for Method Parameters and Return Values
By Alejandro Gervasio,
Validate arguments and return values of methods and constructors with Bean Validation's ExecutableValidator and automate it with Java EE interceptors.