diff options
author | Sverker Eriksson <sverker@erlang.org> | 2018-05-21 14:33:27 +0200 |
---|---|---|
committer | Sverker Eriksson <sverker@erlang.org> | 2018-06-04 16:28:48 +0200 |
commit | 29946f8628df35f000e37e5db8782decfa44876b (patch) | |
tree | 293903537e2b63018f90a28defeda7035e24328f /erts/emulator | |
parent | 99dfe4573a6e89eb93c5fcec523f2a76af61d859 (diff) | |
download | erlang-29946f8628df35f000e37e5db8782decfa44876b.tar.gz |
erts: Increase scalability of ets name lookup
by expanding the default size of the hash table
and increase number of locks.
Diffstat (limited to 'erts/emulator')
-rw-r--r-- | erts/emulator/beam/erl_db.c | 10 | ||||
-rw-r--r-- | erts/emulator/beam/erl_db.h | 2 |
2 files changed, 8 insertions, 4 deletions
diff --git a/erts/emulator/beam/erl_db.c b/erts/emulator/beam/erl_db.c index a91a8d7c2e..5bae1730e4 100644 --- a/erts/emulator/beam/erl_db.c +++ b/erts/emulator/beam/erl_db.c @@ -322,10 +322,10 @@ erts_db_make_tid(Process *c_p, DbTableCommon *tb) /* ** The meta hash table of all NAMED ets tables */ -# define META_NAME_TAB_LOCK_CNT 16 +# define META_NAME_TAB_LOCK_CNT 256 union { erts_rwmtx_t lck; - byte _cache_line_alignment[64]; + byte align[ERTS_ALC_CACHE_LINE_ALIGN_SIZE(sizeof(erts_rwmtx_t))]; }meta_name_tab_rwlocks[META_NAME_TAB_LOCK_CNT]; static struct meta_name_tab_entry { union { @@ -3491,7 +3491,11 @@ void init_db(ErtsDbSpinCount db_spin_count) db_max_tabs, ((Uint)1)<<SMALL_BITS); } - meta_name_tab_mask = (((Uint) 1)<<(bits-1)) - 1; /* At least half the size of main tab */ + /* + * We don't have ony hard limit for number of tables anymore, . + * but we use 'db_max_tabs' to determine size of name hash table. + */ + meta_name_tab_mask = (((Uint) 1)<<bits) - 1; size = sizeof(struct meta_name_tab_entry)*(meta_name_tab_mask+1); meta_name_tab = erts_db_alloc_nt(ERTS_ALC_T_DB_TABLES, size); ERTS_ETS_MISC_MEM_ADD(size); diff --git a/erts/emulator/beam/erl_db.h b/erts/emulator/beam/erl_db.h index 1664db9a41..db1dec015c 100644 --- a/erts/emulator/beam/erl_db.h +++ b/erts/emulator/beam/erl_db.h @@ -94,7 +94,7 @@ union db_table { /*TT*/ }; -#define DB_DEF_MAX_TABS 2053 /* Superseeded by environment variable +#define DB_DEF_MAX_TABS 8192 /* Superseeded by environment variable "ERL_MAX_ETS_TABLES" */ #define ERL_MAX_ETS_TABLES_ENV "ERL_MAX_ETS_TABLES" |