zoukankan      html  css  js  c++  java
  • 增加swap内存

     企业案例场景:100%
    swap在工作中,特别是java环境,程序写的有问题,会发生内存泄露,可能会被占用。
    让开发改程序,临时运维加大swap。swapoff,swapon。
    数据库不用swap。
     
    查看文件及目录大小
     [root@oldgirl ~]# du -sh /etc
    30M     /etc
    [root@oldgirl ~]# du -sh /etc/*
     
    增加swap的内存操作
     
    [root@oldgirl ~]# dd if=/dev/zero  of=/tmp/swap bs=1M count=128
    记录了128+0 的读入
    记录了128+0 的写出
    134217728字节(134 MB)已复制,1.97703 秒,67.9 MB/秒
    [root@oldgirl ~]# mkswap  /tmp/swap
    mkswap: /tmp/swap: warning: don't erase bootbits sectors
            on whole disk. Use -f to force.
    Setting up swapspace version 1, size = 131068 KiB
    no label, UUID=56cd5e5d-d9f2-4ba0-9156-dd899650af9c
    [root@oldgirl ~]# free -m
                                          total       used       free     shared    buffers     cached
    Mem:                              981        493        488          0         30        358
    -/+ buffers/cache:          104        876 
    Swap:                             767          0        767 
    [root@oldgirl ~]# swapon /tmp/swap 
    [root@oldgirl ~]# free -m
                                            total       used       free     shared    buffers     cached
    Mem:                               981        493        488          0         30        358
    -/+ buffers/cache:           104        876 
    Swap:                              895          0        895 
     
  • 相关阅读:
    中断一个telnet连接
    QQ提示应用程序并行配置不正确,绿色版QQ不能运行解决方法
    新劳动合同法今起实施 正式工与派遣工同工同酬
    最详细的装修施工顺序
    最好的前端hacking备忘录——集锦
    基于vue配置axios
    Vue 实现loading进度条
    Vue 实现countDown倒计时
    使用mongoose操作mongodb数据库
    Vue项目之IE下打开页面是空白
  • 原文地址:https://www.cnblogs.com/liuqiang0/p/8528235.html
Copyright © 2011-2022 走看看