nickva commented on code in PR #4736:
URL: https://github.com/apache/couchdb/pull/4736#discussion_r1305820713
##########
src/chttpd/src/chttpd_util.erl:
##########
@@ -110,3 +118,113 @@ get_db_info(DbName) ->
catch
_Tag:Error -> {error, Error}
end.
+
+mochiweb_socket_set(Sock) ->
+ put(?MOCHIWEB_SOCKET, Sock).
+
+mochiweb_socket_clean() ->
+ erase(?MOCHIWEB_SOCKET).
+
+mochiweb_socket_get() ->
+ get(?MOCHIWEB_SOCKET).
+
+mochiweb_socket_check_msec() ->
+ MSec = config:get_integer("chttpd", "disconnect_check_msec",
?DISCONNECT_CHECK_MSEC),
+ % Add jitter to avoid a stampede in case of a larger number of concurrent
connections
+ MSec + rand:uniform(MSec).
Review Comment:
What if we made it a smaller percentage of jitter (+/-20%) centered around
the value, to avoid having another config option.
```erlang
MSec * 0.80 + rand:uniform(MSec * 0.4)
```
Or a separate value completely would still be better?:
##########
src/chttpd/src/chttpd_util.erl:
##########
@@ -110,3 +118,113 @@ get_db_info(DbName) ->
catch
_Tag:Error -> {error, Error}
end.
+
+mochiweb_socket_set(Sock) ->
+ put(?MOCHIWEB_SOCKET, Sock).
+
+mochiweb_socket_clean() ->
+ erase(?MOCHIWEB_SOCKET).
+
+mochiweb_socket_get() ->
+ get(?MOCHIWEB_SOCKET).
+
+mochiweb_socket_check_msec() ->
+ MSec = config:get_integer("chttpd", "disconnect_check_msec",
?DISCONNECT_CHECK_MSEC),
+ % Add jitter to avoid a stampede in case of a larger number of concurrent
connections
+ MSec + rand:uniform(MSec).
Review Comment:
What if we made it a smaller percentage of jitter (+/-20%) centered around
the value, to avoid having another config option.
```erlang
MSec * 0.80 + rand:uniform(MSec * 0.4)
```
Or a separate value completely would still be better?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]