每天学五分钟 Liunx 0001 | 存储篇:swap
swap
swap 构建
[root@test test]# fdisk /dev/sdb The device presents a logical sector size that is smaller than
the physical sector size. Aligning to a physical sector (or optimal
I/O) size boundary is recommended, or performance may be impacted.
Welcome to fdisk (util-linux 2.23.2). Changes will remain in memory only, until you decide to write them.
Be careful before using the write command. Command (m for help): n
Partition type:
p primary (1 primary, 0 extended, 3 free)
e extended
Select (default p): p
Partition number (2-4, default 2):
No free sectors available
[root@test test]# lvdisplay | grep test
LV Path /dev/lianhuasheng/test
LV Name test
[root@test test]# free
total used free shared buff/cache available
Mem: 65692228 56611752 631264 56492 8449212 7650528
Swap: 0 0 0 [root@test test]# mkswap /dev/lianhuasheng/test
mkswap: /dev/lianhuasheng/test: warning: wiping old ext4 signature.
Setting up swapspace version 1, size = 204796 KiB
no label, UUID=2ed9b70d-b267-4c26-9159-1bfb273c7d7c [root@test test]# free
total used free shared buff/cache available
Mem: 65692228 56359176 1139968 56492 8193084 7902468
Swap: 0 0 0
[root@test test]# free -h
total used free shared buff/cache available
Mem: 62G 54G 511M 55M 7.9G 7.0G
Swap: 0B 0B 0B
[root@test test]# swapon /dev/lianhuasheng/test
[root@test test]# free -h
total used free shared buff/cache available
Mem: 62G 54G 941M 55M 7.7G 7.2G
Swap: 199M 0B 199M
[root@test lianhuasheng]# dd if=/dev/zero of=/root/lianhuasheng/swap/lianhuasheng.swap bs=1M count=512
512+0 records in
512+0 records out
536870912 bytes (537 MB) copied, 0.356955 s, 1.5 GB/s [root@test swap]# ll -h lianhuasheng.swap
-rw-r--r--. 1 root root 512M Apr 1 00:12 lianhuasheng.swap [root@test swap]# mkswap lianhuasheng.swap
Setting up swapspace version 1, size = 524284 KiB
no label, UUID=510ba316-c6e5-4993-b616-e72969cd6322 [root@test swap]# free -h
total used free shared buff/cache available
Mem: 62G 53G 663M 47M 8.0G 7.3G
Swap: 199M 199M 16K [root@test swap]# swapon lianhuasheng.swap swapon: /root/lianhuasheng/swap/lianhuasheng.swap: insecure permissions 0644, 0600 suggested.
[root@test swap]# free -h
total used free shared buff/cache available
Mem: 62G 54G 304M 47M 8.1G 7.1G
Swap: 711M 200M 511M
[root@test swap]# swapoff /dev/lianhuashengl/test
[root@test swap]# free -h
total used free shared buff/cache available
Mem: 62G 53G 761M 54M 8.0G 7.4G
Swap: 511M 511M 60K [root@test swap]# swapoff lianhuasheng.swap [root@test swap]# free -h
total used free shared buff/cache available
Mem: 62G 54G 888M 55M 7.6G 7.1G
Swap: 0B 0B 0B
磁盘性能
[root@test lianhuasheng]# dd if=/dev/zero of=/root/lianhuasheng/swap/lianhuasheng.swap bs=1M count=512
512+0 records in
512+0 records out
536870912 bytes (537 MB) copied, 0.356955 s, 1.5 GB/s
[root@test swap]# dd if=lianhuasheng.swap of=/dev/null bs=1M
512+0 records in
512+0 records out
536870912 bytes (537 MB) copied, 1.07563 s, 499 MB/s
[root@test swap]# dd if=/dev/sda2 of=disk bs=1K
^C2729809+0 records in
2729808+0 records out
2795323392 bytes (2.8 GB) copied, 11.4058 s, 245 MB/s
[root@test swap]# dd if=lianhuasheng.swap of=/dev/null bs=1M iflag=direct
512+0 records in
512+0 records out
536870912 bytes (537 MB) copied, 1.7492 s, 307 MB/s
[root@test swap]# dd if=/dev/zero of=lianhuasheng.swap bs=1M count=1024 oflag=direct
1024+0 records in
1024+0 records out
1073741824 bytes (1.1 GB) copied, 2.5872 s, 415 MB/s
[root@test swap]# dd if=/dev/sda2 of=disk bs=1K iflag=direct oflag=direct
^C328136+0 records in
328135+0 records out
336010240 bytes (336 MB) copied, 93.313 s, 3.6 MB/s
sync && echo 3 > /proc/sys/vm/drop_caches
[root@test swap]# free -h
total used free shared buff/cache available
Mem: 62G 56G 1.0G 55M 5.0G 4.8G
Swap: 0B 0B 0B [root@test swap]# sync && echo 3 > /proc/sys/vm/drop_caches [root@test swap]# free -h
total used free shared buff/cache available
Mem: 62G 54G 7.3G 55M 901M 7.2G
Swap: 0B 0B 0B [root@test swap]# dd if=lianhuasheng.swap of=/dev/null bs=1M iflag=direct
1024+0 records in
1024+0 records out
1073741824 bytes (1.1 GB) copied, 3.54052 s, 303 MB/s [root@test swap]# dd if=lianhuasheng.swap of=/dev/null bs=1M iflag=direct
1024+0 records in
1024+0 records out
1073741824 bytes (1.1 GB) copied, 3.49309 s, 307 MB/s
[root@test test]# hdparm -t /dev/sda2 /dev/sda2:
Timing buffered disk reads: 1334 MB in 3.00 seconds = 444.43 MB/sec
[root@test test]# hdparm -T /dev/sda2 /dev/sda2:
Timing cached reads: 17748 MB in 2.00 seconds = 8888.37 MB/sec
内存和磁盘| buffer cache 和 page cache
[root@test test]# free -wh
total used free shared buffers cache available
Mem: 31G 8.9G 10G 1.6G 326M 11G 20G
Swap: 511M 371M 140M
buffers
Memory used by kernel buffers (Buffers in /proc/meminfo) cache
Memory used by the page cache and slabs (Cached and Slab in /proc/meminfo)
每天学五分钟 Liunx 0001 | 存储篇:swap的更多相关文章
- 如何从40亿整数中找到不存在的一个 webservice Asp.Net Core 轻松学-10分钟使用EFCore连接MSSQL数据库 WPF实战案例-打印 RabbitMQ与.net core(五) topic类型 与 headers类型 的Exchange
如何从40亿整数中找到不存在的一个 前言 给定一个最多包含40亿个随机排列的32位的顺序整数的顺序文件,找出一个不在文件中的32位整数.(在文件中至少确实一个这样的数-为什么?).在具有足够内存的情况 ...
- 五分钟学Java:如何才能学好Java Web里这么多的技术
原创声明 本文作者:黄小斜 转载请务必在文章开头注明出处和作者. 系列文章介绍 本文是<五分钟学Java>系列文章的一篇 本系列文章主要围绕Java程序员必须掌握的核心技能,结合我个人三年 ...
- 零元学Expression Blend 4 - Chapter 42 五分钟快速完成扇形变圆形动画
原文:零元学Expression Blend 4 - Chapter 42 五分钟快速完成扇形变圆形动画 零元学Expression Blend 4 - Chapter 42 五分钟快速完成扇形变圆形 ...
- 《sed的流艺术之一》-linux命令五分钟系列之二十一
本原创文章属于<Linux大棚>博客,博客地址为http://roclinux.cn.文章作者为rocrocket. 为了防止某些网站的恶性转载,特在每篇文章前加入此信息,还望读者体谅. ...
- GC算法精解(五分钟让你彻底明白标记/清除算法)
GC算法精解(五分钟让你彻底明白标记/清除算法) 相信不少猿友看到标题就认为LZ是标题党了,不过既然您已经被LZ忽悠进来了,那就好好的享受一顿算法大餐吧.不过LZ丑话说前面哦,这篇文章应该能让各位彻底 ...
- zookeeper-架构设计与角色分工-《每日五分钟搞定大数据》
本篇文章阅读时间5分钟左右 点击看<每日五分钟搞定大数据>完整思维导图 zookeeper作为一个分布式协调系统,很多组件都会依赖它,那么此时它的可用性就非常重要了,那么保证可用性的同 ...
- 「每日五分钟,玩转JVM」:线程共享区
前言 上一篇中,我们了解了JVM中的线程独占区,这节课我们就来了解一下JVM中的线程共享区,JVM中的线程共享区是跟随JVM启动时一起创建的,包括堆(Heap)和方法区()两部分,而线程独占区的程序计 ...
- 五分钟搭建一个基于BERT的NER模型
BERT 简介 BERT是2018年google 提出来的预训练的语言模型,并且它打破很多NLP领域的任务记录,其提出在nlp的领域具有重要意义.预训练的(pre-train)的语言模型通过无监督的学 ...
- Python专题——五分钟带你了解map、reduce和filter
本文始发于个人公众号:TechFlow,原创不易,求个关注 今天是Python专题第6篇文章,给大家介绍的是Python当中三个非常神奇的方法:map.reduce和filter. 不知道大家看到ma ...
- 一门能让你五分钟学会的语言-Brainfuck
看到标题,不出意外的话,你肯定开始骂我了:**标题党,什么编程语言五分钟就能学会? 其实我本来也是不相信的,但是学过了才知道这是真的. 1.Brainfuck 看到这个小标题,不要误会,我没有骂人. ...
随机推荐
- 【OpenCV】【Python】关于cv2.findContours()轮廓索引(编号)解析(RETR_TREE)
在打算自己实现二维码的定位的时候,看到了相关博文的关于cv2.findContours返回的层级信息来定位三个"回"字从而达到定位二维码的目的,但是返回的hierarchy中的层级 ...
- pytest框架学习-fixture
一.fixture是什么 被@pytest.fixture()装饰器装饰的函数就是一个fixture,fixture可以灵活的为不同范围的测试用例提供前置和后置操作,以及向测试用例传递测试数据. 二. ...
- ASR项目实战-语音识别
本文深入探讨语音识别处理环节. 本阶段的重点特性为语音识别.VAD.热词.文本的时间偏移.讲话人的识别等. 语音识别 业界流派众多,比如Kaldi.端到端等,具体选择哪一种,需要综合考虑人员能力.训练 ...
- vivo 数据库备份恢复系统演化
作者:vivo 互联网数据库团队 - Han Chaobing 介绍 vivo 数据库备份恢复功能的演化,以及对备份文件的功能扩展. 一.概述 vivo互联网领域拥有的数据库组件分别为 MySQL.M ...
- JavaFx之Ikonli图标库大全(十五)
JavaFx之Ikonli图标库大全(十五) Ikonli给java提供了大量的图标库, 官网:https://kordamp.org/ikonli/ Ikonli 提供了可以在 Java 应用程序中 ...
- P3537 [POI2012]SZA-Cloakroom 题解
题目大意 有 \(n\) 件物品,每件物品有三个属性 \(a_i, b_i, c_i (a_i < b_i)\). 再给出 \(q\) 个询问,每个询问由非负整数 \(m, k, s\)组成,问 ...
- Luogu P4524 Ceste 题解
题目链接:\(\texttt{Luogu P4524 Ceste}\) 简化题意 给定一个有 \(n\) 个点 \(m\) 条边的无向图.每条边的边权为一个二元组 \((a, b)\),求以 \(1\ ...
- 计算机网络分层结构--OSI模型、TCP/IP 模型、五层模型
计算机网络分层结构 OSI参考模型与TCP/IP参考模型 五层参考模型
- vue图片由小放大
原生效果 <template> <div> <transition> <img :src="imageUrl" class="i ...
- html2pdf
nodejs 生成pdf比较靠谱,使用chrome核心渲染: puppeteer / phantom 爬虫都好用 good