"ls -l" command and performance of sftp

Damien Miller djm at mindrot.org
Fri May 12 21:58:11 EST 2006

On Fri, 12 May 2006, ponraj wrote:

> Hi all,
> Patch to cache group and userids is attched along with this
> mail. The patch looks up the cache first before proceeding with
> getgrgid,getpwuid calls and thus reduces the amount of lookups and
> increases preformance in environments such as LDAP database.

BTW a related problem in sftp is that it effectively does the
remote stat() operations twice during a remote glob().

The SSH2_FXP_READDIR operation returns an Attrib (the protocol's
equivalent of "struct stat"), but we throw it away when we do a
remote_glob() because the libc glob() API has no way to report
this information back. For things like "ls -l" we end up doing
a remote stat() because we need this information anyway...

A relatively easy performance win would be to take the glob()
implementation from OpenBSD's libc (also in openbsd-compat/ in
portable OpenSSH) and modify its API so that it does native 
remote sftp operations and retains the Attrib information that
they provide.

Any takers? This is pretty small project...


More information about the openssh-unix-dev mailing list