TL;DR: yes, it's OK to have swap on SSD, and swap partition is only one of many factors that may ( not necessarily will ) decrease SSD lifespan
Let's address the elephant in the room first: beginning with 18.04 release Ubuntu uses swap file instead of full partition ( see release notes ). So you won't have swap partition in the first place unless you yourself make one.
Now back to the topic. To some extent it was true that having swap partition may decrease SSD life when SSDs just came out. This has to do with the amount of writes that SSD can withstand and how aggressively your OS uses swap. To quote Wikipedia article on the topic:
If a particular block was programmed and erased repeatedly without writing to any other blocks, that block would wear out before all the other blocks — thereby prematurely ending the life of the SSD
So if your machine uses swap a lot - that is a lot of writes to that particular area of the drive - that decreases SSD life expectancy, even though other parts may be good. Note also that life of an SSD depends also on the particular technology used - cheaper drives use less reliable flash storage in general, and obviously more expensive - last longer with better flash storage. Other things affect SSD lifespan such as:
- power outages and spikes
- hibernation ( which saves a lot of RAM contents to disk )
- if your SSD will be in datacenter environment, there's a potential that a lot of writes to log files can have an effect of lifespan, which I am guessing is why Debian suggests
/var/log to be in persistent ramdisk.
ZDnet cites an article on the research performed by a professor at University of Toronto and Google, according to which one of the key conclusions is "SSD age, not usage, affects reliability." In other words, if this study is correct, even with high usage swap it's not going to drastically affect SSD reliability. Among other things, swap's primary purpose is to free up RAM so that more RAM is available to new processes. Well, with low swappiness setting and high RAM amounts nowadays, swap is used less and less, so it won't contribute as much to the lifetime of SSD.
It's also worth noting that swap partitions support TRIM according to answer on our fellow SO site Unix&Linux, which also plays a role in wear leveling - swap is not just wearing out SSD, but also has ability to engage SSD's built-in wear leveling mechanisms.
In conclusion, yes, it's OK to have swap partition and swap file, because:
- SSD life depends on multiple actors
- having swap or swap partition is still necessary to free up RAM memory that processes need
- with larger RAM sizes swap is used less and less nowadays, hence less worry about swap reads and writes contributing to wear