Oct 14, 2010

measuring bandwidth in linux

Wondering how to measure bandwidth usage on linux, its not that complex just install vnstat. On most linux systems it shows 'fail to start' due to unavailability of database. You need to create one, again even this is very simple.You will see this error on Ubuntu :

No database found, nothing to do. Use --help for help.

A new database can be created with the following command:
    vnstat -u -i eth0

Replace 'eth0' with the interface that should be monitored.

The following interfaces are currently available:
    lo eth0 wlan0


Simple isnt't you know what to do, just use vnstat -u -i I used wlan0 to monitor bandwidth usage for wi-fi. As soon as vnstat starts to gather data, it will start showing up. Voilaaa.....Enjoy.

Sep 4, 2010

Build you own Highly Available Cluster with 'Wackamole' and 'Spread'

By :


Yair Amir
Ryan Caudy
Ashima Munjal
Theo Schlossnagle









This application works on a bunch of virtaul IPs and sees that all these IP remain available on a bunch of machines hosting these IP's. Constraint is that these bunch of machines should be on same LAN. If one machine goes down 'Wackamole' ensures that rest of the machines take over those IP's and all 20 IP remain visible to outer world at all times.

More to come....

Sep 3, 2010

Developing Applications for Twitter using its API.

Twitter is widely used application and I use it a lot and sometime or other I have felt the need to build something of my own to facilitate my style of usage or to actuate upon my ideas. In this post I'll be sharing my journey from a newbie to twitter app developer by sharing each step as I go through.  Hope this helps all those new to twitter API.

Step 1: Register your application with twitter. Here is the link to do that :http://dev.twitter.com/apps/new

 After registration you will be provided with consumer and secret key to be used for authentication. Though during registration process twitter will ask you to provide domain name. It does not means that you need to commit your files to that domain, you can work locally too.

Step 2: Download OAuth library for the language that you'd be using for developement. I am using PHP and downloaded quite a few libraries to try namely : 
 http://classes.verkoyen.eu/twitter_oauth
http://github.com/themattharris/tmhOAuth/

Step 3: Apart from consumer key and secret key there are user_token and secret token, you can see them in your app>>My Access Token

Step 4 : First Example

As a first timer use this example :

and just copy and paste the code to get the feel of the API.
Step 4 : Replace blanks with appropriate values from your app of the following variables :
        'consumer_key'    => '',
        'consumer_secret' => '',
        'user_token'      => '',
        'user_secret'     => '',


Step 5 : Save the file and run in your web browser. I used xampp for server.
Step 6 : Voila !!!! you just updated the status from PHP API.

More to come...
 
 

Aug 29, 2010

What is Fault Tolerance ?

An application having n software modules and n servers is able to function properly even if any of the server or module fails is known as 'fault tolerant'.

What is five nine's availability ?

Very commonly we come across the figure 99.999 % uptime or availabilty. But what actually does it means in practical terms. Here is the explanation :
60 seconds * 60 minutes * 24 hours * 365 = 31,536,000 seconds.in a year
99.999/100*31,536,000 = 31535684.64 seconds
Now : 31,536,000 - 31,536,000 = 315.36 seconds of downtime or approximately 6 minutes of downtime in a year.

What is Scalability ?

In common terms, you develop an application expecting that it will at max can have a concurrency of 100 users or approx. 3000 hits per day and contrary to that, same application starts to get hit in excess of 10000 users daily and is increasing by day. 

If you are able to cover up this increase in no.of users by adding more machines then you are doing 'Horizontal Scaling' on the other hand if you are adding up more powerful CPU or RAM then you are doing 'Vertical Scaling'. Hence, scaling is nothing but increasing resources to accommodate the increase in load.
When a system or web application is able or flexible enough to allow this increase in resources it is known as 'Scalable' and is known to have 'Scalability'.

Aug 28, 2010

Installing Cassandra on Ubuntu

Installing Cassandra

Download and extract Thrift :

1. Install dependencies (Ubuntu)
sudo apt-get install libboost-dev automake libtool flex bison pkg-config g++
 
2. Change to Thrift Directory 
./configure
make
make install
This should install thrift on your system. 



1. Go to http://cassandra.apache.org. On home page there is a link to download the latest stable release. Download the latest version.

2. Save the downloaded file......lets say in /home/Downloads (ubuntu ) .

3. Extract the file to /whereveryoulike/. I use /home/Cassandra62.

4. Change into the directory ... $ cd cassandra62

5. $avemaria-laptop:/home/cassandra62 # : ls

6. Output should be something like this -

bin          conf     DISCLAIMER.txt  lib          NOTICE.txt  test
build.xml    contrib  interface       LICENSE.txt  README.txt
CHANGES.txt  debian   ivy.xml         NEWS.txt     src


_____________________


Now the installation of Cassandra which is pretty easy and straightforward :

cd into directory named 'bin' :
and ./cassandra -f
This will run your cassandra and the output will be shown of the foreground hence the flag -f.


If you see 'Cassandra Starting up' that means your Cassandra is up and running and you are ready to play with her...