Unixcop published a tutorial showing you how to use ZRAM as swap on Ubuntu 22.04.
ZRAM as swap on Ubuntu 22.04
zram is a kernel module in which data written to the device nodes it creates are compressed and stored in memory itself . This is similar to tmpfs in which one could mount a directory as tmpfs and the data would be stored in memory rather than on disk.
ZRAM as swap on Ubuntu 22.04 - Unix / Linux the admins Tutorials