问题原文
原帖链接 · 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.
摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。
