For my dev flow, I need to run a ring backend server, figwheel for frontend hot loading, and a datomic database. For the uninitiated, each of them is running on a different JVM and now add IntelliJ(curse me for not learning Emacs), a browser with a million tabs, Spotify, Slack, Zoom and there's no difference between a toaster and Macbook.
Although you can control the JVM memory usage, it's easy to run into memory issues and I'm yet to find a decent balance between performance and memory usage.
macOS extensively uses swap to address memory overflow but SSD's lifespan decreases with each write and more importantly, it's slower than RAM, which results in slower operations and workflows.
Reduce the memory allocation pool by tuning JVM with Xms option
Putting all things in a server
Get your code on a 20$ machine which gives you 2CPUs and 4 gigs of RAM. I found this enough and added more swap just in case. Setup your Nginx ssl and certificates if any and start the servers.
Connecting to remote machine
You don't want to swap local URLs with server URLs and run the whole process; there's something better i.e ssh port forwarding. Start port forwarding with this:
Every request to localhost:port-1 will forward to server's port-1
Now for every change you make to your IntelliJ you want to see your changes hot loaded. All intelli-j products have file watchers. File watchers allow you to run a script when a file is saved, which is exactly what we need. Add a file watcher which rsync's your local codebase to remote. A couple of lines of bash