1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-24 21:34:56 +03:00
samba-mirror/source3/smbd
Volker Lendecke 74a16a1094 s3:smbprofile: Replace sysv shmem with tdb
What?

This patch gets rid of the central shared memory segment referenced by
"profile_p". Instead, every smbd gets a static profile_area where it collects
profiling data. Once a second, every smbd writes this profiling data into a
record of its own in a "smbprofile.tdb". smbstatus -P does a tdb_traverse on this
database and sums up what it finds.

Why?

At least in my perception sysv IPC has not the best reputation on earth. The
code before this patch uses shmat(). Samba ages ago has developed a good
abstraction of shared memory: It's called tdb.

The main reason why I started this is that I have a request to become
more flexible with profiling data. Samba should be able to collect data
per share or per user, something which is almost impossible to do with
a fixed structure. My idea is to for example install a profile area per
share and every second marshall this into one tdb record indexed by share
name. smbstatus -P would then also collect the data and either aggregate
them or put them into individual per-share statistics. This flexibility
in the data model is not really possible with one fixed structure.

But isn't it slow?

Well, I don't think so. I can't really prove it, but I do believe that on large
boxes atomically incrementing a shared memory value for every SMB does show up
due to NUMA effects. With this patch the hot code path is completely
process-local. Once a second every smbd writes into a central tdb, this of
course does atomic operations. But it's once a second, not on every SMB2 read.

There's two places where I would like to improve things: With the current code
all smbds wake up once a second. With 10,000 potentially idle smbds this will
become noticable. That's why the current only starts the timer when something has
changed.

The second place is the tdb traverse: Right now traverse is blocking in the
sense that when it has to switch hash chains it will block. With mutexes, this
means a syscall. I have a traverse light in mind that works as follows: It
assumes a locked hash chain and then walks the complete chain in one run
without unlocking in between. This way the caller can do nonblocking locks in
the first round and only do blocking locks in a second round. Also, a lot of
syscall overhead will vanish. This way smbstatus -P will have almost zero
impact on normal operations.

Pair-Programmed-With: Stefan Metzmacher <metze@samba.org>

Signed-off-by: Volker Lendecke <vl@samba.org>
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2015-03-06 12:31:10 +01:00
..
aio.c s3: leases: Make aio_add_req_to_fsp() public. 2014-12-05 18:37:10 +01:00
avahi_register.c
blocking.c s3:smbd: pass smbXsrv_connection to srv_send_smb() 2014-09-19 09:15:11 +02:00
close.c param: rename lp function and variable from "magicscript" to "magic_script" 2014-02-07 16:19:13 -08:00
conn_idle.c Fix bug #9733 - smbcontrol close-share is not working. 2013-03-22 20:10:11 +01:00
conn_msg.c
conn.c Add uint32_t share_access to vuid_cache_entry. 2013-01-09 15:28:48 +11:00
connection.c s3:smbd: remove unused claim_connection/yield_connection 2012-10-19 12:15:03 +02:00
dfree.c s3/vfs: remove unused SMB_VFS_DISK_FREE() small_query parameter 2015-02-17 05:37:20 +01:00
dir.c smbd: Simplify ReadDirName 2015-02-26 18:51:10 +01:00
dmapi.c s3:smbd: do casting of dm_sessid_t in steps 2014-11-25 07:25:45 +01:00
dnsregister.c
dosmode.c s3:vfs: add create tags to SMB_VFS_CREATEFILE 2014-12-04 22:11:07 +01:00
durable.c s3:smbd: Implementation of SMB2.1 and SMB3.0 leases. 2014-12-04 05:45:10 +01:00
error.c
fake_file.c Add 'bool use_privs' to smbd_calculate_access_mask(). 2012-09-15 00:37:49 +02:00
file_access.c smbd: Convert can_delete_file_in_directory to synthetic_smb_fname 2013-04-17 14:50:01 -07:00
fileio.c s3:smbd: document the interaction between "smb2 leases" and "write cache size" 2014-12-04 05:45:10 +01:00
filename.c smbd: Fix a typo 2015-02-10 17:58:07 +01:00
files.c s3: smbd: leases - losen paranoia check. Stat opens can grant leases. 2015-02-19 20:42:07 +01:00
globals.c s3:smbd: introduce 'struct smbXsrv_client' in order to prepare multi-channel support 2014-09-19 09:15:11 +02:00
globals.h s3:smbd: Implementation of SMB2.1 and SMB3.0 leases. 2014-12-04 05:45:10 +01:00
ipc.c s3:smbd: pass smbXsrv_connection to srv_send_smb() 2014-09-19 09:15:11 +02:00
lanman.c lanman: don't leak cache_path onto talloc tos 2014-10-06 21:41:22 +02:00
mangle_hash2.c lib/util: move memcache.[ch] to the toplevel 'samba-util' library 2014-07-18 15:43:33 +02:00
mangle_hash.c smbd: Properly initialize mangle_hash 2014-08-26 01:30:38 +02:00
mangle.c param: rename lp function and variable from 'defaultcase' to 'default_case' 2014-02-07 16:19:10 -08:00
message.c s3:smbd: use req->xconn in message.c 2014-08-06 09:51:14 +02:00
msdfs.c MSDFS referral shuffling 2015-02-27 22:53:06 +01:00
negprot.c s3:smbd: only pass smbXsrv_connection to fork_echo_handler() 2014-09-19 09:15:11 +02:00
notify_inotify.c notify_inotify: Simplify inotify_dispatch 2014-12-09 06:37:24 +01:00
notify_internal.c notify: Move path construction to notify_trigger 2014-12-16 21:22:26 +01:00
notify.c notify: Move path construction to notify_trigger 2014-12-16 21:22:26 +01:00
ntquotas.c
nttrans.c s3:vfs: add create tags to SMB_VFS_CREATEFILE 2014-12-04 22:11:07 +01:00
open.c s3: smbd: leases - new torture test shows stat opens can get leases. 2015-02-19 20:42:07 +01:00
oplock_irix.c param: rename lp function and variable from 'lockdir' to 'lock_directory' 2014-02-07 16:19:10 -08:00
oplock_linux.c Wrap setting leases in become_root()/unbecome_root() to ensure correct delivery of signals. 2013-07-31 17:07:58 -07:00
oplock.c s3:smbd: Implementation of SMB2.1 and SMB3.0 leases. 2014-12-04 05:45:10 +01:00
password.c loadparm: rename lp[cfg]_pathname to lp[cfg]_path for consistency with docs 2014-02-03 13:26:13 +13:00
perfcount.c loadparm: make the source3/ lp_ functions take an explicit TALLOC_CTX *. 2012-07-18 15:07:23 +09:30
pipes.c s3:smbd: pass smbXsrv_connection to srv_send_smb() 2014-09-19 09:15:11 +02:00
posix_acls.c s3:smbd: ignore dacls with MS NFS ACEs 2014-12-04 22:11:08 +01:00
process.c s3:smbprofile: Replace sysv shmem with tdb 2015-03-06 12:31:10 +01:00
proto.h s3/vfs: remove unused SMB_VFS_DISK_FREE() small_query parameter 2015-02-17 05:37:20 +01:00
pysmbd.c pysmbd: improve the return of error codes in the python smbd bindings 2014-02-05 08:42:25 +01:00
quotas.c quota: move function again to its belonging ifdef block 2012-09-11 04:44:28 +02:00
reply.c s3/vfs: remove unused SMB_VFS_DISK_FREE() small_query parameter 2015-02-17 05:37:20 +01:00
scavenger.c lib: Split out sys_[read|write] & friends 2014-12-07 00:12:07 +01:00
scavenger.h s3:smbd: add a scavenger process for disconnected durable handles 2013-04-18 13:15:13 +02:00
seal.c s3:smbd: pass smbXsrv_connection to smb1 encryption functions 2014-08-06 09:51:14 +02:00
sec_ctx.c s3:smbprofile: improve profiling for the security context switching. 2014-11-19 20:51:37 +01:00
server_exit.c s3:smbprofile: Replace sysv shmem with tdb 2015-03-06 12:31:10 +01:00
server_reload.c s3:smbd: use sconn->client->connections in reload_services() 2014-09-19 09:15:12 +02:00
server.c s3:smbprofile: Replace sysv shmem with tdb 2015-03-06 12:31:10 +01:00
service.c smbd: Stop using vfs_Chdir after SMB_VFS_DISCONNECT. 2015-01-16 00:13:17 +01:00
session.c s3:smbd/session: Added a routine find_sessions() 2013-09-10 11:32:46 -07:00
sesssetup.c s3:smbd: use req->sconn in sesssetup.c 2014-09-19 09:15:11 +02:00
share_access.c param: rename lp function and variable from "writelist" to "write_list" 2014-02-07 16:19:16 -08:00
signing.c s3:smbd: move sconn->smb1.signing_state to xconn->smb1.signing_state 2014-08-06 09:51:11 +02:00
smb2_break.c s3:locking: Change the data model for leases_db to cope with dynamic path renames. 2014-12-09 03:44:04 +01:00
smb2_close.c s3: smbd: SMB2 close. If a file has delete on close, store the return info before deleting. 2015-02-20 20:54:18 +01:00
smb2_create.c s3:vfs: add create tags to SMB_VFS_CREATEFILE 2014-12-04 22:11:07 +01:00
smb2_find.c s3: smbd: Remove unneeded 'out_of_space' parameter from smbd_dirptr_lanman2_entry(). 2014-09-16 01:56:55 +02:00
smb2_flush.c s3:smb2_server: pass smbXsrv_connection to smbd_server_connection_terminate*() 2014-08-06 09:51:13 +02:00
smb2_getinfo.c s3:smbd: mask security_information input values with SMB_SUPPORTED_SECINFO_FLAGS 2014-08-22 00:28:08 +02:00
smb2_glue.c s3:smb2_glue: remove chained fsps from all connections in remove_smb2_chained_fsp() 2014-09-19 09:15:12 +02:00
smb2_ioctl_dfs.c smb2_ioctl: split ioctl handler code on device type 2013-01-16 23:15:06 +01:00
smb2_ioctl_filesys.c smb2/ioctl: add support for FSCTL_[GET/SET]_COMPRESSION 2013-11-22 08:56:45 -08:00
smb2_ioctl_named_pipe.c smbd: Fix CID 1035550 Structurally dead code 2013-08-12 17:25:54 +12:00
smb2_ioctl_network_fs.c s3:smb2_*: make use of smb2req->xconn where possible 2014-08-06 09:51:13 +02:00
smb2_ioctl_private.h smb2_ioctl: split ioctl handler code on device type 2013-01-16 23:15:06 +01:00
smb2_ioctl.c s3:smb2_server: pass smbXsrv_connection to smbd_server_connection_terminate*() 2014-08-06 09:51:13 +02:00
smb2_keepalive.c s3:smb2_keepalive: make use of smbd_smb2_generate_outbody() 2014-03-05 13:59:22 -08:00
smb2_lock.c s3:smb2_server: use async smbprofile macros 2014-11-19 20:51:37 +01:00
smb2_negprot.c smbd: Fix a typo 2015-02-26 03:02:07 +01:00
smb2_notify.c s3:smb2_server: use async smbprofile macros 2014-11-19 20:51:37 +01:00
smb2_read.c lib: Split out write_data[_iov] 2014-12-07 00:12:07 +01:00
smb2_server.c s3:smbprofile: Replace sysv shmem with tdb 2015-03-06 12:31:10 +01:00
smb2_sesssetup.c smbd: Make SMB3 clients use encryption with "smb encrypt = auto" 2015-03-03 10:40:42 +01:00
smb2_setinfo.c smbd: Fix CID 1273088 Resource leak 2015-03-03 17:34:39 +01:00
smb2_tcon.c smbd: Make SMB3 clients use encryption with "smb encrypt = auto" 2015-03-03 10:40:42 +01:00
smb2_write.c s3:smb2_server: pass smbXsrv_connection to smbd_server_connection_terminate*() 2014-08-06 09:51:13 +02:00
smbd.h smbd: change flag name from UCF_CREATING_FILE to UCF_PREP_CREATEFILE 2013-12-09 09:48:48 -08:00
smbXsrv_open.c smbXsrv: don't leak lock_path onto talloc tos 2014-11-03 23:46:05 +01:00
smbXsrv_session.c smbXsrv: don't leak lock_path onto talloc tos 2014-11-03 23:46:05 +01:00
smbXsrv_tcon.c smbXsrv: don't leak lock_path onto talloc tos 2014-11-03 23:46:05 +01:00
smbXsrv_version.c smbXsrv: don't leak lock_path onto talloc tos 2014-11-03 23:46:05 +01:00
srvstr.c s3: smbd: Change the function signature of srvstr_push() from returning a length to returning an NTSTATUS with a length param. 2014-09-16 01:56:54 +02:00
statcache.c lib/util: move memcache.[ch] to the toplevel 'samba-util' library 2014-07-18 15:43:33 +02:00
statvfs.c Typo: s/prefered/preferred/ 2014-04-13 16:55:05 +02:00
trans2.c smbd: ZERO_STRUCT -> struct init 2015-02-26 18:51:10 +01:00
uid.c smbd: Change logging level for denied share access 2014-07-31 01:17:30 +02:00
utmp.c param: rename lp function and variable from 'wtmpdir' to 'wtmp_directory' 2014-02-07 16:19:11 -08:00
vfs.c s3/vfs: remove unused SMB_VFS_DISK_FREE() small_query parameter 2015-02-17 05:37:20 +01:00