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 18:28:57 -0400
commite186ba5b8b476e2fd49ab6e62d973ac9ddd17400 (patch)
treea0349b355743c422a910b4defe31a7a66366c9a6
parent6b54cf1d5a1686f6d0a237889e72b45455b20a9e (diff)
downloadcouchdb-e186ba5b8b476e2fd49ab6e62d973ac9ddd17400.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