Monday, 7 January 2013

Fuse ssh filesystem, context switching and other things

I am making a blog post after a long time.

1st thing : SSH fuse fs


ssh fuse filesystem is great. Today i installed sshfs on my ubuntu desktop and mounted the home dir of my remote linux server on my desktop. Voila , it worked.  The best thing about this is that there is zero configuration to be done on server side. Now it appears as just another local file. I thought there would be lag since file needs to be fetched from remote server over internet. But nothing like that happened. I was continuously playing audio files for last 2 hours since i installed and mounted the remote fs, there has been no lag so far.  I mounted the fs thus,

sshfs -p port user@ip (or domain name):/remote/dir /local/dir >

Also i added myself to fuse user group. By
(one time setup and i am not sure if this is required , but ubuntu docs says to do it)
sudo gpasswd -a fuse

In case you dont want to run the sshfs command manually, you can add a line to /etc/fstab to auto mount on boot.


2nd Things: Context switching, finding the how much and which


Context switching maybe a costly affair if there are a lot happening. You can find out context swtiching amount with the vmstat command. vmstat is more amazing than i thought. Basically because i thought vmstat man page would be cryptic and  huge. But to my suprise , it written in simple and short. If you run

vmstat 

then the there is a 'cs' column in output. This tells how much of context swtich is happening.

Another awesomeness of vmstat is when it is run on Virtual Machine OS. Here it has a 'st' column, which is the amount cycles stolen from VM.  Read the man page for more useful and interesting options like the -d which shows disk stats.

Now that you know the amount of context switching happening , you may be interested in knowing the processes and context switching. For which the pidstat command from sysstat package. The following command list the processes and their context switching:


pidstat -w

Among other details , It has two columns : cswch/s and nvcswch/s
cswch/s is voluntary context switching per second
and
nvcswch/s is involuntary context switching per second

If you want to thread level details then add the 't' option.

3rd thing: My searches and unsolved things


I see that many a times my ssh freezes and drops me back to originating shell with the messgae:

write failure: broken pipe

Searches indicate that it could be a network issue. The solution they suggest is to add a ServerAliveInterval number_in_secondsto ssh config file on client side. It is basically a keep alive setting. 

Running sestatus on a linux VM running centos 6 suprises me. It says command not found.  So does this mean VM's cannot have selinux ?
I wanted to try a internet search engine that is not one of the usual 3 (google, bing or yahoo search). I came across :

  • clusty, 
  • dogpile (meta search engine that collects results from the usual 3)
  • duckduckgo ( combines its own search results with the results of the usual 3)


I started to hate this endless scrolling thing that now all sites seems to be doing. As far as i know, it started with facebook and now everybody seems to doing it. I hate it. I liked clicking on next button at the bottom of the page. 

No comments:

Post a Comment