Re: ssh in C++

From: Leandro Franco <lfranco_at_cern.ch>
Date: Thu, 14 Aug 2008 15:42:28 +0200


Hi,

I would be very (very) careful when using sshfs over a high latency connection. Fuse splits the data requests in chunks as big as the page size (i.e. 4KB) so you might end up with thousands of requests for a very simple operation and if you combine that with a round trip higher than 1ms then you will see a considerable slow down in ROOT (if latency is higher than 10ms you will probably think it's dead).

ROOT can efficiently read remote files if you open them through TFile::Open(const char* name, Option_t* option = "", const char* ftitle = "", Int_t compress = 1, Int_t netopt = 0), where name could (simply) be the url of your ROOT file.

I know there is a readahead option in sshfs and that there are fuse patches for the kernel to do something like increasing the number of pages in each request (I took a quick look at the code so I'm not even sure thats what they do) so you could try to improve the situation. The issue is that depending on your ROOT file that might make things worse ...

The simplest thing is to run a http server (or xrootd, rootd, etc) and put your ROOT file there or if it's small enough just copy it to your local machine.

Cheers,
Leo

On Aug 13, 2008, at 7:57 PM, Margar Simonyan wrote:

> Hello
>
> I have read this e-mail and tried it just for fun. It works out of box
> on ubuntu 7.10, one command to install sshfs and other to mount remote
> filesystem, no configuration was required.
>
> Margar
>
> ------------------------------------------------------------------------------------------------------
> Margar Simonyan ------ post-doctoral researcher
> LAPP, 9 Chemin de Bellevue, BP 110 F-74941, Annecy-le-Vieux
> Tel: +33450091785 +41227671123 (CERN)
> -----------------------------------------------------------------------------------------------------
>
>
>
>
> On Wed, Aug 13, 2008 at 7:23 PM, Manungu Kiveni <mkiveni_at_physics.syr.edu
> > wrote:
>> Hi Tom,
>>
>> The option C seem to be the one to go forward with. I am using linux
>> operating system and have root installed in it. My concer is how to
>> have
>> sshfs setup before trying to mount the remore com puter. I have
>> spend time
>> trying to figure out this, but still no break. Suggestions are much
>> appreciated.
>>
>> Joseph
>>
>>> Manungu Kiveni wrote:
>>>> I am writing an application that need to access files remotely,
>>>> open and
>>>> read the file. The aim is to ptoduce a .dat file format and bring
>>>> this
>>>> file to my computer (using scp for e.g). My question is how to
>>>> use ssh
>>>> in
>>>> C++ to access remote machines.
>>>
>>> There are several possibilities, ranging from difficult to simple
>>> and
>>> straightforward:
>>> A) Compile the ssh libraries into your code and write C++ code
>>> to use them directly.
>>> B) Use the system() function to run scp on the local computer,
>>> explicitly transferring files to and from local copies.
>>> C) Before starting Root, use sshfs to mount the remote computer's
>>> directory locally and then just read and write its files (they
>>> appear as if they were local; scp is used to transfer them in
>>> a manner hidden to you).
>>> D) Run root completely locally, using scp manually to transfer
>>> files.
>>>
>>> As long as both machines can do (C), I highly recommend that
>>> method --
>>> it's by far the simplest of A-C, and the most general. It has
>>> overheads,
>>> but on modern hardware with a reasonably fast network they are not
>>> obtrusive unless you use very large files. A major virtue of (C)
>>> and (D)
>>> is that they are transparent for systems that require a manual
>>> cryptocard or other access device for authentication. You will
>>> likely
>>> find other applications for (C)....
>>>
>>> Any reasonably modern Linux or Mac OS machine can be configured to
>>> do
>>> (C); setup requires root access, but once set up an authorized non-
>>> root
>>> user can use it. I don't know about Windows. Google can find sshfs
>>> (it
>>> is based on fuse - file system in user space).
>>>
>>>
>>> Tom Roberts
>>>
>>
>>
>
Received on Thu Aug 14 2008 - 15:42:45 CEST

This archive was generated by hypermail 2.2.0 : Thu Aug 14 2008 - 17:50:01 CEST