Showing posts with label memory. Show all posts
Showing posts with label memory. Show all posts

Sunday, February 8, 2015

I can't live without the Internet

Really, it's true. They say the first step in solving a problem is to acknowledge it. I've come to terms with it, but I admit, I have no intention of solving it whatsoever.

If you don't already know, I moved out of my old apartment the day before. 15 years in that infernal place, and you'd at least expect me to miss it. But maybe the reason I don't is because I live right next to it. Yeah, the new apartment I moved into is in the same complex. It's in a different "block" as they call it, so I need to walk across the garden whenever I go back and forth. It made carrying all my stuff from one apartment to another considerably easier, so I can't complain.

The internet connection in the new apartment hasn't been applied for yet, so I spent more than a day in the dark abyss that is Offline. Before that, while I was still in the process of moving in and moving out, I'd just sit in my old apartment whenever I wanted to use the internet for a while. Because I'm a lazy little shit, I didn't like walking all the way across just for this, and now that all my stuff had already been moved, I found little point in going there at all. A day passed before I realized that I really really needed the kick that only one thing could deliver.

My desperate little brain just then had an epiphany. Somewhere in the dark crevasses in my memory of all the technical crap I unearthed in my spare time, I remembered something,
The 802.11 specifications allowed a minimum coverage of approximately 100 metres in a straight unobstructed line through air. 
(I didn't expect my memory to actually hold, but according to this Wikipedia article, I was close enough)

I didn't know how far my old apartment's balcony was from my new one's, but I knew that 100 metres was a lot. There was only one way to find out. I went back, found the furthest balcony and kept the router right on the ledge facing the rest of the complex. I propped it up on a couple of books so that even by accident, the router would fall inside the balcony, instead of five stories down. I had some long wires, so I managed to connect the router to the ADSL modem well inside the room. After making sure everything was working fine, I crossed my fingers and went back to my new apartment.

As it turns out, I live less than a WiFi range away. Obligatory celebration dance followed. With my 12th grade board examinations starting this Monday, this is obviously very bad news for my marks.
The connection keeps dropping on my phone unless I'm standing close enough to the balcony, and it's even more unstable in my room, but like I said, as long as I have the Internet, I'll survive.

QQnLBVzgBDOUz78BwlBK3V1x6p3IBqE6IVemk03Dx3QKDUNuJNOQK/vc45eo4mlFYtGjrSGTt76r5GDlDqaSN+evrlrxmJRqLuRJvQi+YIw/oXoCxb+dY0EtY0XzWf8Ifn/+Y1IOXvFCpjSOMHIYs0dGRDhAqgv+IDM/8dANSazo9wGsoiPE8zv+6rpbxAGw0g8GaNKNgXihqp1U7N0Ffl9ktRQusqdxp7a5aBxxuyDojo60fSAUuO5B1sTu+9wwd+Bgi/PYwyRzXcPKtmNNqyVC9SCtl0DmVwZtal0o83obgIMg96wLU17bB2vuwQ1oMAczqa1xnnWoWTiS5AH//Moe9rjpyBYOgJcVPg9VYmuWZutp3CmasUKUikPR4mtDNygnDsdLJHlSS8/ApfpmLZKPyg8MbWkbV6ZuFR8KwS7+u2/yusksGpGaZW8aTVcGzUzsexbEZh0Nywux08g/+I8FW3Xmfhy1FIpwNMBSYU6yynjCXU2GP2b7zY26sVUdv1jWhYu5Rst2CrX1URDosbdM+7n8rvV61GPGZUodEoR7JBwKjuHww4yxtmMvsdT8Ou3hKkk1pdqJCBy46dLYecjMv0MwmBD1zxM53JuaUo393QM4v2TV9WkxFuoddsurBKBh+CEBwGioBWH3cBaYHjUGf8+LykyBLj56oKrmqf0=

Friday, November 28, 2014

Running a craftbukkit minecraft server for less than 512MB of RAM

Note: This post is not for those looking to run a server on a Raspberry Pi. There's a lot of guides for that, and you don't need any additional help

If you play minecraft, you probably know how memory demanding this game can be. This is the same with minecraft servers as well, and if you're running craftbukkit with a good amount of plugins involved, you might as well just have sold your RAM sticks to Satan himself.

The problem is, a lot of people like me might not have enough RAM on our systems, but we still want to run one of those fancy community minecraft servers anyway. So what do we do to solve the impossible?

Well in my case, the machine I wanted to run a bukkit server on was a Digital Ocean VPS that I rented primarily to host my website. Unfortunately, my droplet featured only a 512MB memory module and my LAMP package took up a good percentage of that. So that left me with something close to 350MB of memory for anything else.
Having had experience at running heavy bukkit servers on my home desktop before, I knew that if I ever wanted to run a minecraft server off this system, I'd have to come up with a good solution.

If you've done a bit of research prior to reading this post, you'll know that Spigot is an optimized version of craftbukkit for this very purpose. So the first thing I did was simply drop the spigot jar file on my VPS and run this command :

java -Xms192M -Xmx512M -XX:MaxPermSize=128M -jar spigot.jar

Everything loaded up fine, but whenever I connected to it via my Minecraft client, the Java process got killed by the OS. I tweaked around with the Xms and Xmx flags in the command but no matter what, the server process never survived after a player connecting. All I could see was "Killed" before the process exited and I was sent back to the command line.


After lots of searching on Google and posting on forums, I got the same answer everywhere:

I simply did not have enough RAM on my machine. 

Almost ready to give up, I found this post on my VPS company's support forum.
All Digital Ocean droplets came along with SSD drives for hard storage. In that context, the answer made a lot of sense. Even if the java process did use some of my SSD for memory, the fact that they were Solid State Disks, and not regular Hard Disks should reduce the lag issue that arises from this solution by a huge factor.
Turns out, my VPS did not have swap enabled by default, so I followed the guide provided for my version of Ubuntu to set it up.

Once done, I launched the minecraft server, and voila! It's been running ever since, even with a couple of bukkit plugins attached.
So in summary. if you have less memory to run a minecraft server, the most likely solution is to use a swap file/drive along with your system.

Hopefully, this guide has helped you learn some concepts at least if not for directly helping you out with your issue. If you have the time, feel free to drop by my minecraft server. Point your clients to "enkrypt.in" and you should be set.