Comments

Hello everybody, my name is CCP Prism X and I am a Libra!

This summer we saw a welcome influx of players with the release of EVE Online: Odyssey. On occasions as such we usually celebrate our great success by pulling out the champagne and our $1000 Japanese pants, and having ourselves a great big pillow fight. However, this time around the influx of people was so dramatic that it worried us; Empire Space was burning. There were so many people in New Eden, doing so many things, that the actual CPU cores (reffered to as "nodes" hereafter) running the Empire Space systems were under extreme load. This was causing Time Dilation to affect the various, and disparate, portions of Empire Space. Time Dilation is all well and good when you‘re blobbing with your space-friends in Nullsec. But when you‘re just running a mission in some dead-end system, all alone in local, and suddenly everything starts going all bullet-time on you: you get frustrated.

Empire Space should really have such predictable load that Time Dilation should never kick in there. If it happens, our Static Cluster Premapper should at least be able to avoid a reoccurence. That is because we track an estimated load fingerprint of all solar systems and assign systems to different nodes, based on said estimated load, during startup. As long as that estimate is correct-ish and the premapper is functioning as it should, things should run fairly smoothly. But the same systems were consistently starting up on nodes with too many other systems assigned to them. Things were not running very smoothly at all and we weren‘t quite sure why.

† Assuming that no social engineering takes place that diverts load to new, unexpected, places.
Example: Announcing an upcoming LP offer from a corporation that only has a single good agent in high-security space will result in a lot of new load in that agents system which the premapper cannot in any way anticipate.

Step 1: Identify the problem

Above I omitted a fairly important fact about this premapping of solar systems: systems within the same constellation want to stay on the same node. They want it so bad that they‘ll do so at the expense of balanced load distribution as they‘ll ignore the, load wise, most optimal node assignment if their preferred node is only 20% more loaded than the optimal one. This behavior causes a huge deviation between the load of different nodes whereas we‘d rather want the premapper to spread the load as evenly as possible over all the nodes available to it. Furthermore this behavior doesn‘t extend above the constellation level so effectively a node can run two whole constellations, but one is located in the Deep North and the other in the Deep South. So a fleet fight in the Deep  South could enforce Time Dilation on the other constellation located in the Deep North. That‘s frustrating for the Deep North pilots!

Here is visualization of the clustering of systems to nodes in the old systems (Note, this is 3D data badly projected on a 2D plane so there‘s some skew). Systems of the same colour reside on the same nodes. You‘ll quickly notice that this is just a jumble of colours with little consistency. I‘ve drawn red circles around two clusters which all belong to the same node to show the distance between the two:

 

And to top it off this isn‘t even a good load distribution. The difference between node load is fairly staggering as you can see on the standard deviation values here:

But why were  we clustering systems on the constellation level? Because a long time ago it was theorized that inter-node stargate jumps were more expensive than intra-node jumps. Presumably, that is due to the assumed overhead introduced by network latency. Now we know that this assumption is completely wrong and inter-node jumps are actually cheaper than their counterpart. A stargate jump requires the removal of the player from one system, and his introduction into another one. Splitting that work between two nodes spreads load better than doing it all on the same node.

Realizing this, we just decided to remove any such node affinity behavior from the premapping logic as a first step. Systems would just be assigned to nodes on the basis of the most loaded, unassigned, system being assigned to the least loaded node. That resulted in an amazingly well balanced cluster and the load problem was solved! But even though we‘d made a very balanced cluster the Time Dilation problem was now even more pronounced. Systems had just been semi-randomly assigned to nodes with no respect to locality and so we still had people in the Deep North affected by fleet fights in the Deep South. Revert the changes and put the thinking cap back on!

Step 2: Solve the problem

So we needed a way to split load between nodes whilst ensuring that all systems on a node belong to the same space-neighborhood. As a secondary concern we really did not want to increase the time premapping took, and we used the opportunity to completely nuke the old T-SQL code and recreate it as a Python module. That last decision, unsurprisingly, turned out to be the most important one as a procedural language with a large supporting ecosystem of available tools is much better geared to solve a procedural problem than a highly limited relational language.

With Python at our side we initially arrived at a fairly simple and approachable solution. As we‘re attempting to split up a cluster of stars with defined coordinates so that both halves are adjacent and equally weighted; why don‘t we just do that? If you split any coordinate system in half with a plane, both halves will be adjacent to each other and that solves the problem of proximity. That leaves us with a way of ensuring that both halves are close to equal in their load. As we keep track of each systems load this just becomes a matter of tweaking the split line iteratively in some sensible manner. That‘s not more complex than using the properties of Binary Search! We just have to move the split line a given distance towards the more heavy of the two halves, and then half the distance we‘ll move it on the next iteration. Theoretically we should bounce between both sides of the optimal split line for a while until we hit it. I say theoretically because we‘re not trying to find the optimal solution here, only a good enough solution in the least amount of time.

Here is a graph to help you visualize this process. Imagine the circle stands for the entire cluster of stars we want to split up. The stars themselves are not shown because they're not important, all that matters is that the split will not mix stars from the two distinct halves between them and that the load is as equal as possible.

Once we’re done splitting the initial universe into two clusters, we’ll pick the heavier of those two and split it again. Then we’ll pick the heaviest of those three and split it again and repeat the process on the four resulting clusters of stars. We’ll repeat this until we have as many clusters as we have nodes at which point we commit the mapping to the database and continue on with startup.

To visualize this properly I’ve provided some visualization, using this method, run against the same dataset as the graph above. However, the first three steps are the split of Empire Space only due to the inner workings of the new method and only serve to describe the method better. The last picture is the final allocation of the entire universe (on the same data) and can thus be compared to the similar graph above.

Initial Empire Space step:

 

First Empire Space split. Note the size difference of the two halves due to the fact that not all systems are equally loaded:

 

Seventh Empire Space split (that grey blob is two hues of gray):

 

End result of entire universe. Note how much more uniform the color distribution is:

Step 3: Actually Solve the Problem

That’s how we initially pushed out the new cluster premapper a few weeks before Rubicon was released. We did so understanding what the more Computer Sciency types out there might already have realized from the above; this results in a balanced load spread if, and only if, the number of nodes available for allocation are a whole power of two. Anything else will result in a fairly unbalanced load spread as we’re always splitting load into two halves, creating a sort of a Binary Tree. For a perfectly equal split we must have enough nodes to fill the leaf level of that imaginary tree or we’ll have nodes on level leaf-1 with double the amount of load on the nodes on the leaf level.

Here is a very simple picture displaying the whole power of two issue with 3 nodes as opposed to 2^2=4 nodes. Please keep in mind that this is a perfect world example. We do not actually expect all load splits to be perfectly equal.

This resulted in a too uneven of a split. The statistics below do look better for Nullsec but in Empire we’re still looking at a fairly large standard deviation between nodes. But at least the CPU Minimum isn’t zero here. Sadly the memory stats just got plain worse, but we’re really balancing primarily for CPU.

Obviously the optimal split here is 33% of the load allocated to each node but you can see how the nice and simple algorithm outlined above completely fails here. But since we know this works optimally if we divide the load by a number of nodes that is a whole level of two we just need to force that behavior! We could of course constrain ourselves to always have a whole power of two number of nodes for solar systems but that feels like a rather silly artificial constraint. Especially if you know that any number in base 10 (decimal number system) can be represented in base 2 (binary number system), then this just becomes a matter of rearranging the binary tree above into branches of whole number of two nodes and running the algorithm detailed above on those branches.

Using a bit more complex example than the three nodes above, we can visualize this in action as thus:

This is easy enough to achieve with minimal alterations to the code used in the initial solution. That solution already relies on a method of splitting coordinate systems in two equally loaded parts. Altering it to split it into two X/Y parts is no big deal.

Using this new approach on the exact same dataset as the examples above we end up with this pretty picture of a balanced universe within which space-friends shoot other space-friends in their respective faces:

 

And now the CPU standard deviation has dropped drastically! We're hoping to have this code out by tomorrow Wednesday, December 4th.

Step 4: Write a Dev Blog

Then do it again. This is the second version of this Dev Blog. I’m pretty sure nobody would have enjoyed reading the first one. Sadly I couldn’t reuse a lot of stuff from that first attempt, like I could with the code. It simply had too many mentions of water carriers, aqueducts and Beyonce Knowles. Probably wouldn’t have made a lot of sense to anybody!

So there you have it; our recipe for a Balanced Universe. Perhaps you can find some way of applying it to your own lives! I’m thinking those fancy colored dot charts could probably substitute for a Rorschach test. But in case you just read through my entire blog and do not feel like you’ve gained much from it I’d like to present you with this cool island song as a peace offering (Don’t browse at work kids!).

That’s it folks! If you’ve got some further questions I’ll be looking at the comment thread regularly.

503 Comments

  1. I have been absent for some time, but now I remember why I used to love this website. Thank you, I will try and check back more frequently. How frequently you update your website?

    November 28, 2018 at 19:34 Reply
  2. Thanks for another magnificent article. Where else could anybody get that kind of info in such a perfect approach of writing? I’ve a presentation subsequent week, and I am on the search for such info.

    November 28, 2018 at 19:37 Reply
  3. Outstanding post but I was wondering if you could write a litte more on this subject?
    I’d be very thankful if you could elaborate a little bit more.
    Kudos!

    December 4, 2018 at 11:24 Reply
  4. It’s fantastic that you are getting ideas from this article as
    well as from our argument made at this time.

    December 4, 2018 at 23:47 Reply
  5. I simply needed to say thanks again. I do not know the things I would’ve accomplished in the absence of the smart ideas revealed by you concerning such area. This was the fearsome dilemma in my view, however , encountering the very specialized way you processed it forced me to jump over delight. I am just grateful for the help and even sincerely hope you are aware of a great job that you are carrying out training many others with the aid of a blog. Most probably you have never got to know any of us.

    December 5, 2018 at 01:15 Reply
  6. I do consider all the concepts you’ve presented for your post. They are very convincing and can certainly work. Nonetheless, the posts are very quick for newbies. Could you please prolong them a little from subsequent time? Thanks for the post.

    December 5, 2018 at 01:16 Reply
  7. Fantastic web site. A lot of useful information here. I¡¦m sending it to several buddies ans additionally sharing in delicious. And of course, thank you to your sweat!

    December 5, 2018 at 01:31 Reply
  8. Hello, i think that i saw you visited my web site so i came to “return the favor”.I’m trying to find things to improve my website!I suppose its ok to use a few of your ideas!!

    December 5, 2018 at 01:46 Reply
  9. I am extremely impressed with your writing skills as well as with the layout on your blog.

    Is this a paid theme or did you customize it yourself?

    Anyway keep up the excellent quality writing, it’s rare to see
    a great blog like this one today.

    December 5, 2018 at 18:57 Reply
  10. I just could not depart your web site before suggesting that I really loved the standard information a person supply in your guests? Is going to be again steadily to investigate cross-check new posts

    December 5, 2018 at 21:36 Reply
  11. Good blog! I truly love how it is simple on my eyes and the data are well written. I am wondering how I could be notified whenever a new post has been made. I have subscribed to your feed which must do the trick! Have a great day!

    December 5, 2018 at 21:50 Reply
  12. As I website possessor I believe the content material here is rattling wonderful , appreciate it for your hard work. You should keep it up forever! Good Luck.

    December 5, 2018 at 21:53 Reply
  13. Great post. I was checking constantly this blog and I am impressed! Very helpful information particularly the last part 🙂 I care for such information a lot. I was seeking this certain info for a long time. Thank you and good luck.

    December 5, 2018 at 22:04 Reply
  14. Wow, marvelous blog layout! How long have you been blogging for? you made blogging look easy. The overall look of your site is fantastic, let alone the content!

    December 5, 2018 at 22:14 Reply
  15. Investor researches stocks, bonds, etc.

    December 6, 2018 at 04:53 Reply
  16. You completed a few fine points there. I did a search on the issue and found mainly people will go along with with your blog.

    December 8, 2018 at 18:42 Reply
  17. Its like you read my mind! You seem to know a lot about this, like you wrote the book in it or something. I think that you can do with a few pics to drive the message home a bit, but other than that, this is wonderful blog. A fantastic read. I’ll definitely be back.

    December 8, 2018 at 18:43 Reply
  18. Hello There. I found your blog using msn. This is an extremely well written article. I’ll be sure to bookmark it and come back to read more of your useful info. Thanks for the post. I will definitely return.

    December 8, 2018 at 18:46 Reply
  19. Wow! This can be one particular of the most useful blogs We’ve ever arrive across on this subject. Actually Fantastic. I’m also an expert in this topic so I can understand your hard work.

    December 8, 2018 at 18:48 Reply
  20. I was suggested this web site by my cousin. I’m not sure whether this post is written by him as nobody else know such detailed about my trouble. You’re incredible! Thanks!

    December 8, 2018 at 19:03 Reply
  21. Hello. impressive job. I did not anticipate this. This is a excellent story. Thanks!

    December 10, 2018 at 22:12 Reply
  22. My husband and i ended up being absolutely thankful when Edward managed to carry out his researching through the precious recommendations he acquired using your web page. It’s not at all simplistic to simply always be freely giving things which often most people have been making money from. And we also recognize we need you to appreciate for that. The type of explanations you have made, the easy blog menu, the friendships you will help promote – it is everything powerful, and it is aiding our son in addition to our family reckon that that situation is enjoyable, and that is really fundamental. Many thanks for all the pieces!

    December 12, 2018 at 03:48 Reply
  23. As a Newbie, I am constantly searching online for articles that can benefit me. Thank you

    December 12, 2018 at 19:29 Reply
  24. I think other website proprietors should take this website as an model, very clean and great user genial style and design, let alone the content. You are an expert in this topic!

    December 12, 2018 at 19:41 Reply
  25. My wife and i were so joyful when Chris managed to do his web research because of the precious recommendations he obtained using your web pages. It’s not at all simplistic just to be freely giving points which often other folks could have been trying to sell. We already know we need the writer to appreciate for that. The specific explanations you made, the straightforward website menu, the relationships your site make it possible to promote – it’s most sensational, and it’s really facilitating our son and our family consider that this issue is awesome, which is seriously fundamental. Many thanks for all!

    December 12, 2018 at 19:45 Reply
  26. A lot of thanks for your own effort on this blog. My mom delights in working on research and it’s easy to understand why. We know all about the powerful manner you render great tips through your web blog and therefore welcome response from other ones on the issue so our child has been becoming educated a lot. Have fun with the rest of the year. Your doing a fantastic job.

    December 13, 2018 at 03:45 Reply

Leave a Reply