summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul J. Davis <paul.joseph.davis@gmail.com>2020-03-31 16:25:38 -0500
committerNick Vatamaniuc <nickva@users.noreply.github.com>2020-03-31 17:52:15 -0400
commit4dca84e181a8469dbf3e17edc1073da7eb6ab6b2 (patch)
treedb4fba27565eb0b505b322ec6410e16c5e9beabd
parent5bc0af168c48ea6d651bc3458a98110bc3fd4654 (diff)
downloadcouchdb-4dca84e181a8469dbf3e17edc1073da7eb6ab6b2.tar.gz
Do not copy the #server.lru field to async openers
This copy slowed down the `erlang:spawn_link/3` call considerably. Measurements in the wild showed the cost of that `spawn_link/3` going from roughly 8 uS to 800 uS.
-rw-r--r--src/couch/src/couch_server.erl5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/couch/src/couch_server.erl b/src/couch/src/couch_server.erl
index 909e23898..b2f8fdead 100644
--- a/src/couch/src/couch_server.erl
+++ b/src/couch/src/couch_server.erl
@@ -381,10 +381,13 @@ maybe_close_lru_db(#server{lru=Lru}=Server) ->
end.
open_async(Server, From, DbName, Options) ->
+ NoLRUServer = Server#server{
+ lru = redacted
+ },
Parent = self(),
T0 = os:timestamp(),
Opener = spawn_link(fun() ->
- Res = open_async_int(Server, DbName, Options),
+ Res = open_async_int(NoLRUServer, DbName, Options),
IsSuccess = case Res of
{ok, _} -> true;
_ -> false