Comparison of Amazon EC2 & Google App Engine GAE/J

After spending few weeks with some of the Cloud services and reading the comparisons between them, I felt tempted to jot down my own views about atleast two of them.

Firstly, hands down to Google for providing such a brilliant service for free. It gives developers great opportunity to try new things and bring it infront of the people without investing huge amount on that. It also helps Small Business Enterprises to not invest huge into infrastructure and develop application on such a robust platform which is highly scalable without you need to get into the network setup and infrastructure. Not to leave Amazon EC2 services which are a great advantage for people/enterprise who wants to launch a product without investing on the network infrastructure and still being scalable and add more systems when demand increases.

Now on the comparison side, in my view two services are totally different, they may give you the same advantage of you not investing huge into the infrastructure, but they both have their own usages.

Introduction: EC2 service give you access to the boxes in the cloud with the operating system and you do the whole setup required for your application, or you can use the AMI(Amazon Machine Image) and yes even in the AMI’s you can configure your own security if desired.  whereas on the same lines Google doesn’t do that instead you create the application and just ask the App Engine SDK(which also comes an Eclipse plugin) to deploy it, it will deploy the application to one or more of the Google Cloud infrastructure instances and you can access the same once you login into your App Engine url. So in a nutshell, you have full control over Amazon EC2 and you can scale any computer instance to n-instances, whereas App Engine abstracts the instances from the developer and uses SDK for an interface between the developer and the Systems.

Lockin: Here i would like to bring third player Salesforce.com into the picture and then compare all of them. Also as previously mentioned you have complete control over the Amazon EC2 system which might or might not be completely true incase of App Engine as appengine provides lot of services which uses its proprietary api which if used locks you into App Engine, but it has its own advantages which I will discuss later. Similarly Salesforce force.com is mostly locked in as you use its own api to develop and deploy the their cloud. Salesforce has its own custom language and its own SQL/ORM layer.

ThoughtClicks - Comparision of App Engine, EC2 & force.com

Cost Factor: This is one of the important factor need to be considered when deciding between these two choices. Google App Engine has a free quota which is sufficient for applications with around 1 million page views. You can also enable the billing account once you go beyond that point & billing account is also reasonable, Price is based on CPU/hr, Outgoing/Incoming bandwidth, store data & number of emails exchanged etc. Google App Engine Billing Quota Unit Cost. On the other hand Amazon EC2 Services comes with a cost which is again nominal but no free stuff instead pay as you go. You can look at the pricing plan for Amazon EC2 here. but on top of EC2, if you persist some data you need to pay have EBS volume and it again comes for  cost after 1GB and costs $0.10 per GB-month & $0.10 per 1 million I/O requests, which is again very reasonable.

Services Infrastructure: Here Google App Engine gets an edge as it provides lot of ready to use services which comes very handy when you want your application to be up & running quickly, This all doesn’t comes for free instead if you use any of these services they are totally  based on proprietary api which locks you in Google App Engine. Some of the commonly used services are as follows.
1) Memcache – Ready to use cache already available on App Engine Servers, you can use JSR 107 api to 
    add or remove objects from this cache, so this comes as a nice feature without lockin.
2) XMPP – Can be used to talk to any XMPP enable clients like jabber etc.(Proprietary API)
3) Task Queues – This can be used like jms queues to handle tasks without user keep waiting. (Proprietary
    API)
4) Mail – It is again one of the feature which can be used using Java Mail api
5) Cron jobs – You can also run cron jobs in your application(Proprietary API)
6) Authorization – App Engine also give you OAuth out of the box and it can be very easily implemented in
    your application.
As far as i know Amazon, on the other hand doesn’t provides any of its services readily on the system except the mail or maybe cron, but it doesn’t either limits you from creating any such service the way you want.

Reliability: As far as my knowledge both are very reliable options except last year in june when once Appengine was down for more then couple of hours. and both have

Datastore: Appengine at present heavily relies on Bigtable, for which developer needs to think from a totally different angle then how we all are use to using relational databases. It has a JPA & JDO api to access it but it doesn’t supports all the JPA & JDO feature specially the relations part of it. Google also have recently announced that they will soon be launching the App Engine for business with proper SQL Support but again as Amazon it comes at a cost. where as on Amazon EC2 it all boils down to you choice of SQL database you want to use. You can use Oracle, My sql etc which gives you quick and easy development of backend code.

One of my experience using Google App Engine is that it a great resource for a person to kickstart stuff but once product get matured you might want a little bit of more control then provided. Having used Google App Engine for quite some time now, one of the major drawbacks i felt with Google App Engine atleast on the free version is that it recycles the applications very aggressively. Incase your application has very less traffic then you application has very high chances of being brought down when not in use and restarted when the request comes in, this leads to slow response on the initial requests. Developers including me have already requested Google to find different solutions for this. Out of which one is “Pay to reserve a JVM” Please help us by starring this issue.

Also Please keep in mind that Google App Engine does not support complete Java stack instead it does support the complete JRE Class whitelist which enables you to play around with the following Java EE Technologies.

For any issues or support related to App Engine or EC2 you can contact us at: cloud@thoughtclicks.com

HTML 5 Notification Feature

HTML5 is going to be the De facto for the web application and sites like facebook, twitter & not to mentioned Google chrome extensions which is going to extensively use Notification to replace all tab alert based extensions with notification api from HTML 5.

The new Notification API allows websites to send notifications directly to your desktop which can be facebook chat alerts, email alerts with first few lines of email etc. The below post will explain you three different methods which can be used to achieve this functionality. in simple steps. You can try these methods in one html page on any html5 ready browser as Chrome/Safari etc.

First step will be to check if the notification support is there in the browser, which you can do with the following method.

if (window.webkitNotifications) {
  //Notifications are supported!
}else{
  //Notification is not supported.
}

Next step would be to check if user has granted you the permissions to receive notification from your website or your webapp. If you don't have the permissions yet you can request the permission and this whole permission request does makes sense as otherwise there will be popups all over. You can do this with the following code:

if (window.webkitNotifications.checkPermission() == 0) {
  //You have permissions 
}else{
     window.webkitNotifications.requestPermission();//requesting the permissions
}

Note: webkitNotifications is the present name of the method as it is a draft, once it goes live this method name will be changed to Notifications

Once the user has granted the permissions you can call window.webkitNotifications.createNotification method with the icon, notification title & notification content as follows.

window.webkitNotifications.createNotification('tclicks-icon.png', 'Notification Title', 'Notification content...');

That's all you need to do to get the notifications on desktop. Happy Notifying !