Saturday, April 18, 2015

AWS Beanstalk basics

What is AWS Beanstalk:

                AWS elastic beanstalk is an AWS product to manage and deploy web application in Amazon infrastructure. Beanstalk manages the application stack for you, so you dont have to worry about spend the time managing and configuring servers, databases, load balancers firewalls and networks. Beanstalk also takes care of autoscaling You can use the following languages, Java .Net, PHP, NodeJS, Python, Ruby etc.,
                Once you configure to deploy, AWS takes care of capacity provisioning, load balancing, autoscaling and health monitoring.
                Beanstalk depends on other AWS services such as AWC EC2, Autoscaling, ELB, S3 etc., YOu can use Cloudwatch to monitor the performance of the infrastructure.
How do I get started.
You can use the AWS Elastic Beanstalk CLI or Beanstalk API. AWS also provides Toolkits

Features


  • Directly deploy applications from your local desktop to cloud using AWS CLI or eclipse plugins.
  • Monitor performance metrics of the instances using Cloud watch
  • Autoscale applications using Elastic load balancing features.
  • Access server log files without logging into the server
  • Option to choose the instance server configuration such as memory size, disk space etc.,
  • Implement HTTPS on the load balancer in an easy way.

  • Java applications using Apache tomcat.
  • PHP using Apache Http server.
  • Phython apps using Apache http server.
  • NODEJS applications
  • Ruby applications
  • .net applications using Microsoft IIS server.

AWS is working to extend to support multiple development stacks and programming languages.

  Cost


.               There is no additional charge for Elastic Beanstalk - you pay only for the AWS resources needed  to store and run your applications.You normally pay for the services such as EC2, S3, load balancing etc., 

Friday, April 17, 2015

Cassandra basics


What is Cassandra: 


Cassandra is a highly scalable open source NOSQL db. Cassandra is designed to handle big data workloads across multiple nodes with no single point of failure. Each node exchanges information across the cluster every second.

Characteristics: 
  • Distributed in nature. it is based on masterless architecture, 
  • Every single node is independent. It shares nothing with the other node. Each node is responsible for a portion of the dataset. If you need more capacity, add more nodes. 
  • Fully replicated. Client writes in local, data synchronises across the other nodes. 

What happens when you write or read to Cassandra. 
  • A sequentially written commit log on each node captures write activity to ensure data durability. 
  • Data is then indexed and written to an in-memory structure, called a memtable, which resembles a write-back cache. 
  • Once the memory structure is full, the data is written to disk in an SSTable data file.
  • Client read or write requests can be sent to any node in the cluster. When a client connects to a node with a request, that node serves as the coordinator for that particular client operation. 
  • The coordinator acts as a proxy between the client application and the nodes that own the data being requested. 
  • The coordinator determines which nodes in the ring should get the request based on how the cluster is configured.

Key terminologies: 
  • Node: where the data is stored. 
  • Data center: Collection of nodes. 
  • Cluster: contains one more more data centre, can span physical locations. 
  • Commit log: data written to commit log for durability. 
  • SSTable: Sorted string table which are append only, and stored on disk sequentially. 

Key components: 
  • Gossip: Peer to peer communication protocol which nodes use to discover and share information about other nodes in the cluster. The gossip process runs every second and exchanges state messages with up to three other nodes in the cluster. So all nodes learn about all other nodes in the cluster. 
  • Partitioner: determines how to distribute data across the nodes in the cluster, each row of data is identified by a partition key and distributed across the cluster. 
  • Replication factor: determines how many copy of data is stored in the cluster.  

——————————————————————————————
Installing
——————————————————————————————


Monday, March 30, 2015

video streaming basics

Video streaming is a process by which the video content can be sent from one device / server and viewed from another device. 

The following are different types of streaming methodology: 
  • Downloading
Entire file is downloaded in the client side to view it. 

  • Streaming
The user can start seeing the video as it arrives, no wait is required. 

  • Progressive downloading. 
The file whenever it is partially downloaded is available for viewing. 

Types of streaming: 
  • http streaming

Http streaming is a good option when you don’t need to stream live vide, it only works with files available on the server. Just upload the file in the server and include html markup tags to stream video file in your fav html5 player. 

  • true streaming
True streaming has advantages such as the ability to handle much larger traffic loads, ability to detect users’ connection speeds and supply appropriate files, ability to broadcast live events. 

There are two ways to have access to a streaming server:
  1. Operate you own server (by purchasing or leasing)
  2. Sign up for a hosted streaming plan with an ISP (Internet Service Provider)


Some streaming media softwares: 

  • Helix Universal server from real networks
  • Apple Quicktime streaming server. 
  • Macromedia communication server. 
  • Wowza streaming server 
  • BrightCove
  • Red5
  • Adobe

Tuesday, March 24, 2015

Cloud foundry Basics

CloudFoundry: 

CF - an openPAAS that has an IAAS underneath it. The alternates - Google App engine and Azure provides similar services but limits you to specific languages, APIs and environments. The IAAS supported by Cloud foundry are: 
AWS, vSphere, vCloud, OpenStack. 

(Buildpacks)  Frameworks supported: 
  • Java - Spring, Grails, Play etc., 
  • NodeJS
  • PHP
  • Python
  • Ruby

Cloud foundry is now owned by Pivotal Software. We can use CF either as an open source or as Pivotal software commercial product. 

  1. as Open source. 
  2. as a Pivotal software commercial product. 
  3. as an instance in AWS. 

What is CLI: Command line interface. A way by which you can push applications to cloud from you local system. 

Alternatives / limitations to cloud foundry: 
  • AWS Beanstalk + other services: Well integrated with other AWS services such as RDS - seems to be more matured PAAS, S3, Monitoring tools available out of the box.  The problem is its slow in responsiveness, requires understanding of AWS concepts. 
  • Windows azure: Many options for frameworks, but Windows default option. 
  • Google app engine: well integrated with Google service, but force you to learn too much about google cloud, java support limited
  • OpenShift from Red hat: Open source, CI directly integrated but WAR file support requires SCP

Why Cloud foundry: 

  • Choose from a range of frameworks, Java stack best in class, latest versions updated, Scales well, support from community, updates available very often. 

Monday, March 23, 2015

HTTPS basics

HTTPS is a protocol which works in tandem with SSL
HTTPS = HTTP + SSL

New portocol to handle secure data is called SSL: (Secured socket layer)
The data that is sent from the web browser to the server is sent over a network provider. 

It is possible for someone to see the data one might send over the network. If the data is sent is secure such as bank information, its possible for someone to misuse it. 

SSL takes care that the data sent over the internet is secure. 

What is cryptography ?

Cryptography is the science of concealing information so that it can be retrieved by another person using some mathematical logic. 
The actual text to be converted is called plain text and the transformed text is called “encrypted” or "cypher" text. 

The logic applied to transform data is called encryption algorithm. Normally another string often called “keystring” is used by the algorithm. 

The person on the other side needs the algorithm used for encryption and most importantly the keystring.

The key is symmetric if its the same string used for both encryption and decryption. 

Symmetric example: A locks the box using a key called “X” and which is unlocked by another person using the same key “X”. 
Problems with the above approach: 
  • We cannot use the same key “X” for all the data. 
  • How do we even send this key to a person among millions. 

It is possible to encrypt the data using one key and decrypt them using a different key. 
Key used to encrypt is called public key and 
key used to decrypt is called private key. 

The later approach is called Asymmetric approach. 

The server can distribute public keys to any number of users who wants to send data, while the key used for decryption is called private key and is kept in the server (not shared with any user). 

How it works: 
  1. User initiates a https request in the browser. 
  2. Browser makes a TCP connection to the server using port 443. 
  3. SSL handshake starts: 
    1. Browser sends client hello message (SSL version supported by browser, compression method, suite of cyphers it can use, sends random data that can be used for generating the symmetric key for the session). 
      1. Server sends back the server hello message (SSL version used by the session, cypher used, compression used and the session id, random data - used for key generation msg). Finally it sends a digital certificate. 
          1. The certificate contains the following information (contains public key of the server, browser uses them to encrypt the data sent to the server, chain of authority that used to generate the certificate). 
          2. (establishes the identity of the server that sends the data). 
    2. Server sends the “SERVER HELLO DONE” message to the browser. 
    3. Browser sends “CERTIFY VERIFY” message to the server saying that the browser has verified the CERTIFICATE. 
      1. Browser sends the “CHANGE CYPHER SPEC” command (i.e., from now on the data sent over the network to the server from this https session will be ENCRYPTED).
    4. Browser sends the finished message. 
    5. Server sends the “CHANGE CYPHER SPEC” command (i.e., from now on the data sent over the network to the browser from this https session will be ENCRYPTED).
    6. SSL handshake is complete. 
  4. Sending Data over the network
    1. Browser generates a secret symmetric key used for this SSL session. 
    2. Browser encrypts this secret symmetric key using public key sent by the server and sends it to the server. 
    3. All the data henceforth will be encrypted and decrypted using this secret symmetric key. 
    4. In case of any issues, the SSL connection is terminated and the browser throws an error. 


Thursday, June 19, 2014

2-way Data binding


A model is a javascript object (data holder) which holds information for the view to render and controller to process. To define a model, just assign them to $scope scope. 

Example:
$scope.ename="Deiveehan Nallazhagappan";

The values can be single value, any valid javascript object or even an array. 

<body>

A controller is a AngularJS javascript object which is tied to the view. Its main responsibility is to provide default values to the model and supplement them with more UI specific functionalities. 

<div ng-controller="Student">
Enter your name : <input type="text" ng-model="ename">
<br>

Hello {{ ename }}
</div>


<script type="text/javascript" src="../js/lib/angular.min.js"></script>
<script type="text/javascript">
var Student = function($scope) {
       $scope.ename="Deiveehan Nallazhagappan";
}

</script>

Note:
--       ng-controller is an attribute used to map a controller to a view.
-          The controller object is available only to that view.
-          $scope object in the controller is a special object which contains custom models. In this case, the ename attribute is available in the scope object which is available only to that div having the controller.

In the above code, the ename attribute is modified when the page loads. This is done using the sentence

$scope.ename="Deiveehan Nallazhagappan";

And the data is updated both in the label and the text box. And whenever you modify the data in the textbox, the data is updated in the model.
This is called 2-way data binding and is a very important feature of AngularJS. 





Hello AngularJS

This article explains how to get started with AnglularJS and develop a simple application

Step 1: Include angular js file
Step 2: Include ng-app attribute (bootstrap our application.)
Step 3: Include ng-model attribute that need to be mapped to view.

Source:

<!DOCTYPE html>
<html ng-app>
<head>
<meta charset="ISO-8859-1">
<title>Insert title here</title>
</head>
<body>

Enter your name : <input type="text" ng-model="ename">
<br>

Hello {{ ename }}

<script type="text/javascript" src="../js/lib/angular.min.js"></script>
</body>

</html>


Whenever you type anything on the text box, the value gets bound to the model and in the code, we display whatever is present in the mode.

Note:
-          {{ ename }} is angularJS expressions where ename is model attribute. Ename is bound to the text box as well, so whenever the text box is changed, the model attribute value is changed and vice versa.
-          ng-model is an attribute used to bind the model with the view.

-          All the special html tags and attributes are called as “directives” in angularJS.