mirror of
https://github.com/samba-team/samba.git
synced 2025-01-11 05:18:09 +03:00
0736fdcdb0
Finally: use the new dos_mode_at_send() in the directory enumeration loop. This means that fetching the DOS attributes for directory entries is done asynchronously with regard to the enumeration loop. As the DOS attribute is typically read from an extended attribute in the filesytem, this avoids sequentially blocking on IO. If the IO subsystem is slow servicing these request, enabling async processing can result in performance improvements. A parametric option smbd:async dosmode = true | false (default: false) can be used to enable the new async processing. Simulating slow IO with usleep(5000) in the synchronous and asynchronous versions of SMB_VFS_GET_DOS_ATTRIBUTES(), the results of enumerating a directory with 10,000 files are: smbd:async dosmode = no: $ time bin/smbclient -U slow%x //localhost/test -c "ls dir\*" > /dev/null real 0m59.597s user 0m0.024s sys 0m0.012s smbd:async dosmode = yes: $ time bin/smbclient -U slow%x //localhost/test -c "ls dir\*" > /dev/null real 0m0.698s user 0m0.038s sys 0m0.025s Performance gains in real world workloads depends on whether the actual IO requests can be merged and parallelized by the kernel. Without such wins at the IO layer, the async processing may even be slower then the sync processing due to the additional overhead. The following parameters can be used to adapt async processing behaviour for specific workloads and systems: aio max threads = X (default: 100) smbd:max async dosmode = Y (default: "aio max threads" * 2) By default we have at most twice the number of async requests in flight as threads provided by the underlying threadpool. This ensures a worker thread that finishes a job can directly pick up a new one without going to sleep. It may be advisable to reduce the number of threads to avoid scheduling overhead while also increasing "smbd:max async dosmode". Note that we disable async processing for certain VFS modules in the VFS connect function to avoid the overhead of triggering the sync fallback in dos_mode_at_send(). This is done for VFS modules that implement the sync SMB_VFS_GET_DOS_ATTRIBUTES(), but not the async version (gpfs), and for VFS modules that don't share a real filesystem where fchdir() can be used (ceph, gluster). It is disabled for catia, because we realized that the catia name translation macros used on fsps (CATIA_FETCH_FSP_[PRE|POST]_NEXT) have a bug (#13547). We use threadpool = smb_vfs_ev_glue_tp_chdir_safe() and then pthreadpool_tevent_max_threads(threadpool) to get the number of maximum worker threads which matches the pool used by the low level SMB_VFS_GETXATTRAT_[SEND|RECV] implementation in vfs_default. This is a terrible abstraction leak that should be removed in the future by maybe making it possible to ask a VFS function which threadpool it uses, internally suporting chaining so VFS function FOO that internally uses BAR can forward the question to BAR. On a hyphotetical system that had a getxattrat(dirfd, path, ...) syscall and at the same time doesn't support per-thread current working directories (eg FreeBSD doesn't have the latter) but has support for per-thread-credentials, pthreadpool_tevent_max_threads() on the tp_chdir_safe threadpool returns 1. So when hooking the hyphotetical getxattrat() into the async SMB_VFS_GETXATTRAT_[SEND|RECV] implementation in an VFS module, the implementation could use the tp_path_safe threadpool, but the SMB2 layer would use the wrong threadpool in the call to pthreadpool_tevent_max_threads(), resulting in no parallelism. Signed-off-by: Ralph Boehme <slow@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org> |
||
---|---|---|
.. | ||
notifyd | ||
aio.c | ||
avahi_register.c | ||
blocking.c | ||
close.c | ||
conn_idle.c | ||
conn_msg.c | ||
conn.c | ||
connection.c | ||
dfree.c | ||
dir.c | ||
dmapi.c | ||
dnsregister.c | ||
dosmode.c | ||
durable.c | ||
error.c | ||
fake_file.c | ||
file_access.c | ||
fileio.c | ||
filename.c | ||
files.c | ||
globals.c | ||
globals.h | ||
ipc.c | ||
lanman.c | ||
mangle_hash2.c | ||
mangle_hash.c | ||
mangle.c | ||
message.c | ||
msdfs.c | ||
negprot.c | ||
notify_fam.c | ||
notify_inotify.c | ||
notify_msg.c | ||
notify.c | ||
ntquotas.c | ||
nttrans.c | ||
open.c | ||
oplock_linux.c | ||
oplock.c | ||
password.c | ||
perfcount.c | ||
pipes.c | ||
posix_acls.c | ||
process.c | ||
proto.h | ||
pysmbd.c | ||
quotas.c | ||
reply.c | ||
scavenger.c | ||
scavenger.h | ||
seal.c | ||
sec_ctx.c | ||
server_exit.c | ||
server_reload.c | ||
server.c | ||
service.c | ||
session.c | ||
sesssetup.c | ||
share_access.c | ||
signing.c | ||
smb2_break.c | ||
smb2_close.c | ||
smb2_create.c | ||
smb2_flush.c | ||
smb2_getinfo.c | ||
smb2_glue.c | ||
smb2_ioctl_dfs.c | ||
smb2_ioctl_filesys.c | ||
smb2_ioctl_named_pipe.c | ||
smb2_ioctl_network_fs.c | ||
smb2_ioctl_private.h | ||
smb2_ioctl.c | ||
smb2_keepalive.c | ||
smb2_lock.c | ||
smb2_negprot.c | ||
smb2_notify.c | ||
smb2_query_directory.c | ||
smb2_read.c | ||
smb2_server.c | ||
smb2_sesssetup.c | ||
smb2_setinfo.c | ||
smb2_tcon.c | ||
smb2_write.c | ||
smbd_cleanupd.c | ||
smbd_cleanupd.h | ||
smbd.h | ||
smbXsrv_client.c | ||
smbXsrv_open.c | ||
smbXsrv_session.c | ||
smbXsrv_tcon.c | ||
smbXsrv_version.c | ||
srvstr.c | ||
statcache.c | ||
statvfs.c | ||
trans2.c | ||
uid.c | ||
utmp.c | ||
vfs.c |