Just to clarify, this article is totally based on my understanding and is not an official document about CloudFoundry in any way, feel free to let me know if my understanding is wrong.
Let's first try to answer a question, since we learned previously that Paas is a super cool solution, one might wonder..
Why aren't lot of companies providing Paas solutions?
Building Platform as a Service (PaaS) is fairly complicated since it involves various complicated processes of building, deploying, or maintaining of various activities like orchestration of all the services internally, then abstracting all of that work, and finally, having to market, sell it, and maintain it. Due to the involvement of heavy investment, very few companies have considered building their own Paas solution. Vmware has interestingly made Cloud Foundry service open source.
What has CloudFoundry been orchestrated in?
Interestingly it is orchestrated entirely in Ruby! No Erlang, no JVM's, all Ruby under the hood.
For a nice technical overview, checkout this webinar
Who orchestrates all the components in CloudFoundry?

Rails application works hand in hand with is the Health Manager, which is a standalone daemon, which imports all of the CloudController ActiveRecord models, and actively compares to what is in the database against all the chatter between the remaining daemons. When a discrepancy is detected, it notifies the Cloud Controller - simple and an effective way to keep all the distributed state information up to date.
How is Orchestration of the CloudFoundry platform done?

The router is responsible for parsing incoming requests and redirecting the traffic to one of the provisioned applications (droplets). To do so, it maintains an internal map of registered URL's and provisioned applications responsible for each. When you provision or decommission a new app server instance, the router table is updated, and the traffic is redirected accordingly. For small deployments, one router will suffice, and in larger deployments, traffic can be load-balanced between multiple routers.
The DEA (Droplet Execution Agent) is the supervisor process responsible for provisioning new applications: it receives the query from the CloudController, sets up the appropriate platform, exports the environment variables, and launches the app server.
Finally, the services component is responsible for provisioning and managing access to resources such as MySQL, Redis, RabbitMQ, and others. Once again, very similar architecture: a gateway Ruby daemon listens to incoming requests and invokes the required start/stop and add/remove user commands. Adding a new or a custom service is as simple as implementing a custom Provisioner class.
What glues all these moving pieces together?

This architecture allows CloudFoundry to easily add and remove new routers, DEA agents, service controllers and so on. Nothing stops you from running all of the above on a single machine, or across a large cluster of servers within your own datacenter.
Distributed Systems with Ruby? Yes!Building a distributed system with as many moving components as CloudFoundry is no small feat, and it is really interesting to see that the team behind it chose Ruby as the platform of choice. If you look under the hood, you will find Rails, Sinatra, Rack, and a lot of EventMachine code. If you ever wondered if Ruby is a viable platform to build a non-trivial distributed system, then this is great case study and a vote of confidence by VMware. Definitely worth a read through the source!
Another interesting read would be How Cloud Foundry works when a new Application is Deployed
Next time will try to explain CloudFoundry dynamics with a use case and go more into technical depth of each block.
Nice post Sandeep!
ReplyDeleteDo you know any reference, installation guide... to locally deploy CloudFoundry to a private cloud?
Maybe this is self documented at Git repos but I didn't have yet such a deep sight.
The best place is : https://github.com/cloudfoundry... , you can check installation notes there.
ReplyDeleteOn the blog page, there are many good post to help understand how it works : http://blog.cloudfoundry.com/
More specific, the README found here: https://github.com/cloudfoundry... Has full install instructions.
Also http://support.cloudfoundry.com/entries/20120118-multi-node-cloudfoundry-setup is a good guide..
Nice post, great product.
ReplyDeleteJust wished it was all done in groovy.
It would have been the greatest showcase for a language that VMWare effectively 'owns'.
Cloud Froundry kicks butts nonetheless..
domiko
Great article on cloud architecture, I surely learned a lot.
ReplyDeleteUS VPN
Excellent article. Looks like you have researched through the code. Very nice. Looking forward to future articles
ReplyDeleteRuby powered services are very lightweight and with the use of NATS message system, it can really connect each architecture that allow CloudFoundry.
ReplyDeleteeCommerce Hosting for everyone.
Thanks for posting this very informative series of articles.
ReplyDeleteGood article on Virtualization services .
ReplyDeleteThis comment has been removed by the author.
ReplyDeleteI really appreciate your good post,This is lovely and live post.....
ReplyDeleteSecure Cloud