Improbable Icon

We need more resources on scaling SpatialOS

scale

#1

@callumb provided some really good insight last year about scaling SpatialOS but I haven’t seen or found much more information since then.

https://forums.improbable.io/t/crowd-sim-in-spatialos-how-to-scale-a-deployment/2547/3?source_topic_id=3555

Currently, I’m facing a lot of challenges scaling my world from a few thousand entities spread over 20-30 square miles to 100’s of thousands of entities spread over 200-300 square miles. Information about best practices, troubleshooting, configuration samples, github examples and design patterns would go a long way. SpatialOS is all about scale after all!

Note: If there are resources, feel free to let me know :slight_smile:


#3

Hi @cbdileo, thanks for the feedback. This is definitely something that we know is needed. I’ve passed on your feedback to the team in charge of this and we’ll let you know when we have something. In the meantime, it’s harder for us to answer broad questions, but if you have specific inquiries then let us know.


#4

My biggest issue is being able to start large worlds from a snapshot but I listed a number of topics I would need help with as well. I could create separate question in the forums if you think that would help.

Btw, I would use Heroku’s Docs for reference: https://devcenter.heroku.com/categories/reference. I’ve found them to be a good resource in the past for scaling web applications.

Scaling Topics

World Startup Performance both with large snapshots and entities that create other entities.

Expectations for cloud deployment template sizes. How big of a world with how many entities can small, medium and large handle. What aspects factor into this (physics, messaging, etc) and how do you troubleshoot issues with the tools available.

Help determining the number of workers to I should be using based on template size and estimated entities and world size. How do I determine if I have too man or too few using the tools available?

Help determining if my approach to world tiling is possible with SpatialOS. I would need to explain this further but Community Garden is simulating a city that is broken apart into chunks. This means as I expand the world the entitiy count grows quite fast.


#5

Hi @cbdileo,

Unfortunately it’s quite difficult for us to give a cover-all answer to the question of scaling. A lot of it depends on various factors of each game, and a lot is changing every month on our side as our tech changes. So I can’t really provide you an answer on how many entities you should expect to be able to support on various template sizes, it’s something you’ll have to test for yourself and optimize within your game.

For now, probably the biggest thing you can do is optimize your UnityWorkers. This is a nice presentation that touches on some of those topics, particularly around the 29 minute mark. Start by just running a single UnityWorker in your editor (with a launch config that doesn’t by default launch any managed workers), and use the Unity Profiler to work out where the most computation time is being spent.

For questions about how many workers you should be using, again the only thing I can say is you’ll have to test on your own. Factors such as entity density, how much entities move, and how evenly spread they are will all influence things. Beyond that, there isn’t much more I can add on this subject from what Callum already mentioned in the forum post you linked in your first post.

When it comes to optimizing various things for the Spatial bridge, we’ll hopefully be coming out with some more tools soon to profile this. But for now, things to think about are if you are ever sending more component updates than you need to (like is anything spamming component updates when they really don’t need to be so frequent), and check your usage of commands/queries which are fine to use in moderation but if frequent operations are constantly making use of them, you might be slowing things down on the bridge.