A Low Bang to Buck Ratio

Posted
Coding Docker Node Rendr Six Gaming
The story behind Six Gaming is long, complex, and probably can't be covered in a single post. If I were to sum up what Six Gaming is today, the answer would be "probably should be dead, but stubbornly isn't". I knew this going into redesigning the Six Gaming website, yet I did it anyway. Why?

There's a number of personal reasons involved. My outside hope that some day everyone stops being super busy with life and commits to a podcast again, which is what the original community was built around after our WoW guild died. The only reason I decided to stop streaming it is because no one could commit to the schedule except for me. The website also has a Discord and Twitch bot that promotes streamers, hosting them on our Twitch page, which would be a great tool if the community was still active. However, it's not active, so the main reason I used to justify upgrading Six Gaming? Knowledge building.

Six Gaming is the first website that I've built that runs with a MongoDB back end. It's the second site I've built that uses Docker containers. It's also the second site I've built on my current generation of node.js website architecture, but the first time I've done it within Docker. The website uses Discord.js, Express, FullCalendar, the node.js wrapper for IGDB, the node.js wrapper for MongoDB, and the Twitch.js library that is being rebranded as the ridiculously-named Twurple. However, when I talk about my website architecture, I don't mean the libraries I'm using, but rather the way the website is put together.

I drew some inspiration from the now-defunct Rendr library. It was a node.js library that worked with Backbone.js to let you code a web site just once to render web pages on both the client and server side, making it easy to create single page applications. I was turned on to this library while working for the startup Sift back in 2013, and ultimately used it for my personal site roncli.com. Of course, as soon as I released that site, Rendr stopped getting updated, so I stopped using Rendr and started rolling my own.

The first website I used this new architecture with was the Overload Teams League. I didn't go too far with it, only making it so that there are views that can be rendered either client or server side. I didn't go as far as making it a single page application, that wouldn't come until version 2.0 of roncli.com. The back end architecture is your run of the mill MVC application, nothing too exciting going on. What made everything tick, however, was a custom-built router that I would eventually release to NPM called Hot Router. It's called that, because it has an option that lets you hot-swap controller files while the site is live while the application is running. That was super useful for debugging the first few sites created with it, but the hot swapping has become less useful now that I've gotten better at using Docker.

All of the above is setup for one of the more amusing issues I encountered while working on Six Gaming's website, and there were plenty. Being only my second Docker project, I won't talk about what I can only describe as "newbie mistakes". However, the biggest thing I found was what I term the memory leak from hell.

I discovered it when I was working on the Hot Router project. The gist of the problem is that for weeks after the launch of six.gg, I had a very slow memory leak that would break down the server after about a week. It drove me insane that I couldn't find it. The lengths I went to in order to find the leak were insane. First, I wrote my own calls to the docker.sock API, logging the metrics to Application Insights. That alone instantly doubled the cost of the server while I had the metrics active. The price you pay.

This led me to learn the memory leak was happening in the node.js Docker container. In order to find the memory leak, I had to connect the node.js instance inside Docker to Google Chrome's dev tools. Once I did that, I spent hours pouring over memory logs, slowly narrowing the problem to my shiny new router. Did making the router a module cause the memory leak? Did I screw something up porting the code over from being inline in the project to its own module?

No, the memory leak was there all along. I tried comparing Date objects to see if they were different. While you can compare to see if they are greater than or less than each other, trying to compare that they are equal or not equal actually doesn't work. This was causing Hot Router to always treat the controllers as if they were just hot swapped. It would delete the cache of the controller and re-require it. As it turns out, the act of deleting the cache and re-requiring it caused the memory leak. That, combined with the date comparison bug, resulted in a slow memory leak.

As I was fixing that bug, it dawned on me. I run the Overload Game Tracker, and that site had been suffering from a memory leak for over a year. It runs an early version of the routing code that Hot Router uses. Turns out I solved a very old memory leak by finding the leak in an entirely different application.

Anyway, Six Gaming's website has been humming along for a while. It was a lot of effort for not a lot of reward. However, this project taught me a ton about Docker, MongoDB, and more. And everything I learned from this is going into my most ambitious project yet... my own website! More on that in a future post.

Comments

Add Your Comments

roncli.com Blog
This is my blog where I give my thoughts and opinions on various topics and share my creative endeavors with the world. I run two personal blogs, but combine them here for ease of access.

Blogger - My oldest blog using the Blogger platform contains posts full of opinions, gaming, and code.

Tumblr - Tumblr posts are all about my creative side, containing music, videos, writings, and updates on my web creations.

You can select a category below to view the latest post, or browse thorugh the posts using the navigation found at the top and bottom of each post.
Categories
Coding (165)
Life (137)
Gaming (115)
Music (64)
World of Warcraft (48)
roncli.com (41)
Software (36)
Servers (29)
Hurricane Rita (27)
Six Minutes To Release (27)
Screenshot (25)
Hurricane Ike (24)
Projects (24)
Silliness (21)
Trax in Space (21)
Cent (19)
Crystal Space (15)
OSMusic.Net (14)
Blog (13)
Editorials (13)
LibWowArmory (13)
Lyrics (13)
roncli Productions (12)
VB.NET (12)
Descent (10)
LibWowAPI (10)
Descent 3 (9)
Due Process (9)
Backup (8)
CTG Music (8)
Node (8)
Six Gaming Podcast (8)
ASP.Net (7)
Buffalo (7)
League of Legends (7)
NWS (7)
Rendr (7)
SETI@Home (7)
The Nightstalker (7)
Video (7)
Azure (6)
Diablo III (6)
Hard Drives (6)
Logs (6)
Windows (6)
BOINC (5)
Cent Credits (5)
Cent Main Theme (5)
D3DSN (5)
Descent: Underground (5)
FreeBSD (5)
Google Desktop (5)
Google Earth (5)
Outpost Music (5)
Ron's Bronze Plays (5)
Sports (5)
UPS (5)
Birthday (4)
Buffalo Sabres (4)
Constellation (4)
Everytime (4)
JavaScript (4)
Overload (4)
Overload Teams League (4)
Preview (4)
Pwned Print (4)
roncli's Dumbass Award (4)
San Antonio (4)
Sigh of Excitement (4)
Six Gaming (4)
Steam (4)
Stripped Down (4)
trac (4)
Visual Studio (4)
Winamp (4)
AJAX (3)
All In My Head (3)
Blackjack (3)
Chess (3)
Crypt of the NecroDancer (3)
D3TL (3)
DCL (3)
Gate (3)
Given Up (3)
Guitar (3)
Inspiration Edit (3)
jQuery Default Button (3)
MAME (3)
MediaTagConverter (3)
ModPlug (3)
NeonXSZ (3)
NetHack (3)
Numbers (3)
Paper (3)
PHP (3)
Rawr (3)
Sift (3)
SQL Server (3)
Tumblr (3)
Twitch (3)
Vision (3)
Year in Review (3)
AM Browser (2)
Asana (2)
ASP.Net RSS Toolkit (2)
Bicycle (2)
BlizzCon (2)
Cheevos FTW! (2)
Crazy Browser (2)
DMTB (2)
Docker (2)
Elbow (2)
Eternally (2)
Evans Blue (2)
Fire In My Heart (2)
Games (2)
GTR (2)
Houston Astros (2)
How To Play (2)
Hurricane Katrina (2)
iPhone (2)
IRC (2)
IsItUp (2)
Las Vegas (2)
Legs (2)
LibBeImba (2)
Minnesota Wild (2)
Miss Driller (2)
Module Sixteen (2)
Monitor Resolution (2)
NeKo (2)
New Zepsi Industries (2)
Niagara Falls (2)
Novus Compo (2)
Pittsburgh Penguins (2)
Poker (2)
Pwned Cars (2)
Reinstall (2)
Remake (2)
Retro (2)
roncli Productions Intro (2)
San Francisco (2)
San Francisco Rush 2049 (2)
slammy (2)
Sleep (2)
Solar (2)
SoundCloud (2)
Stress (2)
Strings (2)
Tempurpedic (2)
The Editor (2)
The Observatory (2)
TNS Raw (2)
TopCoder (2)
Troupe (2)
w.bloggar (2)
Wedding (2)
XAML (2)
You (2)
Zepsi (2)
#modarchive Story 2 (1)
#occupygregstreet (1)
Absolute C++ (1)
Achaea (1)
Acronyms (1)
AdAware SW (1)
Adobe Acrobat (1)
AdventureQuest (1)
Alaska (1)
allen one (1)
AMD Settings (1)
Analyze (1)
APIs (1)
app.config (1)
Art (1)
ASSP (1)
Audiosurf (1)
Aveyond (1)
Awakening (1)
Bellaire (1)
BitTorrent (1)
Black Ox II (1)
Blackberry (1)
Blender (1)
Blogger (1)
BOINC Synergy (1)
BoincView (1)
Boom Bitches! (1)
Browserify (1)
Bullseye (1)
Byline (1)
CAD-KAS PDF Reader 2.4 (1)
CAPTCHA (1)
CDBurnerXP Pro (1)
CherryOS (1)
ChessCli (1)
Chick-Fil-A (1)
Child Controls (1)
clones (1)
ColdFusion (1)
Come Back To Me (1)
Compo (1)
Constellation Main Theme (1)
Cooking Lili (1)
Core Decision (1)
Crystal (1)
Databinding (1)
DataGrid (1)
DataGridView (1)
Deadly Drums (1)
Decade (1)
Dell (1)
Demogorgon (1)
Descent Champions Ladder (1)
Descent Rangers (1)
Diabetes (1)
Diamond Problem (1)
Doge2048 (1)
Doom's Day (1)
Double Buffer (1)
Dr. Jeffrey Masters (1)
Drama (1)
Dreamweaver (1)
Dudley's Dungeon (1)
Einstein@Home (1)
Ellon in the Dark (1)
EveryDNS (1)
Evolution (1)
Eyes (1)
Fedora Core 6 (1)
FeedPage (1)
Fiddler (1)
FlowDocument (1)
Foobar 2000 (1)
Foxit Reader (1)
Galveston (1)
Geocore (1)
GitHub (1)
GMail (1)
Google Calendar (1)
Google Chrome (1)
Google Pages (1)
Google Wave (1)
Grid (1)
grl (1)
Grooveshark (1)
Grunt (1)
GTR2 (1)
Guitar Solo (1)
Hackers (1)
HCC (1)
Hearthstone (1)
Heroes of the Storm (1)
HomesickAlien (1)
Houston Aeros (1)
ICallbackEventHandler (1)
If Paige Wins (1)
IIS (1)
Inno (1)
Internet Explorer (1)
Interview (1)
iPad (1)
Iron Chouquette (1)
Irrlicht (1)
Jaded (1)
jQuery UI (1)
jQuery UI Scroll Menu (1)
JW Player (1)
Kado Kado (1)
Kaspersky (1)
KFOS Inner Space Radio (1)
Know What (1)
Kromaia (1)
Let It Ride (1)
Let's Encrypt (1)
Let's Play (1)
LibWowHeroes (1)
LifeCast (1)
LINQ to Entities (1)
Linux (1)
Liquid Wars (1)
ListView (1)
Loading (1)
Lukan Schwigtenberg (1)
Mac (1)
MadTracker (1)
Melbourne (1)
Melt (1)
Message From Beyond (1)
Micro Center (1)
Mistakes (1)
Monitor (1)
Mouse (1)
Mr. Driller (1)
MSDN (1)
NASCAR SimRacing (1)
Network (1)
New Year (1)
olmod (1)
On Fire Series (1)
Opalus Factory (1)
Open Labs (1)
Open Source (1)
Operation Payback (1)
Overwatch (1)
PearPC (1)
Phony (1)
Piano (1)
Pingle (1)
pogo.com (1)
PowerStrip (1)
Programming (1)
PSP (1)
PXO (1)
Quadra (1)
Radeon (1)
Radio Shack (1)
Rant (1)
RedHeat (1)
Reject (1)
Release (1)
Religion (1)
Rendr Template (1)
Renegade (1)
Retrovirus (1)
RIP (1)
RockMelt (1)
Scott Hanselman (1)
Self-Destruct Sequence Podcast (1)
Showsan (1)
Silverlight (1)
Sitemap Generator (1)
Smoke (1)
Sol Contingency (1)
Sound Blaster Audigy (1)
Speedrun (1)
Spelling (1)
SQL Reporting Services (1)
SSL Certificates (1)
Stanley Jakubowitz (1)
Starbase Arcade (1)
Starcraft II (1)
Starting All Over (1)
Story (1)
Sublevel Zero (1)
Swiss (1)
Thanksgiving (1)
The Crossroads (1)
The Time Now (1)
The Wight to Remain (1)
Time and Date (1)
Toronto (1)
Torrent Keeper (1)
Total Bollocks (1)
Trans-Siberian Orchestra (1)
TraxSurf (1)
Trillian (1)
Typing (1)
Ultimate Boot CD (1)
UpdatePanel (1)
US Interactive (1)
Video Bob (1)
ViewState (1)
Vince Young (1)
Vincent Lau (1)
Vocals (1)
Voyage (1)
Walter Savitch (1)
Warlords of Draenor (1)
Weather (1)
Westward (1)
What Do I Know (1)
WikiLeaks (1)
Windows Defender (1)
winLAME (1)
Winter Classic (1)
Word Field (1)
World Record (1)
Worst Things in the World (1)
WPF (1)
Xamarian (1)
XBox (1)
XM Radio (1)
XML Web Services (1)
Yahoo! Pipes (1)
Yes (1)
You Are Not Alone (1)
Share This Page
Join roncli on Discord!
Join the roncli Gaming Discord server for discussion about gaming, development, and more!
roncli.com Media Player