centos7系统资源限制整理
概述
在linux系统使用过程中,默认的系统设置足够使用,但是对于一些高并发高性能的程序会有瓶颈存在,这些限制主要通过ulimit查看和修改。
环境
centos:CentOS release 7.0 (Final)或以上版本
ulimit查看
通过命令查看当前账户的限定设置。
ulimit -a
core file size (blocks, -c) unlimited
data seg size (kbytes, -d) unlimited
scheduling priority (-e) 0
file size (blocks, -f) unlimited
pending signals (-i) unlimited
max locked memory (kbytes, -l) unlimited
max memory size (kbytes, -m) unlimited
open files (-n) 65536
pipe size (512 bytes, -p) 8
POSIX message queues (bytes, -q) unlimited
real-time priority (-r) 0
stack size (kbytes, -s) 8192
cpu time (seconds, -t) unlimited
max user processes (-u) 65536
virtual memory (kbytes, -v) unlimited
file locks (-x) unlimited
其中,比较常用的几个是。
“core file size”(coredump记录文件大小,默认为0不记录)。
“open files”(进程打开文件最大数量,默认1024,网络连接较多时会存在瓶颈)。
“max user processes”(用户最大进程数,多进程程序修改)。
设定
ulimit资源设定的修改分硬限制和软限制,软限制无法超过硬限制的上限,硬限制设定需要修改系统配置文件。
格式和说明都在配置文件中有清晰的描述。
vi /etc/security/limits.conf
#Each line describes a limit for a user in the form:
#
#<domain> <type> <item> <value>
#
#Where:
#<domain> can be:
# - a user name
# - a group name, with @group syntax
# - the wildcard *, for default entry
# - the wildcard %, can be also used with %group syntax,
# for maxlogin limit
#
#<type> can have the two values:
# - "soft" for enforcing the soft limits
# - "hard" for enforcing hard limits
#
#<item> can be one of the following:
# - core - limits the core file size (KB)
# - data - max data size (KB)
# - fsize - maximum filesize (KB)
# - memlock - max locked-in-memory address space (KB)
# - nofile - max number of open file descriptors
# - rss - max resident set size (KB)
# - stack - max stack size (KB)
# - cpu - max CPU time (MIN)
# - nproc - max number of processes
# - as - address space limit (KB)
# - maxlogins - max number of logins for this user
# - maxsyslogins - max number of logins on the system
# - priority - the priority to run user process with
# - locks - max number of file locks the user can hold
# - sigpending - max number of pending signals
# - msgqueue - max memory used by POSIX message queues (bytes)
# - nice - max nice priority allowed to raise to values: [-20, 19]
# - rtprio - max realtime priority
#
#<domain> <type> <item> <value>
* soft core unlimited
* hard core unlimited
* soft data unlimited
* hard data unlimited
* soft fsize unlimited
* hard fsize unlimited
* soft sigpending unlimited
* hard sigpending unlimited
* soft nofile 65536
* hard nofile 65536
* soft msgqueue unlimited
* hard msgqueue unlimited
* soft nproc 65536
* hard nproc 65536
* soft locks unlimited
* hard locks unlimited
* soft memlock unlimited
* hard memlock unlimited
修改账户启动执行脚本。
vi ./bash_profile
ulimit -c unlimited
ulimit -d unlimited
ulimit -f unlimited
ulimit -i unlimited
ulimit -n 65536
ulimit -q unlimited
ulimit -u 65536
ulimit -x unlimited
ulimit -l unlimited
总结
实际使用过程中,需要根据服务器运行的程序放开资源的限制。
空空如常
求真得真
centos7系统资源限制整理的更多相关文章
- CentOS7 常用命名整理
前言: 总是为了一点命令去查搜索引擎,今天简单整理了一下常用的一些命名: 一.网络配置相关 0.修改 IP&DNS 信息 # vi /etc/sysconfig/network-scripts ...
- Centos6、Centos7防火墙基本操作整理
Centos7: 查看防火墙状态: firewall-cmd --state 开启防火墙: systemctl start firewalld.service 关闭防火墙(重启失效): systemc ...
- CentOS6与CentOS7的几点区别
重新安装了一个CentOS7,顺便整理一下与自己之前用的CentOS6的区别 CentOS6以下简称c6 CentOS7以下简称c7 1.关于文件系统: c6 6.x使用EXT4,EXT4单个文件系 ...
- redis批量灌库
需求:将批量数据灌入redis中 如果通过代码形式将数据灌入redis中,效率比较低,以下将根据redis的特性进行快速的批量灌库 环境:centos7 将数据整理成规定格式的文件,比如: SET k ...
- Centos7搭建php+mysql环境(整理篇)
终于将mysql+php环境搭建成功,将之前的整理一下,环境:centos7,本机IP:192.168.1.24,数据库用户名及密码都设为root,测试文件路径:/var/www/html 1.取消c ...
- CentOS7开放端口以及常用的使用命令记录整理
CentOS7与以前常用的CentOS6还是有一些不同之处的,比如在设置开放端口的时候稍许有些不同,常用的iptables命令已经被firewalld代替.这几天正好有在CentOS7系统中玩Seaf ...
- centos7上安装与配置Tomcat7(整理篇)
1.检查tomcat7是否已经安装 rpm -qa | grep tomcat ps -ef | grep tomcat 第一条命令查看是用rpm安装过tomcat,由于我们倾向于安装解压版的tomc ...
- expresscache和primocache加速资料整理-centos7缓存加速
expresscache和primocachehttp://www.360doc.com/content/16/0111/17/256680_527142090.shtml 安装expresscach ...
- 直接从硬盘安装centos7网址整理
1.https://blog.csdn.net/happy_joker/article/details/52822025 注意:(1)第3步-->Linux引导安装-->软件选择--> ...
随机推荐
- CF1593D2 Half of Same
题目大意: 给定一个包含 \(n\)(\(n\) 是偶数)个整数的数列 \(a_1,a_2,\ldots,a_n\). 考虑一个可能的正整数 \(k\),在每次操作中,你可以选定一个 \(i\),并将 ...
- 方法引用_通过this引用本类的成员方法和方法引用_类的构造器(构造方法)引用和数组的构造器引用
package com.yang.Test.ThisMethodReference; /** * 通过this引用本类的成员方法 */ public class Husband { //定义一个买房子 ...
- eclipse mave无法下载jar包
解决方法: 先查看本地配置是否正确: 确保此处没有勾选 此处和自己配置的maven一致,没有则修改此处设置.然后项目上右键–>Maven–>Update Project 即可 . 如果还不 ...
- Vue3系列11--Teleport传送组件
Teleport 是一种能够将我们的模板移动到 DOM 中 Vue app 之外的其他位置的技术,不受父级style.v-show等属性影响,但data.prop数据依旧能够共用的技术:类似于 Rea ...
- Spring源码 12 IOC refresh方法7
本文章基于 Spring 5.3.15 Spring IOC 的核心是 AbstractApplicationContext 的 refresh 方法. 其中一共有 13 个主要方法,这里分析第 7 ...
- C++ 遍历磁盘文件 非递归方法 和递归方法
1: 非递归方法: 一起学习 寻找快乐 // File Name: CSearch.h #pragma once #include <vector> #include <atlst ...
- flutter系列之:用来管理复杂状态的State详解
目录 简介 StatefuWidget和State State的生命周期 总结 简介 Flutter的基础是widget,根据是否需要跟用户进行交互,widget则可以分为StatelessWidge ...
- MySQL源码分析之SQL函数执行
1.MySQL中执行一条SQL的总体流程 2.SQL函数执行过程 1.MySQL中执行一条SQL的总体流程 一条包含函数的SQL语句,在mysql中会经过: 客户端发送,服务器连接,语法解析,语句执行 ...
- C# winfrom ListView控件实现自由设置每一行字体及背景色等
背景:公司经常会需要将日志信息,输出到一个对话框中显示出来.之前一直采用的listbox控件,操作简单,使用方便,但是遗憾的是,不能自由控制每一行的状态. 于是想了如下几个方案: (1)重绘listb ...
- Java自增自减运算
自增自减运算 //++(自增) --(自减) 一元允运算 int a =3; //a = a+1-----4 int b=a++; //执行完这行代码后,先给b赋值,再自增 System.out.pr ...