• Announcements

    • khawk

      Download the Game Design and Indie Game Marketing Freebook   07/19/17

      GameDev.net and CRC Press have teamed up to bring a free ebook of content curated from top titles published by CRC Press. The freebook, Practices of Game Design & Indie Game Marketing, includes chapters from The Art of Game Design: A Book of Lenses, A Practical Guide to Indie Game Marketing, and An Architectural Approach to Level Design. The GameDev.net FreeBook is relevant to game designers, developers, and those interested in learning more about the challenges in game development. We know game development can be a tough discipline and business, so we picked several chapters from CRC Press titles that we thought would be of interest to you, the GameDev.net audience, in your journey to design, develop, and market your next game. The free ebook is available through CRC Press by clicking here. The Curated Books The Art of Game Design: A Book of Lenses, Second Edition, by Jesse Schell Presents 100+ sets of questions, or different lenses, for viewing a game’s design, encompassing diverse fields such as psychology, architecture, music, film, software engineering, theme park design, mathematics, anthropology, and more. Written by one of the world's top game designers, this book describes the deepest and most fundamental principles of game design, demonstrating how tactics used in board, card, and athletic games also work in video games. It provides practical instruction on creating world-class games that will be played again and again. View it here. A Practical Guide to Indie Game Marketing, by Joel Dreskin Marketing is an essential but too frequently overlooked or minimized component of the release plan for indie games. A Practical Guide to Indie Game Marketing provides you with the tools needed to build visibility and sell your indie games. With special focus on those developers with small budgets and limited staff and resources, this book is packed with tangible recommendations and techniques that you can put to use immediately. As a seasoned professional of the indie game arena, author Joel Dreskin gives you insight into practical, real-world experiences of marketing numerous successful games and also provides stories of the failures. View it here. An Architectural Approach to Level Design This is one of the first books to integrate architectural and spatial design theory with the field of level design. The book presents architectural techniques and theories for level designers to use in their own work. It connects architecture and level design in different ways that address the practical elements of how designers construct space and the experiential elements of how and why humans interact with this space. Throughout the text, readers learn skills for spatial layout, evoking emotion through gamespaces, and creating better levels through architectural theory. View it here. Learn more and download the ebook by clicking here. Did you know? GameDev.net and CRC Press also recently teamed up to bring GDNet+ Members up to a 20% discount on all CRC Press books. Learn more about this and other benefits here.
  • entries
    625
  • comments
    1446
  • views
    1006513

Software at Scale: Practice Like You Play

Sign in to follow this  
Followers 0
ApochPiQ

2614 views

I recently learned an interesting lesson in developing software that needs to scale to large capacities.

I can't get into the specifics of what I was working on, but the essential facts are more or less as follows:

  • It includes a cache algorithm
  • I tested it with as much load as my workstation could generate
  • In tests, it performed well as far as I could stretch it
  • We deployed this system and it started falling over in difficult-to-understand ways


    The frustrating thing about this process was that I followed good testing practices to the letter - or so I thought. Make sure you have good coverage, test for edge cases, think about how real use patterns will affect behavior of the system, and so on. I even set up my tests to deliberately try and thrash the cache, hoping that it would reveal any weaknesses in that algorithm.

    I plotted some data from the pre-launch test runs to see how it scaled. It looked pretty much linear, and so I figured it would work fine under heavier loads, because the coefficients were small enough that linear would be well under hardware capacity even at full demand. Testing showed no flaws at small scale, and I extrapolated from the test numbers that it would scale perfectly well to the load demanded of it.

    Except it didn't.


    The crucial lesson here is simple: when you are designing a system that must scale to high capacity, never extrapolate your test data.

    My mistake was in assuming that the linear-looking behavior would stay linear as the cache size grew and the number of active clients increased by a couple orders of magnitude; in reality, that innocuous linear-looking curve turned out to be substantially sub-linear. The actual big-O analysis of the algorithm is too intricate and boring to go into, but suffice it to say that the behavior as the cache filled degraded very quickly.

    The system then fell into a state where it would take longer to satisfy requests than it took for clients to generate new requests, meaning that the backlog of load snowballed until the whole thing just ground to a halt and barely served any requests at all.

    We discovered that, paradoxically, flushing the cache would result in better performance almost immediately once this happened; it only took a few seconds of profiling data collected via XPerf on a test machine to figure out why.


    I rewrote the cache algorithm to eliminate several of the algorithmic complexity issues (and several practical problems that Big-O alone never would have revealed) and now throughput has jumped substantially. At this point, it takes longer to send the response of a request over the network than it does to compute that response to begin with - precisely the kind of scaling behavior we wanted originally.


    TL;DR: practice like you play. If you don't test at scale, you are not ready to deploy at scale. Extrapolations from small-scale tests will be misleading, and can give you a false sense of confidence. If you can't test at scale, analyze things rigorously and relentlessly to make sure you don't have hidden sub-linear factors in your system.

4
Sign in to follow this  
Followers 0


3 Comments


This is actually where one of the practices of Eve Online comes in. They wrote a series of "bots" that they can plug into the game to run tests. For instance if they want to have a drake fight between 1500 players (Happens frequently enough already, but this is for testing) then they can setup the bots to login with a drake and start targeting and shooting each other with missiles. The goal is to, of course, test optimizations to their various algorithms (missiles have been adding lag for a long time now since each one actually flies and hits the target server side).

The system they have is more complex than that, since they can introduce artificial lag and similar instability to test how the optimizations will affect it when the players have a ping of 300ms or more.

In the day to day software development I currently do I have a test setup that includes a number of servers that run hypervisors. I can then spawn virtual machines on those hypervisors using my testing client. I can thus test not just on various operating systems, but under different load conditions as well. That combined with the networking gear available to me allows me to setup realistic scenarios for clients and client applications based on the expected load requirements.

Two of my testing rigs:

[img]http://img830.imageshack.us/img830/5062/taskmgr.png[/img][img]http://img137.imageshack.us/img137/8653/shitzngiggles.png[/img]
0

Share this comment


Link to comment
Yep, bot testing is a great tool, and I'm a big fan of it. In fact, my own tests from this story included (admittedly very simple) automated load-generating "bots" if you will.

The problem isn't lacking automated tests; the problem is assuming that your test of N bots will correlate in a predictable way to the performance of N*100 or N*1000 clients. You can easily get scaling curves that look awfully linear up to N, and then once you hit N*100 turn out to be exponential or something equally horrid.
0

Share this comment


Link to comment
well, hence the example :P which is that testing is useless unless you're providing realistic loads.
0

Share this comment


Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now