1
0
mirror of https://github.com/samba-team/samba.git synced 2025-01-11 05:18:09 +03:00
samba-mirror/source3/utils
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
..
dbwrap_tool.c dbwrap: add a dbwrap_flags argument to db_open() 2014-02-07 16:06:06 +01:00
dbwrap_torture.c dbwrap: add a dbwrap_flags argument to db_open() 2014-02-07 16:06:06 +01:00
debug2html.c
debugparse.c
eventlogadm.c s3: Fix Coverity ID 242754 Dereference null return value 2012-05-10 09:11:57 +02:00
interact.c Make sure to set umask() before calling mkstemp(). 2013-03-06 01:16:34 +01:00
interact.h
log2pcaphex.c s3:utils: avoid argv related const warnings 2014-04-02 09:03:43 +02:00
net_ads_gpo.c gpo: don't leak cache_path onto talloc tos 2014-10-06 19:18:05 +02:00
net_ads.c allow net ads join accept new osServicePack parameter 2015-01-08 00:18:05 +01:00
net_afs.c waf: fixup build with fake kaserver enabled 2014-06-04 20:09:39 +02:00
net_afs.h
net_cache.c lib: Add "mem_ctx" to gencache_get_data_blob 2013-09-05 09:16:22 -07:00
net_conf_util.c s3:net: check for GLOBAL_NAME net_conf_param_valid() 2013-09-24 07:44:28 +02:00
net_conf_util.h s3:net rpc conf: factor validation of parameter out for re-use. 2013-09-24 07:44:28 +02:00
net_conf.c s3:net conf: add the same parameter checks to "setparm" as in "net rpc conf". 2013-09-24 07:44:29 +02:00
net_dns.c s3-net: give more control how to update/register DNS entries. 2012-10-02 16:22:31 +02:00
net_dns.h s3-net: give more control how to update/register DNS entries. 2012-10-02 16:22:31 +02:00
net_dom.c s3-utils/net: pass struct ndr_interface_table down 2012-01-18 16:23:24 +01:00
net_eventlog.c
net_file.c
net_g_lock.c s3:utils: make use of samba_tevent_context_init() 2013-02-19 23:47:48 +01:00
net_group.c
net_groupmap.c Typo: sucessfully -> successfully 2014-04-13 16:55:05 +02:00
net_help_common.c
net_help_common.h
net_help.c
net_idmap_check.c s3:utils: add debug functions instead of magic format strings in net_idmap_check.c 2014-11-25 07:25:45 +01:00
net_idmap_check.h
net_idmap.c net_idmap: don't leak state_path onto talloc tos 2014-11-03 23:46:04 +01:00
net_join.c
net_lookup.c addns: Remove support for dns_host_file. 2014-12-18 06:47:40 +01:00
net_printing.c s3-net: Add encoding=<CP> to 'net printing dump'. 2013-03-15 12:11:03 +01:00
net_proto.h s3-net: avoid confusing output in net_rpc_oldjoin() if NET_FLAGS_EXPECT_FALLBACK is passed 2013-08-05 10:30:01 +02:00
net_rap.c s3:libsmb: get rid of cli_state_remote_name 2012-05-28 14:49:45 +02:00
net_registry_check.c Typo: Commiting -> Committing 2014-04-14 01:33:06 +02:00
net_registry_check.h
net_registry_util.c s3:net registry: fix output of dwords with sign bit set 2012-06-26 19:57:18 +02:00
net_registry_util.h
net_registry.c Fix the O3 developer build 2015-03-03 13:14:53 +01:00
net_rpc_audit.c s3-utils/net: pass struct ndr_interface_table down 2012-01-18 16:23:24 +01:00
net_rpc_conf.c s3:net rpc conf: factor validation of parameter out for re-use. 2013-09-24 07:44:28 +02:00
net_rpc_printer.c s3:net_rpc_printer: make use of cli_credentials_get_username() 2014-09-29 10:51:37 +02:00
net_rpc_registry.c net: Fix CID 1035403 Unchecked return value 2013-11-11 21:04:08 +01:00
net_rpc_rights.c s3-utils/net: pass struct ndr_interface_table down 2012-01-18 16:23:24 +01:00
net_rpc_samsync.c s3:libnet: pass in struct netlogon_creds_cli_context from the caller. 2014-01-07 12:47:13 +01:00
net_rpc_service.c s3-net: Fix rpc_service_list_internal() null pointer passing. 2013-01-02 14:19:50 +01:00
net_rpc_sh_acct.c s3-utils/net: pass struct ndr_interface_table down 2012-01-18 16:23:24 +01:00
net_rpc_shell.c s3-rpc_cli: pass down ndr_interface_table to cli_rpc_pipe_open_noauth(). 2013-08-05 10:30:00 +02:00
net_rpc_trust.c s3-rpc_cli: pass down ndr_interface_table to cli_rpc_pipe_open_noauth(). 2013-08-05 10:30:00 +02:00
net_rpc.c s3-rpc_client: Adapt cli_rpc_pipe_open_generic_auth to use enum credentials_kerberos_state 2014-10-08 01:09:51 +02:00
net_sam.c net: Fix sam addgroupmem 2015-01-13 15:28:16 +01:00
net_serverid.c Fix the build: net_serverid.c has 3 wrong format strings for 64bit vars 2013-03-05 22:49:02 +01:00
net_share.c
net_status.c s3:net_status_shares: use connections_forall_read for a read only traversal 2012-10-19 12:14:59 +02:00
net_time.c utils: Fix 'net time' segfault. 2015-01-19 06:48:05 +01:00
net_user.c
net_usershare.c Make sure to set umask() before calling mkstemp(). 2013-03-06 01:16:34 +01:00
net_util.c s3-rpc_cli: pass down ndr_interface_table to cli_rpc_pipe_open_noauth(). 2013-08-05 10:30:00 +02:00
net.c s3:utils: avoid argv related const warnings 2014-04-02 09:03:43 +02:00
net.h s3:net_rpc: add net_context->netlogon_creds 2014-01-07 12:47:11 +01:00
netlookup.c s3-rpc_cli: pass down ndr_interface_table to cli_rpc_pipe_open_noauth(). 2013-08-05 10:30:00 +02:00
nmblookup.c nmblookup: Warn user if netbios name is too long. 2015-02-24 01:01:10 +01:00
ntlm_auth_diagnostics.c s3-ntlm_auth: allow ntlm_auth --diagnostics to pass again 2012-02-20 10:50:48 +11:00
ntlm_auth_proto.h s3-ntlm_auth: allow ntlm_auth --diagnostics to pass again 2012-02-20 10:50:48 +11:00
ntlm_auth.c ntlm_auth: Allow the --option parameter to work against ntlm_auth 2014-10-17 15:20:59 +02:00
ntlm_auth.h
passwd_proto.h
passwd_util.c s3: smbpasswd - fix crashes on invalid input. 2013-12-16 15:17:58 +01:00
pdbedit.c s3:utils: avoid argv related const warnings 2014-04-02 09:03:43 +02:00
profiles.c s3:utils/profiles fix a use after free 2014-12-03 00:43:19 +01:00
regedit_dialog.c s3:utils: rename variables in regedit_*.c to fix shadow warnings 2014-11-25 07:25:45 +01:00
regedit_dialog.h regedit: add a button to resize hexedit buffer 2014-10-01 14:32:09 +02:00
regedit_hexedit.c s3:utils: rename variables in regedit_*.c to fix shadow warnings 2014-11-25 07:25:45 +01:00
regedit_hexedit.h regedit: handle del and backspace in hexeditor 2014-10-01 14:32:10 +02:00
regedit_list.c Fix the developer O3 build 2015-02-25 16:32:29 +01:00
regedit_list.h regedit: handle pgup/pgdn/home/end keys on lists 2014-10-01 14:32:10 +02:00
regedit_samba3.c regedit: silence some warnings 2014-10-01 14:32:08 +02:00
regedit_treeview.c regedit: Rename variable to fix compile warning 2015-02-19 01:31:43 +01:00
regedit_treeview.h regedit: find previous items 2014-10-01 14:32:09 +02:00
regedit_valuelist.c s3:utils: rename variables in regedit_*.c to fix shadow warnings 2014-11-25 07:25:45 +01:00
regedit_valuelist.h regedit: search values and repeat search from cursor positions 2014-10-01 14:32:09 +02:00
regedit_wrap.c s3: Wrap calls to the s3 registry API. 2013-04-29 13:05:41 +02:00
regedit.c Fix the developer O3 build 2015-02-25 16:32:29 +01:00
regedit.h regedit: search values and repeat search from cursor positions 2014-10-01 14:32:09 +02:00
sharesec.c s3/sharesec: use security_ace_equal instead of sec_ace_equal 2014-05-29 01:08:25 +02:00
smbcacls.c smbcacls: parse config file argument prior to load 2014-07-07 23:30:50 +02:00
smbcontrol.c smbcontrol: Use server_id_str_buf 2014-11-05 13:03:39 +01:00
smbcquotas.c s3:utils: avoid argv related const warnings 2014-04-02 09:03:43 +02:00
smbfilter.c Fix the developer O3 build 2015-02-25 16:32:29 +01:00
smbget.c s3-utils: Fix a memory leak in smbget. 2013-12-06 01:14:09 +01:00
smbpasswd.c s3-utils: Do not disable the root check in smbpasswd. 2014-04-17 14:56:05 +02:00
smbta-util.c s3:utils: explicitly check the return value of fscanf() to avoid unused warnings in smbta-util.c 2014-04-02 09:03:43 +02:00
smbtree.c s3:utils: avoid argv related const warnings 2014-04-02 09:03:43 +02:00
split_tokens.c
status_profile_dummy.c s3:smbprofile: Make "status_profile.h" a proper header 2014-11-19 20:51:37 +01:00
status_profile.c s3:smbprofile: Replace sysv shmem with tdb 2015-03-06 12:31:10 +01:00
status_profile.h s3:smbprofile: Make "status_profile.h" a proper header 2014-11-19 20:51:37 +01:00
status.c smbstatus: Tell the user that smbstatus can only be run as root. 2014-12-16 18:54:41 +01:00
testparm.c lib/param: Remove special handling for 'state dir' and 'cache dir' 2014-02-12 13:17:13 +13:00