Breaking change of listener's rate_limit config
This commit is contained in:
parent
a09b87fc94
commit
a0e72fd040
|
@ -562,8 +562,8 @@ zone.external.hibernate_after = 60s
|
|||
## Publish limit for the external MQTT connections.
|
||||
##
|
||||
## Value: Number,Duration
|
||||
## Example: 10 messages per minute.
|
||||
## zone.external.publish_limit = 10,1m
|
||||
## Example: 100 messages per 10 seconds.
|
||||
## zone.external.publish_limit = 100,10s
|
||||
|
||||
## Enable ACL check.
|
||||
##
|
||||
|
@ -874,14 +874,11 @@ listener.tcp.external.active_n = 100
|
|||
## Value: String
|
||||
listener.tcp.external.zone = external
|
||||
|
||||
## Rate limit for the external MQTT/TCP connections. Format is 'rate,burst'.
|
||||
## Rate limit for the external MQTT/TCP connections. Format is 'limit,duration'.
|
||||
##
|
||||
## Value: rate,burst
|
||||
## - rate: The average limit value for per second
|
||||
## - burst: The maximum allowed for each check, To avoid frequent restriction
|
||||
## this value is recommended to be set to `(max_packet_size * active_n)/2`
|
||||
## Unit: Bps
|
||||
## listener.tcp.external.rate_limit = 1024,52428800
|
||||
## Value: limit,duration
|
||||
## Default: 100KB incoming per 10 seconds.
|
||||
## listener.tcp.external.rate_limit = 100KB,10s
|
||||
|
||||
## The access control rules for the MQTT/TCP listener.
|
||||
##
|
||||
|
@ -1010,12 +1007,9 @@ listener.tcp.internal.zone = internal
|
|||
##
|
||||
## See: listener.tcp.$name.rate_limit
|
||||
##
|
||||
## Value: rate,burst
|
||||
## - rate: The average limit value for per second
|
||||
## - burst: The maximum allowed for each check, To avoid frequent restriction
|
||||
## this value is recommended to be set to `(max_packet_size * active_n)/2`
|
||||
## Unit: Bps
|
||||
## listener.tcp.internal.rate_limit = 1000000,524288000
|
||||
## Value: limit,duration
|
||||
## Default: 1MB incoming per second.
|
||||
## listener.tcp.internal.rate_limit = 1MB,1s
|
||||
|
||||
## The TCP backlog of internal MQTT/TCP Listener.
|
||||
##
|
||||
|
@ -1123,12 +1117,9 @@ listener.ssl.external.access.1 = allow all
|
|||
|
||||
## Rate limit for the external MQTT/SSL connections.
|
||||
##
|
||||
## Value: rate,burst
|
||||
## - rate: The average limit value for per second
|
||||
## - burst: The maximum allowed for each check, To avoid frequent restriction
|
||||
## this value is recommended to be set to `(max_packet_size * active_n)/2`
|
||||
## Unit: Bps
|
||||
## listener.ssl.external.rate_limit = 1024,52428800
|
||||
## Value: limit,duration
|
||||
## Default: 100KB incoming per 10 seconds.
|
||||
## listener.ssl.external.rate_limit = 100KB,10s
|
||||
|
||||
## Enable the Proxy Protocol V1/2 if the EMQ cluster is deployed behind
|
||||
## HAProxy or Nginx.
|
||||
|
@ -1360,12 +1351,9 @@ listener.ws.external.max_conn_rate = 1000
|
|||
|
||||
## Rate limit for the MQTT/WebSocket connections.
|
||||
##
|
||||
## Value: rate,burst
|
||||
## - rate: The average limit value for per second
|
||||
## - burst: The maximum allowed for each check, To avoid frequent restriction
|
||||
## this value is recommended to be set to `(max_packet_size * 1)/2`
|
||||
## Unit: Bps
|
||||
## listener.ws.external.rate_limit = 1024,524288
|
||||
## Value: limit,duration
|
||||
## Default: 100KB incoming per 10 seconds.
|
||||
## listener.ws.external.rate_limit = 100KB,10s
|
||||
|
||||
## Zone of the external MQTT/WebSocket listener belonged to.
|
||||
##
|
||||
|
@ -1571,12 +1559,9 @@ listener.wss.external.max_conn_rate = 1000
|
|||
|
||||
## Rate limit for the MQTT/WebSocket/SSL connections.
|
||||
##
|
||||
## Value: rate,burst
|
||||
## - rate: The average limit value for per second
|
||||
## - burst: The maximum allowed for each check, To avoid frequent restriction
|
||||
## this value is recommended to be set to `(max_packet_size * 1)/2`
|
||||
## Unit: Bps
|
||||
## listener.wss.external.rate_limit = 1024,524288
|
||||
## Value: limit,duration
|
||||
## Default: 100KB incoming per 10 seconds.
|
||||
## listener.wss.external.rate_limit = 100KB,10s
|
||||
|
||||
## Zone of the external MQTT/WebSocket/SSL listener belonged to.
|
||||
##
|
||||
|
|
|
@ -939,14 +939,14 @@ end}.
|
|||
("shared_subscription", Val) ->
|
||||
{shared_subscription, Val};
|
||||
("publish_limit", Val) ->
|
||||
[Limit, Duration] = string:tokens(Val, ", "),
|
||||
PubLimit = case cuttlefish_duration:parse(Duration, s) of
|
||||
Secs when is_integer(Secs) ->
|
||||
{list_to_integer(Limit) / Secs, list_to_integer(Limit)};
|
||||
{error, Reason} ->
|
||||
error(Reason)
|
||||
[L, D] = string:tokens(Val, ", "),
|
||||
Limit = list_to_integer(L),
|
||||
Duration = case cuttlefish_duration:parse(D, s) of
|
||||
Secs when is_integer(Secs) -> Secs;
|
||||
{error, Reason} -> error(Reason)
|
||||
end,
|
||||
{publish_limit, PubLimit};
|
||||
Rate = Limit / Duration,
|
||||
{publish_limit, {Rate, Limit}};
|
||||
("force_gc_policy", Val) ->
|
||||
[Count, Bytes] = string:tokens(Val, "| "),
|
||||
GcPolicy = case cuttlefish_bytesize:parse(Bytes) of
|
||||
|
@ -1644,10 +1644,20 @@ end}.
|
|||
end
|
||||
end,
|
||||
|
||||
Ratelimit = fun(undefined) ->
|
||||
RateLimit = fun(undefined) ->
|
||||
undefined;
|
||||
(S) ->
|
||||
list_to_tuple([list_to_integer(Token) || Token <- string:tokens(S, ",")])
|
||||
(Val) ->
|
||||
[L, D] = string:tokens(Val, ", "),
|
||||
Limit = case cuttlefish_bytesize:parse(L) of
|
||||
Sz when is_integer(Sz) -> Sz;
|
||||
{error, Reason} -> error(Reason)
|
||||
end,
|
||||
Duration = case cuttlefish_duration:parse(D, s) of
|
||||
Secs when is_integer(Secs) -> Secs;
|
||||
{error, Reason1} -> error(Reason1)
|
||||
end,
|
||||
Rate = Limit / Duration,
|
||||
{Rate, Limit}
|
||||
end,
|
||||
|
||||
LisOpts = fun(Prefix) ->
|
||||
|
@ -1658,7 +1668,7 @@ end}.
|
|||
{active_n, cuttlefish:conf_get(Prefix ++ ".active_n", Conf, undefined)},
|
||||
{tune_buffer, cuttlefish:conf_get(Prefix ++ ".tune_buffer", Conf, undefined)},
|
||||
{zone, Atom(cuttlefish:conf_get(Prefix ++ ".zone", Conf, undefined))},
|
||||
{rate_limit, Ratelimit(cuttlefish:conf_get(Prefix ++ ".rate_limit", Conf, undefined))},
|
||||
{rate_limit, RateLimit(cuttlefish:conf_get(Prefix ++ ".rate_limit", Conf, undefined))},
|
||||
{proxy_protocol, cuttlefish:conf_get(Prefix ++ ".proxy_protocol", Conf, undefined)},
|
||||
{proxy_protocol_timeout, cuttlefish:conf_get(Prefix ++ ".proxy_protocol_timeout", Conf, undefined)},
|
||||
{verify_protocol_header, cuttlefish:conf_get(Prefix ++ ".verify_protocol_header", Conf, undefined)},
|
||||
|
|
Loading…
Reference in New Issue