Rocketmq system optimization (centos)

Source: Internet
Author: User

Paste the optimization script in the source code first:

#!/bin/sh## Execute Only Once#echo ‘vm.overcommit_memory=1‘ >> /etc/sysctl.confecho ‘vm.min_free_kbytes=5000000‘ >> /etc/sysctl.confecho ‘vm.drop_caches=1‘ >> /etc/sysctl.confecho ‘vm.zone_reclaim_mode=0‘ >> /etc/sysctl.confecho ‘vm.max_map_count=655360‘ >> /etc/sysctl.confecho ‘vm.dirty_background_ratio=50‘ >> /etc/sysctl.confecho ‘vm.dirty_ratio=50‘ >> /etc/sysctl.confecho ‘vm.page-cluster=3‘ >> /etc/sysctl.confecho ‘vm.dirty_writeback_centisecs=360000‘ >> /etc/sysctl.confecho ‘vm.swappiness=10‘ >> /etc/sysctl.confsysctl -pecho ‘ulimit -n 655350‘ >> /etc/profileecho ‘admin hard nofile 655350‘ >> /etc/security/limits.confDISK=`df -k | sort -n -r -k 2 | awk -F/ ‘NR==1 {gsub(/[0-9].*/,"",$3); print $3}‘`[ "$DISK" = ‘cciss‘ ] && DISK=‘cciss!c0d0‘echo ‘deadline‘ > /sys/block/$DISK/queue/schedulerecho "---------------------------------------------------------------"sysctl vm.overcommit_memorysysctl vm.min_free_kbytessysctl vm.drop_cachessysctl vm.zone_reclaim_modesysctl vm.max_map_countsysctl vm.dirty_background_ratiosysctl vm.dirty_ratiosysctl vm.page-clustersysctl vm.dirty_writeback_centisecssysctl vm.swappinesssu - admin -c ‘ulimit -n‘cat /sys/block/$DISK/queue/scheduler

This script modifies network parameters, admin hard resource limits, and hard disk flushing modes respectively.

You cannot run it directly.

Make the following changes:

The admin user is used in this script. It is estimated that Alibaba's MQ is started with Admin.

If you use root to start rocketmq

echo ‘ulimit -n 655350‘ >> /etc/profileecho ‘admin hard nofile 655350‘ >> /etc/security/limits.conf

These two lines can be commented out, but we do not recommend using root to start the service in the production environment, so I am useradd admin.

Hard Disk Optimization

First, you need to know that the file logs generated by rockermq are stored in the home directory of the running user.

Therefore, you can create an admin in the home directory and then attach the disk to/home/admin.

Next, the hard disk flushing mode (I/O scheduling)

DISK=`df -k | sort -n -r -k 2 | awk -F/ ‘NR==1 {gsub(/[0-9].*/,"",$3); print $3}‘`[ "$DISK" = ‘cciss‘ ] && DISK=‘cciss!c0d0‘echo ‘deadline‘ > /sys/block/$DISK/queue/scheduler

This is not applicable to the author's environment. The purpose is to change the disk flushing mode to deadline.

Check the current hard disk flushing mode (the author's hard disk is SDA)

#cat /sys/block/sda/queue/schedulernoop anticipatory deadline [cfq]

Okay, change it manually.

echo ‘deadline‘ > /sys/block/sda/queue/scheduler

This method takes effect immediately, but will be lost after restart.

If you need to restart deadline, you also need to add the grub parameter.

Edit/etc/grub. conf

Find the kernel line and add it at the end

elevator=deadline


This completes the optimization in this script.

Finally, I posted a modified copy (only making the parameter variable easy to reuse)

Note: (root or sudo permissions are required for execution.) Replace the user and drive letter in the script with your

Sed's/kernel. * $/& elevator = deadline/'/etc/grub. conf

#! /Bin/sh # execute only once # username user = admin # disk drive letter disk = SDA # In grub. to use this function by default, add parameters in Conf. uncomment # sed-I's/kernel. * $/& elevator = deadline/'/etc/grub. confecho 'vm. overcommit_memory = 1'>/etc/sysctl. confecho 'vm. min_free_kbytes = 5000000 '>/etc/sysctl. confecho 'vm. drop_caches = 1'>/etc/sysctl. confecho 'vm. zone_reclaim_mode = 0'>/etc/sysctl. confecho 'vm. max_map_count = 655360 '>/etc/sysctl. confecho 'vm. dirty_background_ratio = 50'>/etc/sysctl. confecho 'vm. dirty_ratio = 50'>/etc/sysctl. confecho 'vm. page-cluster = 3'>/etc/sysctl. confecho 'vm. dirty_writeback_centisecs = 360000 '>/etc/sysctl. confecho 'vm. swappiness = 10'>/etc/sysctl. confsysctl-Pecho "ulimit-N 655350">/etc/profileecho "$ user hard nofile 655350">/etc/security/limits. confecho 'demoline'>/sys/block/$ Disk/queue/schedulerecho "-------------------------------------------------------------" sysctl VM. overcommit_memorysysctl VM. min_free_kbytessysctl VM. drop_cachessysctl VM. zone_reclaim_modesysctl VM. max_map_countsysctl VM. dirty_background_ratiosysctl VM. dirty_ratiosysctl VM. page-clustersysctl VM. dirty_writeback_centisecssysctl VM. swappinesssu-$ user-C 'ulimit-n' CAT/sys/block/$ Disk/queue/schedmit

Now the optimization is complete.

I/O scheduling configuration reference http://doc.opensuse.org/products/draft/SLES/SLES-tuning_sd_draft/cha.tuning.io.html#cha.tuning.io.schedulers

Alibaba OS. Sh source script:

Https://github.com/alibaba/RocketMQ/blob/develop/bin/ OS .sh


Rocketmq system optimization (centos)

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.