Mercurial > prosody-modules
comparison mod_limits/README.markdown @ 4782:b935276ab1b4
mod_limits: Obsolete this module, it is included in Prosody since 0.10
author | Emmanuel Gil Peyrot <linkmauve@linkmauve.fr> |
---|---|
date | Fri, 09 Jul 2021 20:54:40 +0200 |
parents | 8de50be756e5 |
children |
comparison
equal
deleted
inserted
replaced
4781:306066898e5f | 4782:b935276ab1b4 |
---|---|
1 --- | 1 --- |
2 labels: | 2 labels: |
3 - 'Stage-Beta' | 3 - 'Stage-Obsolete' |
4 summary: 'Connection-level rate limiting' | 4 summary: 'Connection-level rate limiting' |
5 superseded_by: mod_limits | |
5 ... | 6 ... |
6 | 7 |
7 Introduction | 8 Since Prosody 0.10, this module is [included in Prosody](https://prosody.im/doc/modules/mod_limits), you will be redirected there shortly. |
8 ============ | |
9 | |
10 On some servers, especially public ones, it is desired to make sure that | |
11 everyone gets their fair share of system resources (and no more). | |
12 | |
13 mod\_limits allows you to specify traffic bandwidth limits, preventing | |
14 any single connection hogging the server's CPU, RAM and bandwidth. | |
15 | |
16 Details | |
17 ======= | |
18 | |
19 mod\_limits detects when a connection has exceeded its traffic allowance | |
20 and temporarily ignores a connection. Due to the way TCP and the OS's | |
21 network API works no data is lost, only slowed. | |
22 | |
23 Configuration | |
24 ============= | |
25 | |
26 Currently mod\_limits is configured per connection type. The possible | |
27 connection types are: | |
28 | |
29 - c2s | |
30 - s2sin | |
31 - s2sout | |
32 - component | |
33 | |
34 The limits are specified like so in the **global** section of your | |
35 config (they cannot be per-host): | |
36 | |
37 ``` {.lua} | |
38 limits = { | |
39 c2s = { | |
40 rate = "3kb/s"; | |
41 burst = "2s"; | |
42 }; | |
43 s2sin = { | |
44 rate = "10kb/s"; | |
45 burst = "5s"; | |
46 }; | |
47 } | |
48 ``` | |
49 | |
50 All units are in terms of *bytes*, not *bits*, so that "kb/s" is | |
51 interpreted as "kilobytes per second", where a kilobyte is 1000 bytes. | |
52 | |
53 Compatibility | |
54 ============= | |
55 | |
56 ----- ------------------- | |
57 0.9 Works | |
58 0.8 Doesn't work(\*) | |
59 ----- ------------------- | |
60 | |
61 (\*) This module can be made to work in 0.8 if you do two things: | |
62 | |
63 1. Install | |
64 [util.throttle](http://hg.prosody.im/0.9/raw-file/d46948d3018a/util/throttle.lua) | |
65 into your Prosody source's util/ directory. | |
66 2. If you use libevent apply [this | |
67 patch](http://prosody.im/patches/prosody08-mod-limits-fix.patch) to | |
68 net/server\_event.lua. |