Friday, 31 July 2009

Head in the clouds...

Just like fashion software world has its own trends, up and downs. SOA, WebServices, had been popular quite a while. Rich Internet applications is another trend which we were introduced to Silverlight and JavaFX last year. While those topics still popular, the latest trend from tailors of silicon valley is the clouds.
It seems like cloud wars not much far. First of all whats cloud computing, the wiki definition is;
Cloud computing is a style of computing in which dynamically scalable and often virtualized resources are provided as a service over the Internet.[1][2] Users need not have knowledge of, expertise in, or control over the technology infrastructure in the "cloud" that supports them.[3]

So what's new in clouds, weren't the approach known for a long time? Why suddenly everbody building their own cloud?

First of all, cloud covers all the range from a individual developer who has a startup project which he/she doesn't want to invest in, to big firms who want scability, power and still want to delegate the administration and maintanence. Different clouds offer very different options varying from zero to full administration, zero to paid startups, own db implementation to your db vendor choice.

Besides that clouds are good choice because even getting a very basic hosting with Java is quite troublesome and expensive when compared to php and .net.
Adding a jar, deploying a new version will probably make u restart the server and ends up all the apps sharing the server with you.

Fine so far but are the clouds safe, will your data be in good hands, will your application be locked in to that environment and you will have headaches when u want to move to another?

Here are some major clouds and what they offer;

Amazon EC2
Amazon is the most mature platform among all the clouds and can offer great flexibility and is the most configurable one. Unlike others amazon lets you take the full control of the servers. EC2 offers shared disk spaces where you can install, configure, run and maintain your choice of softwares on your own virtual machine. It even supports windows, .net and SQL Server. If you want to keep the administration and setup simple they also have out of the box tools such as SimpleDB which is a schemaless db implementation just like Google's BigTable. Amazon also has a built in queue system SQS. Amazon EC2 expects you to built your services as WebServices which is good for compability and portability.
Everything looks great with EC2 including the pricing. The prices are quite standart and actually when you consider what amazon offers it may be the best deal. However, you even need to pay for the startup, which may not be the best option in all situations

Pros; EC2, SQS, SimpleDB, S3 are all great well thought and mature services. Still if you don't find those capable enough you are free to deep dive and install your own db or vendor specific softwares.Your application won't be coupled to Amazon and will preserve portability. Good pricing.
Cons; It is not free to start so not for individual startups (which can be called as tryups :) ) without investing.

Google App Engine (Java)
I didn't even consider trying app engine when it was only supporting python but now java is supported. This is the easiest cloud to work on. Installing, developing, deploying, administring is also so easy. Just go eclipse update site download the plugin and sign up for a app engine account thats it. The plugin comes with a embedded db which is an implemantation of bigtable, and a embedded server which is an implementation of Jetty and both simulate the production environment well (not exactly but well).
App engine also offers good pricing and also its free until the application reaches the quota (which is quite reasonable). So you can even use it for free basic hosting. The biggest drawback is that it is a subset of java and doesn't offer a full relational database. So your application must be designed or modified to be able to run on App engine.
App engine shines on admınistration unless u want to control everything on your own. There is no administration, no maintanence and very little to configure.
Just like SimpleDB of Amazon, Google offers a schemaless datastore, BigTable. BigTable is fast efficient supports JPA/JDO but doesnt support full relational designs. It is a hierarchical datastore and istead of relations you need to understand hierarchical relations between entities and denormalized data. App engine is the hardest part to migrate for a standart Java Developer, however, if you succeed to understand the basics and move on, it offers fast, reliable and easy to maintain datastore. As google says Bigtable is the system which all google apps use internally, so do not need to worry about performance or design issues and better to learn how it works.
Other unsupported features are; : no threads, no network connections, no webservices, no file system writes, no java2d, no native code, no java2d but images api can be used instead. Soon support for async and queue api will be available. Besides those reflection is also limited. Reflection can be used as long as it is used for your own classes, but if your application tries to use reflection on runtime and system classes, app engine does not allow that. Actually the frameworks and librarires I tried which did not work, failed mostly because of reflection. The good side is most of them are getting patched fast to work on app engine, such as BlazeDS, Jersey, Xstream. Many well known libraries work out of the box, such as, guice, spring, aspectj,spring, grails, gwt, tapestry, jruby, jython...etc
Pros; very easy to start, develop and deploy. Great for zero startups, makes no excuse if you have a project idea. It is java!
Cons; Not whole java stack and libraries supported, bigtable needs a different approach to design than relational databases. You may end up leaving your favaourite library because it doesn't work and your application will definitely be tied to app engine.

Microsoft Azure
I would be very suprised if microsoft didn't have one, they even compete with webcam, keyboard and mouse producers. Azure is definetly a .net cloud and offers good and easy integration with visual studio developers. Microsoft is an implementor rather than an innovator for long. They are not doing bad at following Amazon. They offer their own Service bus, support web services and back ground processing.
Pros; well if you are a C#, MSSql developer it will definetly be your choice, other do not offer a lot more to convert you from the dark side (just kidding :) no offense)
Cons; well if you are not than the azure doesn't offer much to convert to dark side.

Sun Cloud
Sun's cloud is really a cloud now, but seems promising. What they plan to built seems promising, full stack java with full support to all Java standarts. They have good experience on OS with Solaris. However they can't even provide developer accounts yet (at least i have been waititng more 1.5 month). Need to wait and see, hope they wont miss the train by that time.
Pros; sun is java, they will have good support with full stack of java.
cons; it is a real cloud now (doesnt exist), and i wonder what oracle plans about it.

Actually there are some other cloud alternatives in the market such as GoGrid and AppNexus. To be honest I personally didn't have much experience on those and frankfully I would consider a big name behind the cloud, since i am going to give them all my data, application and alter my application on that cloud implemtation.
So far it seems Amazon is good for a full java project built on web services which has a budget. However, Google App Engine is great if you have zero startup and no problem on building it on BigTable and it also offers very fast development. Of course Azure is great if you are on .net side...
So there is a cloud for everyone..