In two cases: memory and disk warning, rabbit MQ stops reading the client's connection socket. To prevent crash from crashing, the following two cases are available: when the memory usage reaches the configured value, the disk space drops to the configured value. In either case, the server temporarily blocks the connection-the server suspends the connection of the client that reads the published message, connection heartbeat monitoring will also be disabled. If all network connections in rabbitmqctl and Management query are in blocking status, it means they have not tried to send, so they can continue. If it is in blocked status, it means they have been released and need to be paused now. Cluster warning when the rabbit MQ cluster is running, the memory and disk warning are within the cluster range. If a node reaches the limit, all nodes will block the connection. The intention is to stop the producer but keep the consumer unaffected. However, because the Protocol allows the producer and consumer to operate on the same channel or different channels connected to the same channel, this logic is imperfect and will not cause any problems in practice, because Throttling is observed as a delay. However, we recommend that you use separate connections for production and consumption respectively. File descriptor depletion running out of file descriptors when the server uses all the file descriptors assigned to it by the operating system, it will reject client connection, refer to "Network Guide" to learn more. When the client tries to send messages faster than the server receives messages, they will enter the instantaneous traffic control. Related topic Memory How to restrict working disks how to restrict working clients can detect whether they are blocked memory warning the rabbit MQ server will detect the ram size on the machine when starting and executing rabbitmqctl set_vm_memory_high_watermark fraction, by default, when Rabbit MQ uses more than 40% of the memory, it will issue a memory warning to block all connections that publish messages. Once the warning is cleared (etc, the server paging message is sent to the hard disk or the message is sent to the consumer and confirmed.) The service returns to normal. The default memory threshold is 40%. Note that this does not prevent the rabbit MQ server from using less than 40%. It only means that when the point is reached, the publisher will be killed. In the worst case, erlang virtual opportunity causes double memory usage (RAM 80%). We strongly recommend that you enable swap and page files for the operating system. The 32-bit architecture limits the memory size of each process to 2 GB. Generally, 64-bit (AMD or interleaving) allows 256 TB for each process and 64-bit windows limits the memory size to 8 TB. However, even in 64-Bit mode, the maximum available address space of 32 processes is 2 GB. To configure the memory threshold, you can edit the configuration file to adjust the memory threshold that triggers throttling. The default value of the threshold bit is 0.4vm _ memory_high_watermark.relative = 0.4. The following uses the classic configuration format:
[{Rabbit, [{vm_memory_high_watermark, 0.4}].
The default value 0.4 indicates that the installed Ram or available virtual address space is 40% less than the two. If you have installed 4G memory on a 32-bit machine, 40% of 4G is 1.6 GB, however, in 32-bit windows, each process is limited to 2 GB, and all the thresholds are actually 40% (820 MB) of 2 GB ).
In addition, the memory threshold can be adjusted by setting an absolute value of Ram. The following example sets the threshold to 1073741824 bytes (1024 MB)
Vm_memory_high_watermark.absolute = 1073741824
The same example, but the memory unit is used
Vm_memory_high_watermark.absolute = 1024 MB
Use the classic configuration format
[{Rabbit, [{vm_memory_high_watermark, {absolute, 1073741824}].
Classic format with Unit
[{Rabbit, [{vm_memory_high_watermark, {absolute, "1024mib"}].
If the absolute value is greater than the space of the installed Ram or available virtual address, the threshold value is smaller.
The memory limit is appended to the rabbitmq_nodehome.log when the rabbit MQ server is started.
= Info report = 29--200-2009: 15: 43: 27 =
Memory limit set to 2048 MB.
When running borker, you can also use the rabbitmqctl set_vm_memory_high_watermark fraction command or the rabbitmqctl set_vm_memory_high_absolute memory_limit command. The memory unit can also be used and the command takes effect immediately until the broker is, if the broker restart takes effect, the corresponding configuration file also needs to be changed. When this command is executed but the threshold value is not changed, in the ram system with hot swapping, the threshold value may change (because the total memory size has changed ..)
Disabling all publishing settings with a threshold of 0 will immediately trigger a memory warning to block all publishing connections (this is useful if you want to disable global publishing) and use rabbitmqctl set_vm_memory_high_watermark 0. when a limited address space runs 32-bit Erlang on a 64-bit machine, the address memory is restricted and the server will detect and print the following message:
= Warning report ==== 19-dec-2013: 11: 27: 13 ====
Only 2048 MB of 12037 MB memory usable due to limited address space.
Crashes due to memory exhaustion are possible-see
HTTP: <em> // www.rabbitmq.com/memory.html?address-space </em>
The memory warning is not perfect. Although stopping the release usually prevents further use of the memory, there is still a great possibility that other things will continue to improve the memory usage. Generally, in this case, the physical memory is exhausted, and the operating system starts to switch. However, when a limited address space is used, the VM may suffer a loss when the limit is exceeded.
Therefore, we strongly recommend that you run a 64-bit Erlang VM on a 64-bit OS. Before the broker reaches high watermark to block the publisher, it tries to release the memory by page the queue content to the disk, and the persistent and instantaneous messages will be page out. by default, this happens when the borker reaches 50% of the threshold (the default memory threshold is 0.4, when 0.2 of the memory is used. You can modify the vm_memory_high_watermark_paging_ration Configuration:
Vm_memory_high_watermark_paging_ratio = 0.75
Vm_memory_high_watermark.relative = 0.4
Use the classic Configuration:
[{Rabbit, [{vm_memory_high_watermark_paging_ratio, 0.75 },
{Vm_memory_high_watermark, 0.4}].
The above configuration starts paging when the memory usage reaches 04.*0.75 = 0.3, and the publisher is blocked when the memory usage reaches 0.4. You can set vm_memory_high_watermark_paging_ratio to a greater value than 1. In this case, the queue will not page the content to the disk. If a memory warning is triggered, the producer will be blocked as described above.
If the rabbit MQ server does not recognize your system, it will append a message to the rabbitmq_nodename.log file, and then it will assume that there is a 1 gram installation.
= Warning report === 29-oct-2009: 17: 23: 44 ===
Unknown Total memory size for your OS {UNIX, magic_homegrown_ OS}. Assuming memory size is 1024 MB
In this case, the vm_memory_high_watermark configuration value uses 1 GB. When the default value is 0.4, the memory threshold of rabbitmq is 410 mb. Therefore, when the memory usage exceeds MB, it will kill the producer. When rabbit MQ does not recognize your platform, if you have 8 grams, you want the threshold value of 0.3 to throttle the producer when the memory exceeds 3G,
Disk warning when the available disk space drops to the configured value (50 MB by default), a warning will be triggered, and all producers will be blocked to avoid filling the entire disk, this will cause the write operation of the node to fail, resulting in the interruption of rabbit MQ. To reduce the risk of filling the disk, all incoming messages will be blocked, instantaneous messages under the pressure of memory, it will also be page-to-disk and will continue to occupy the disk space that has reached the critical value. If the warning setting of the queue is too low, the message will be quickly page, A full disk may be filled in between two disk space checks, resulting in rabbit MQ crash (10 s ), a more conservative approach is to set the limit to the same as the amount of memory installed on the system (see the configuration below ). If the disk space falls below the configuration value, a warning is triggered. The free space of the disk or partition used by the broker database is detected every 10 s to determine whether to trigger or clear a warning, monitoring starts when the server is started. An entry is added to the log file:
= Info report = 23-jun-2012: 14: 52: 41 =
Disk Free limit set to 953 MB
On unknown platforms, monitoring is disabled and messages are printed in logs:
= Warning report === 23-jun-2012: 15: 45: 29 ====
Disabling disk free space monitoring
When rabbit MQ is run in the cluster, the disk warning is also within the cluster range. If a node reaches the limit value, all nodes will block messages.
Rabbit MQ regularly checks the available disk space. This frequency is related to the available space size during the next check (to ensure that the disk warning can be triggered in time when the disk is about to run out ), generally, the disk space is checked every 10 seconds, but the frequency increases when the value is close to the limit value. When the value is very close, the detection will be 1 second and 10 times, which may affect the system load. When the available disk space falls below the configuration value, rabbit MQ will block the producer and block the message page in the memory from the disk. This will reduce the risk of a crash caused by disk depletion, but it cannot be completely eliminated. In particular, when a message is quickly page to the disk, the entire available space may be used up between two disk checks. The conservative practice is as follows: Configuring the disk available space value the disk available space limit is set through disk_free_limit, the default 50 m is used for database partition availability. The configuration file sets the available space to 1 GB.
Disk_freee_limit.absolute = 1000000000
Additional unit (kb, MB, GB)
Disk_free_limit.absolute = 1 GB
Use the classic format
[{Rabbit, [{disk_free_limit, 1000000000}].
Band Unit
You can also set the disk available space to be related to the memory on the machine. This configuration sets the disk available and memory size to be the same.
Disk_free_limit.relative = 1.0
Classic Configuration
[{Rabbit, [{disk_free_limit, {mem_relative, 1.0}].
This configuration can be executed by running the rabbitmqctl set_disk_free_limit command on the broker.
Or use the rabbitmq_disk_free_limit mem_relative value. This command takes effect immediately until the broker is stopped. If the restart takes effect, modify the configuration file. Flow Control rabbitmq reduces the connection speed. When the sending queue is too fast to keep up, no configuration is required. The flow status of a traffic control connection is displayed in rabbitmqctl and the management plug-in. This means that the connection is blocked every second and the contact is blocked several times, this allows the message receiving rate to match the processing rate of the server. Generally, the traffic-controlled connection is no different from the normal operation. If the traffic-controlled status notifies SysAdmin, the sending rate should be limited, but from the client perspective, it seems that the server bandwidth is lower than the actual bandwidth.
Rabbitmq memory and disk warning