nickva commented on a change in pull request #1593: Couch server improvements
URL: https://github.com/apache/couchdb/pull/1593#discussion_r216074695
 
 

 ##########
 File path: src/couch/src/couch_server.erl
 ##########
 @@ -101,9 +101,14 @@ open(DbName, Options0) ->
     end.
 
 update_lru(DbName, Options) ->
-    case lists:member(sys_db, Options) of
-        false -> gen_server:cast(couch_server, {update_lru, DbName});
-        true -> ok
+    case config:get_boolean("couchdb", "update_lru_on_read", false) of
 
 Review comment:
   We could do the mochiglobal pattern eventually. 
   
   But last time I had worried about `ets:lookup` I had measured it at less 
than 5 microseconds.
   
   Was curious and tried it again my mac laptop:
   
   ```
   f(Tries), f(T), Tries = lists:seq(1,1000000), {T, ok} = timer:tc(fun() -> 
lists:foreach( fun(_) -> config:get_boolean("couchdb", "update_lru_on_read", 
false) end, Tries) end), T/1.0e6.
   0.955564
   ```
   
   On a linux server:
   ```
   f(Tries), f(T), Tries = lists:seq(1,1000000), {T, ok} = timer:tc(fun() -> 
lists:foreach( fun(_) -> config:get_boolean("couchdb", "update_lru_on_read", 
false) end, Tries) end), T/1.0e6.
   1.264781
   ```
   
   So seems pretty small. Granted neither the laptop not the server were very 
busy, so maybe with a larger number of lock acquisitions it looks much worse.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to