Thursday, May 10, 2012

Load Balancing and Auto Scaling in AWS

Amazon ELB and AutoScaling

The Amazon Elastic Load Balancer Service supports HTTP and TCP requests. It now supports sticky sessions via cookies so it should be much more usable as many applications require sessions to be routed to the same server.
HTTPS is supported indirectly via using TCP and port 443. ELB directly forwards the TCP packets to the instance. Because support is at the TCP level, not at the HTTPS level, the ELB will not:
- perform SSL termination
- add an X-Forwarded-For header (which the HTTP listener does)
- optimize connections from your back-end instances using keepalive.
This means, for example, with HTTPS you cannot get the client's IP address from the X-Forwarded-For header as with HTTP

The Amazon Auto Scaling service uses CloudWatch as the monitoring mechanism for determining to scale up or down.

Costs of Elastic Load Balancers are from $0.025 hr ($18.25 mth) and a small cost for GB processed plus Cloudwatch cost per instance $0.015 hr ($10.95 mth). So this is typically cheaper than running load balancing on your instance.

Summary: Cheap, reliable, scalable bare bones scaling solution.

Scalr

Scalr is another popular load balancing/scaling solution. It can be run from the Scalr website for $99 a month (it is creeping up in price from $50 a month) or you can run your own copy of Scalras it is open source. The website also provides some management features like scripting and SSH access.

The Scalr architecture is built around several Amazon Machine Images (Small or Large) and targets multi-tier applications
1. Load Balancer runnning Nginx for the load balancer. They also support HTTPS. It is possible to use other load balancers like Pound.
2. Application Server Image - LAMP/Java Tomcat/RubyOnRails.
3. MySQL Master/slave for the database.
You also need to do administration of Amazon EC2 through the Scalr platform.

Scalr has some nice features like time based scaling, auto deployment of updated Amazon Machine Images. They have some pre-defined machine images so if your application matches these it will be faster to setup. (NOTE: Currently Amazon's RDS does not support MySQL Master/Slave while Scalr does )

Summary: More features that Amazon Elastic Load Balancer/Auto Scaling. Still relatively cheap and open source so you can always run it yourself although easier to use through their website.

Cloud Foundry

Cloud Foundry is a great platform for deploying and auto scaling java applications. It is specify to Java applications supporting:
    Java 1.6
    Apache 2.2.3
    SpringSource tc Server (Tomcat 6)
    MySQL 5.0.45
    CentOS 5.2

The Apache HTTP Server load balances over the Tomcat servers and it uses Hyperic to monitor the servers and auto scale the Tomcat servers. It support MySql Master/slave configuration for scaling the database. The database is stored on an Amazon EBS and automatically backed up to S3. (Similar to Amazon RDS). Currently it is in extended beta and free.

Summary: The fastest way to deploy and run Java your applications. Restricted to their particular java software stack but a great platform if your application matches this stack.

Rightscale

RightScale was the first company to provide load balancing and Scaling of Amazon EC2. They are also the most expensive from $2500 up-front and $500 a month.
They have a powerful scripting and templating system and their platform is more comprehensive than Scalr. The scripting however is also complex and proprietary. They support other clouds like Rackspace etc.
RightScale provide an Apache+HAProxy setup for load balancing and also will automatically setup a MySql Master/Slave database as does Scalr.

Summary: If you have complex/large scalability requirements and Rightscale have pre-built scripts and templates for your application then they are a good option.

Others

Makara provide scaling, monitoring and deployment of Java and PHP applications. Similar to Cloud Foundry in some ways. Now they are owned by Redhat good for Redhat and CentOS users.

Cloudkick provide management, auto scaling, monitoring and alerting. Now they have been acquired by Rackspace good for using with Rackspace cloud. 

DynamoDB - Data as a Service

In Data as a Service we now have a solution to the cloud database scalability problem and we could be ushering in the era of cloud applications!! 

Within the next few years a Data as a Service (DaaS) capability will become central to Cloud Computing offerings. DynamoDB data service can be configured to scale up to very large transaction rates and database sizes with consistent performance. Amazon competitors will need to have an offering.

The future of cloud applications could be:
1. Define and store data in Data as a Service like DynamoDB.
2. Run the the application in a PaaS like cloud foundry. 
3. Use analytics applications like Hadoop (like Amazon Elastic Map Reduce) for Analytics directly on the Data as a service. 

The could mean:
1. Theoretically infinite scalability of applications 
2. Just paying for the amount of infrastructure you need
3. Radically reduced setup time for applications
4. Reduced number of Operations staff to manage the database....

Currently many applications are build use Object relational mapping through software like Hibernate. Hibernate is developing NoSQL support so these applications could be ported onto Data as a Service platforms. Although I am sure developers will need to make coding changes to be able to use the power of these Data as a Service offerings. 

Will we see packaged products that use Relation Databases (e.g. Content Management Systems) move to NoSQL implementations? Alfresco seems to looking into it. 

When we start to see major packages like e-commerce packages like Magento, Content Management Systems like Alfresco support NoSQL Data as a service like DynamoDB we will know we are on the way to the new era of cloud applications.... 

It is no coincidence that Oracle have announced a NoSQL capability too!!!

Boot, reboot, and shut down a Linux system

1) Shutdown the system immediately. 
# shutdown -h now

2) Reboot the system now
# shutdown -r now

3) or you can use reboot command 
# reboot

4) Delayed shutdown by 2 minutes
# shutdown -h 120

5) Shutdown at 10:00PM 
# shutdown -h 22:00

6) Requests that the system be powered off explicitly. 
# shutdown -P now

7) Force the filesystem check during reboot
# shutdown -Fr now

In CentOS/RHEL 6, with new Upstart utility both poweroff and halt commands pointed to reboot command. These programs allow a system administrator to reboot, halt or poweroff the system.

# shutdown -P now
is quite equal to
# poweroff

and

# shutdown -r now
is quite equal to 
# reboot

How to recover the Root password for Centos

You may forget the Root password which is hard to believe, but it does happen everyday. here is the tips to recover the root password for Centos.


no way to get root access.

Now, restart the VM and boot to the geekmode.  by press any key, or CTL+X to the grub mode.



Now, Press ‘e’ to edit the command line. we need tell the kernal boot from graphics mode to single user mode
user arrow key up/down to select the kernal line, 



Press e, to edit the command line, you will see the follow screen,
Now, it is on the grphics mode, rhgb=red hat graphical boot 

Let’s change it to single user mode, by replacing the rhgb quiet.
Before, 

after


Press enter to switch the parent screen. then press b to boot the single mode kernel, you can tell linux single is there



Once Done, you are in single user mode.
remember the password this time, no typo please.



now you can type new root password.


enjoy....!!!

Basic understanding for cloud computing

Your Reviews/Queries Are Accepted