Backend Stuff

The New iToysoldiers Infrastructure

published on

Ahoy, commander.

I gotta say that the last few months have been a bit rough for iToysoldiers. The site itself has been more than a bit flakey.  There's been numerous outages and the site's been sooooo slooooow.  I apologize for this and I have been working on improving it.  In fact, as of September 26th, I'm happy to say that iToysoldiers has a new infrastructure which promises to be considerably more stable and a lot more speedy.  Allow me to tell you about it.

iToysoldiers 5.4: Infrastructure Improvements

The entire purpose of the iTS 5.4 release is to reintroduce stability and performance to the site through improvements to the iToysoldiers Infrastructure.  We're back on Amazon Web Services (AWS) and utilizing a bunch of new tools to make things better.


The first big change is the use of AWS Cloudfront.  Cloudfront is a service that provides caching of static content (css files, php code, images, javascript files, and stuff like that).  When you visit iTS you hit the Cloudfront instance first.  If your visit has content that someone else has already requested it'll be stored in an edge site close to you and won't require that content to be served by the main iTS servers.

This has a huge impact on performance because it allows the iTS database and web servers to focus on the ridiculous number crunching that is part of the services provided by the site.  Pedestrian requests (like images and CSS files) are preloaded and ready to deliver.  It has one other benefit that should help as well:  I can disable access by geographies.  Places that generate 100% unfriendly traffic can be restricted - thus the iTS servers won't have to answer to requests from places that... well... to be honest aren't really the target audience of iToysoldiers.

Elastic Beanstalk

Probably the coolest change is the use of AWS Elastic Beanstalk.  Elastic Beanstalk lets me generate a code base that can be deployed nearly instantly to however many web servers I need to fulfill the requests that the site is generating.  There's a load balancer that sits in front of the web servers and distributes traffic between multiple servers.  If the latency gets too high it'll spin up a new server.  If traffic drops it'll terminate a server (or two).  The best part of this is that the site is self healing.  If a server gets hammered to the point that it fails it'll just spin up a new instance.

It's also pretty neat 'cause I can spin up a "management" instance that'll let me work on the site without impacting you.  Administrative activities tend to be more resource intensive.

Elastic File System

So AWS has a bunch of different ways to provide storage for things like images, css, and the like.  The most well known is S3 which is a object based system that iTS doesn't really handle terribly well (i tried it last year.  It was fine but it was a whole lot of shell game going on).  They also have Elastic File System (EFS).  EFS lets you share a file system between multiple servers and it behaves like a local file system.  All of the pictures of our armies, battles, and avatars are sitting on EFS now.

Relational Database Server (RDS)

So one of the things I've always tried to do (and it wasn't a thing last year and probably the cause of some of the issues earlier this year) is to separate the web servers and database servers for iToysoldiers.  Well, that's been reintroduced.  I'm using AWS RDS 'cause they claim that their "optimized" database servers perform significantly better than a generic server running the database.  Who am I to argue?

Bringing it all together

Is it perfect?  Nope.  For example, last night something hit the site and caused a significant performance issue but it self healed in about 4 minutes.  I'm okay with that.  What we have now is WAY better than it's ever been before.  I'm excited.  iToysoldiers is back in a big way and there's some cool, new stuff in future.  Thanks much for your patience.

Carpe Acies!