diff options
author | Paul J. Davis <paul.joseph.davis@gmail.com> | 2020-03-31 16:25:38 -0500 |
---|---|---|
committer | Nick Vatamaniuc <nickva@users.noreply.github.com> | 2020-03-31 18:29:13 -0400 |
commit | 9de592100da77179c478e944db4bd6508db09be9 (patch) | |
tree | ab88a97ea6042bd80cb79e6b9f0b3eb46bccb4f1 | |
parent | 12d3756b09e423e1fa108f0d8feca524dae51090 (diff) | |
download | couchdb-9de592100da77179c478e944db4bd6508db09be9.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.erl | 5 |
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 |