大网数据广告活动
服务器运维问答

Is adding Swap on a server with an SSD discouraged?

· 52CE 我爱测

In this tutorial Digital Ocean explain how to enable swap on Ubuntu 14.04. I arrived at this article after experiencing some issues with my server and this looked like it could help. However, they preface the article with a warni…

问题原文

原帖链接 · Jack Roscoe · CC BY-SA 3.0

In this tutorial Digital Ocean explain how to enable swap on Ubuntu 14.04. I arrived at this article after experiencing some issues with my server and this looked like it could help.

However, they preface the article with a warning that dissuades their own users, and anyone else running a server with SSDs NOT to enable swap and instead to upgrade their hardward.

I'm a little confused as to why they have the tutorial at all if it's genuinely a bad idea or if it's a sales ploy.

Can anyone with more knowledge help out?

已采纳解答

原帖链接 · EEAA · CC BY-SA 3.0

Whether or not you provision swap has nothing to do with whether or not you're on flash storage or spinning disk storage.

Everyone agrees that things are sub-optimal if you're hitting swap more than once in a very long period. That said, there are benefits to enabling swap in that it can serve as a "safety valve" of sorts to prevent a complete server crash in the event of RAM contention.

Whether or not you should use swap is not something any of us can answer. You'll need to examine your requirements and your infrastructure to make this decision. If you are running a single server, and if experiencing downtime of this server would be problematic, then it's likely worth it to have a bit of swap space around. On the other hand, if you have a cluster of application servers behind a load balancer, and the loss of one of those servers won't adversely affect your application, then you may decide to not maintain swap space on those systems.

For systems that *do * have swap space, be sure to monitor it very closely. You want to know quickly if the server starts using swap.

摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。

资料来源与适用范围

资料来源
Server Fault
适用范围
以原帖系统、软件版本与发布日期为准(2017-03-13)
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY-SA 3.0

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。