Setting up Swap Memory in linux server

Clickbait version: Increase your server’s system memory for free! 😀

Swap space in Linux is used when the amount of physical memory (RAM) is full. If the system needs more memory resources and the RAM is full, inactive pages in memory are moved to the swap space.[src]

Note: Not recommended to be used in production environment. Swap space is very slow compared to physical memory and can seriously affect your application performance.

It’s fairly common to run into “System.OutOfMemoryException” if you are running a memory heavy application or multiple applications on a remote server.  To mitigate this issue you can simply create a Swap space for your server and use your disk space as system memory, this will be a little slower but you wouldn’t have to upgrade your server to higher memory one if you just need some MBs of extra ram or maybe need to perform a single task which needs some extra memory.

To enable 2GB of swap space use the following commands


sudo /bin/dd if=/dev/zero of=$SWAPFILE bs=1M count=$SWAP_MEGABYTES
sudo /bin/chmod 600 $SWAPFILE
sudo /sbin/mkswap $SWAPFILE
sudo /sbin/swapon $SWAPFILE

Continue reading “Setting up Swap Memory in linux server”

Let’s Encrypt (free SSL) on WordPress running on Debian 8

Let’s Encrypt is an amazing service which allows you to add SSL certificates for free on your website. But the process isn’t straightforward if you are running Debian 8. No worries, you can always use the Let’s Encrypt git repo to install the certificates.

Sidenote: You can use this method to install Let’s Encrypt SSL on any OS and for any application.
Continue reading “Let’s Encrypt (free SSL) on WordPress running on Debian 8”

S3 as outbound mail content storage for Ruby On Rails

“Information is the oil of the 21st century, and analytics is the combustion engine.”

Since Amazon SES and some other email service providers don’t store show you the email content and history, you are left hanging if you want to some historical email performance and analytics. Keep track of outbound emails for Logging, Analytics and Audit purposes by following this simple setup.

Continue reading “S3 as outbound mail content storage for Ruby On Rails”

McLeod Ganj and Trihund Trek

Recently, I went to McLeodGanj and had an awesome time there. I am sharing some of my photographs.

At first I went straight to the Dalai Lama Temple. It was perfect timing since the prayers had just started.

(Please keep in mind that the images are taken using my phone, so don’t expect DSLR class photographs. :))

Now since I was in the mountains the weather was bound to be exhilarating. 

After checking out the market and having lunch, I went to an early sleep.

“Early to bed, early to rise!”
Got up at 5:00 AM, sharp. And went to Trihund Hill for the trek.

The view looks awesome!

Whoooa! Had a hard time gulping it. But, nothing can stop me now.

Finally, after 4 hours of continuous walking, reached the Trihund Hill.

These images couldn’t capture the cool breeze, the feeling when you are on top of a mountain, the sheer happiness and the aching muscles after the trek.

This was one my best trips so far. Will cherish it for life.

I already miss you, McLeodGanj.