Sunday, October 31, 2010

some things are special

Because of your beauty, there's rain in my summers
because of your dreams, there are waves in my heart
when you swing your hands as you speak
there's a storn in my heart

when love happens, there's a naughtiness in one's eyes
I acted a bit, suffered a bit, and enjoyed the time.

because of your eyes
my step falters, my eyes wander
what is this new yearning?
even if it hurts, the heart wants more

w/o a word, look at me
let your moments get longer
without thinking, close your eyes
let the intimacy continue

In my mornings, I should wake up looking at your face
In my evenings, I should fall on your lap and end my day

Saturday, October 30, 2010

Socket Direct Protocol

SDP is a wire protocol to support stream sockets networking over IB. It utilizes features such as RDMA for high performance data transfers and provides higher performance and lower latency compared to IP encapsulation over IB (IPoIB). A long standing request has been to add implementation-specific support to the JDK to make it easy to use SDP in Java Language applications. As SDP provides a streams sockets interfaces it can be made transparent to applications using java.net.Socket/ServerSocket and of course the stream-oriented SelectableChannels and AsynchronousChannels in the channels package.
The simple solution in jdk7 uses a configuration file with rules to indicate the endpoints that are connected to the IB fabric for when SDP should be used. When a java.net.Socket or java.nio.channels.SocketChannel binds or connects to an address that is an endpoint on the IB fabric then the socket is converted to use the SDP protocol. The solution can be thought of a kind of built-in interposer library and using an interposer library is an alternative way of doing this.

There are two types of rules, as follows:


A "bind" rule indicates that the SDP protocol transport should be used when a TCP socket binds to an address and port that match the rule.
A "connect" rule indicates that the SDP protocol transport should be used when an unbound TCP socket attempts to connect to an address and port that match the rule.
A rule has the following form:


("bind"|"connect")1*LWSP-char(hostname|ipaddress)["/"prefix])1*LWSP-char("*"|port)["-"("*"|port)]



The first keyword indicates whether the rule is a bind or a connect rule. The next token specifies either a host name or a literal IP address. When you specify a literal IP address, you can also specify a prefix, which indicates an IP address range. The third and final token is a port number or a range of port numbers.


Consider the following notation in this sample configuration file:


# Use SDP when binding to 192.168.1.1
bind 192.168.1.1 *


# Use SDP when connecting to all application services on 192.168.1.*
connect 192.168.1.0/24     1024-*



The first rule in the sample file specifies that SDP is used for any port (*) on the local IP address 192.168.1.1. You would add a bind rule for each local address assigned to an InfiniBand adaptor. (An InfiniBand adaptor is the equivalent of a network interface card (NIC) for InfiniBand.) If you had several IB adaptors, you would use a bind rule for each address that is assigned to those adaptors.


The second rule in the sample file specifies that whenever connecting to 192.168.1.* and the target port is 1024 or greater, SDP is used. The prefix on the IP address /24 indicates that the first 24 bits of the 32-bit IP address should match the specified address. Each portion of the IP address uses 8 bits, so 24 bits indicates that the IP address should match 192.168.1 and the final byte can be any value. The -* notation on the port token specifies "and above." A range of ports, such as 1024—2056, would also be valid and would include the end points of the specified range.


The final rules in the sample file specify a host name (hpccluster), first with the port assigned to an http server (80) and then with the port assigned to a MySQL database (3306). Unlike a literal IP address, a host name can translate into multiple addresses. When you specify a host name, it matches all addresses that the host name is registered to in the name service.

Once the configuration file is created we simply specify it when running the application, 
     eg:$ java -Dcom.sun.sdp.conf=sdp.conf -Djava.net.preferIPv4Stack=true MyApplication
Note that this example also sets the java.net.preferIPv4Stack property. The Java Runtime always uses IPv6 sockets if IPv6 is enabled. The Solaris implementation of SDP supports IPv6 addresses but currently doesn't support IPv4-mapped IPv6 addresses (::ffff:192.168.1.1 for example). For now this means setting the property so that all sockets are IPv4 sockets.



To test that SDP is enabled, use the sdpadm(1M) command:
% /usr/sbin/sdpadm status
SDP is Enabled
Other commands you might find useful are ib(7D), ibd(7D), and sdp(7D).


You can use the grep command to search the /etc/path_to_inst file for the string "ibd" to view a list of IB adaptors that are supported on your network.

new tune

C  C          C E  D          C   E  D      B  B  B  C C  C  E  D        
C  C  E  D         E  F   D C  C  E  D  
C C  E  D            B  B  B         C
B  C  D  G   G   A             F  E  D
F  G   G   G  G       D  E   F   E   F
E   G   G   G   G              D   E   F   E  F
A   C’  B  G                 G   A   A   F
E   F  A                    G  F   E   D
E   E           E   F         G   G        
G   A   G   F   E D  E           E   E   E  G            
F   E E  E               G   G   G   G          
C’   B   G   F E   F              
A  G   G G  A                  
B   C’  C’  C’   C’            G   A              
F   G   B   B   C’   C’  C’  B      
G   A   G   G   G   A  B   A                  
F  F   G   A   G D   D   E  G          
F   G   F   G   D

Info on 64-bit processors

Without a scientific set of benchmarks this one is really hard to measure. Some people think one distribution "feels" faster than another while others disagree. Suffice to say that no one has yet to prove scientifically that the 64-bit versions of Linux available today are significantly faster in performance than their 32-bit counterparts. Most "64-bit" versions of software are actually just recompiled versions of the 32-bit code, with no optimization that would take advantage of the new features these chips offer and perhaps boost performance. If you're looking to use 64-bit because you think it will be a major improvement in speed, I would reconsider.
 Not all software runs on 64-bit Linux. Although there have been 64-bit native Linux distributions for several years (a year before Microsoft Windows XP64, but I digress), the software community has yet to fully embrace the technology. As of the time this post was written, there is no 64-bit version of the Macromedia Flash Plug-in for your web browser, for instance. WINE and the Java VM have been known to cause problems on some 64-bit installations as well. Not all hardware has 64-bit drivers yet. The two major display card manufacturers do have X86_64 versions of their drivers, but they are sadly the exception rather than the norm.
If you plan on using a machine that has more than 4GB of RAM, you'll need to use the 64-bit version of your distribution because 32-bit operating systems are only able to handle up to 4GB, maximum*. There's just not enough memory addresses for more. This is usually not a problem for desktop users, but it might be a concern for servers or high-end workstations. 
 As Apple Computer has proven in recent years, there's an awful lot people will do just because something looks or feels "cool". This is perhaps the one reason why some people choose to run 64-bit Linux: it's a neat idea. To some people the idea of running a 64-bit native** operating system on their 64-bit CPU is just too cool to pass up. These people understand the drawbacks to running a bleeding-edge system and accept the extra work involved. 
Although 64-bit Linux distributions are now by and large on-par with their 32-bit brethren, they do not yet surpass them in performance. You're not running at as much of a deficit with 64-bit two years later, but you still don't quite have an advantage either. Now, I think, rather than strongly suggesting 32-bit I could say either will work, but neither has any significant advantage over the other. It's more a matter of personal preference.
Detail info on this can be gathered from :: http://en.wikipedia.org/wiki/64-bit

Sunday, October 24, 2010

HTLML 5 WEB SOCKETS

I have been reading a lot about HTML5 & the features that it brings to the developer table , one of the main area in which I have been digging in is to learn about Web sockets . So I thought of sharing the details that I have got to learn about it .
What are Web Sockets ?
                Web Sockets feature that comes with HTML 5 is a new proposal that full-duplex, bi-directional client-server interaction over a single TCP connection. The main goal of this proposal are as below
[a] Increase in Web Server connection
[b] Simplifying the AJAX code

Before explaining about the above points I would like to explain about the other applications that support this functionality but in a much trickier way.

The other applications that I have came to know is COMET which in practice in most often implemented through AJAX and long polling. COMET makes use of  technique of server push using standard browser functionality. With LONG POLLING, the client requests information from the server in a similar way to a normal poll. However, if the server does not have any information available for the client, instead of sending an empty response, the server holds the request and waits for some information to be available. Once the information becomes available (or after a suitable timeout), a complete response is sent to the client.
The above information tough provided won’t be sufficient enough for explaining about the LONG POLLING & COMET one can refer the links to get more idea on the same.

Now the techniques that is mentioned above are a kind of hacks as it makes use of AJAX , pooling as this would mean multiple AJAX request being send from the client to the server & keeping that connection open by using long pooling technique to get real time data.

Web Socket supports a much simpler interface that enables client and the server sends messages to each other in a much simpler way.

Google’s Chrome browser already provides WebSockets and developers can expect to see the technology in other browsers in 2010

A  simple way to check whether the browser supports Web Socket is by using the below code
if("WebSocket" in window)


HTML5 web socket example 

Step 1: Create a WebSocket with a valid URL

Creating a new websocket connection to a web socket server
var newWebSocket = new WebSocket("ws://abc.xyz.com");
ws:// è web socket connection
wss:// è secured web socket connection
Default port for
WebSockets è 81
secure WebSocket è 815.
Now comes the times to attaché few callback functions
newWebSocket.onopen = function(evt) {
alert("Connection open..."); 
};
 
newWebSocket.onmessage = function(evt) {
 
alert( "Updated data : " + evt.data);
 
};

newWebSocket.onclose = function(evt) {
alert("Connection closed."); 
};

Step 3: Send and Receive Data
To send a message to the server, simply call the postMessage method on the webocket with the content you wish to send to the server.
stockTickerWebSocket.postMessage("hi there);
This will send the message to the server. Any message coming from the server will be delivered to the onmessage callback registered above
When completed, call the disconnect() method to close the WebSocket connection.
newWebSocket.disconnect();
As demonstrated in the example above, there are no HTTP requests made to the server from the client side to retrieve data, instead the data was pushed to the client from the server - when it becomes available.
When a new WebSocket connection is established the browser opens an HTTP connection to the server first and then negotiates with the server to upgrade the connection to a dedicated and persistent WebSocket connection. This process automatically sets up a tunnel through to the server  passing through all network agents (proxies, routers, and firewalls) in the middle (very much like HTTPS establishing a secure, endtoend connection), solving numerous issues that the various Comet programming techniques encountered. 


So this is it ,  a very basic understanding for the Web Sockets feature that HTML 5 provides will be posting more updates on this and the other features in the near future.