Showing posts with label server. Show all posts
Showing posts with label server. Show all posts

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.

Friday, November 21, 2014

The new enkrypt.in is here

After more than a year of rigorous development, the new interface is finally out in the open.
Well I'll be honest, the reason it took me so long for this project was because I have a surprising talent for automatically procrastinating. My daily work cycle includes spending the day with the editor in the background, buried by every distraction the internet has to offer; and then pushing code after midnight at a rate that is not recommended for the healthy. I've lost count of how many sleepless nights this website now owes me, but I am indeed glad that it's finally fucking over.


Procrastination wasn't the only thing that held me back though. I did run into a dilemma halfway through the development process. My web host got taken down a couple of months ago (The host was not owned by me), and that's when I realized that I needed a permanent hosting solution instead of migrating from one free host(er) to another.
So now came the issue of retrieving backups from the expired host, painfully shelling out money to buy some new server space, and then configuring it right to host my website (If I ever somehow finished it). Of course, I did finally finish it, but I also bought a sweet VPS for myself from Digital Ocean along the way.

If you haven't noticed yet, my proudest part of enkrypt.in is the way I've made everything dynamic. Page reloads and statically loading content is for wimps. I hand coded most of what you're seeing with the use of barely any plugins. The site design is completely of my creation but I now wish that I'd used some already existing plugins to help me out and save all that work. There's a lot of PHP, a lot more of Javascript and some HTML from me that's holding this place together.
There are still possibly tons of bugs throughout the site even though I think I've smoothed out most issues, so if you're the kind of guy who likes to toy around with fragile, poorly protected webpages for vulnerabilities, then by all means go ahead. But even if you're not, please let me know if you discover a bug, glitch or error that's not supposed to be there so that I can fix it at once.

I again haven't written a blog post in more than a year because I'd promised myself not to, until I'd finished my site since my blog's being integrated into it. So now that that's done, I'll hopefully stick to my new rule: of keeping my content short. (some of my previous posts were way longer than they needed to be), and posting more often.

Well there should be a good amount of content here on this site for you to go through, and hopefully some will interest you. If you like what I've made and think this is neat, there should be some Like, Share and Plus One buttons on this page that I would really thank you for using.

Thursday, December 13, 2012

My website is back with a bang

This post is part of the "First Few Old Blog Posts" archive.
You could expect a certain lack of coherency/maturity from these posts.

Alright , let's narrate the whole event from my point of view.

Last week , during the evening , I desired to check on the Abstergo Project hosted on my website. To my surprise , I was redirected instead to some other advertisement page. Confused , I then tried the direct URL for my website. The same thing happened again. Furious , I logged in to my host's CPanel , and found out that my account was suspended.

I rewarded myself with a big giant Facepalm. I realized what an utter idiot I had been.
My host was called 0fees. It was a free host and one of the best in it's business out there. I had previously hosted several websites on it's services and I had no problem trusting it to be reliable with my website too. I trusted it so much to the point that I had kept no backups at all of my site. In fact , anything that was to be backed up , was put up on my website. And now , I realized how stupid I had acted. That day , I remembered a big lesson I had learnt in my childhood.

Never trust anything that's free. (Except Google)

So now I was stuck without a website. All my files were lost. All my database entries were gone. Why was my account suspended? Well it's obviously a marketing gimmick to get me to upgrade to paid hosting. I actually considered paying for the hosting just to recover my files back. But then I realized that the paid hosting would be on a different server , thus removing all hopes for a recovery.

The worse part is that my website meant a lot to me. Every line that I code , every line that I write on the internet , every account that I make somewhere , can be traced from my website. I use my website to organize myself. So that I can keep track of every contribution I make to the internet. This is especially required due to the fact that I have OCD. I have to sort every of my actions else I feel that all my work is useless. I have to remind myself that I have a blog , I have a twitter , I've made my own quotes etc to realize that I have done something atleast. The worse problem an organized person can face is losing his organizer. And I had lost my website.

At once , I began to rewrite my website. It was of course , a hard job. I was aided by Google's webcache and I could recover the text content in my website. But all the resources were lost and I had to make them from scratch. Luckily , I had a backup of a few of my bigger projects thus they could also be restored. Once I was done , came the question of where I would host the website now. I first considered turning my home desktop into a server since it was switched on for 20 hours a day anyway. Then I remembered of my good friend , JamezQ. He owned a server with above 99% uptime. I had hosted small Java projects on it many times and it worked great. But I was hesitant in asking to host my entire website on it. As it turned out , he was glad to have my website on his server. And so , I uploaded all my files , configured the MySQL databases , and restored the subdomains. But even then , a few projects could not be restored as I had kept the backups on my laptop which I do not have right now.

So , yeah. There you go , my website is back with a new look. There's new content and a better interface.
Check it out at http://enkrypt.in

Also , while making the website , I took to myself for making some entertaining error pages.
400 - Bad Request http://enkrypt.in/400.htm
401 - Authorization Required http://enkrypt.in/401.htm
403 - Forbidden http://enkrypt.in/403.htm
404 - Not found http://enkrypt.in/404.htm
500 - Internal Server Error http://enkrypt.in/500.htm