Iterating over hundreds of users for time based events?

Post here your questions about SFS2X. Here we discuss all server-side matters. For client API questions see the dedicated forums.

Moderators: Lapo, Bax

jonas
Posts: 5
Joined: 27 Oct 2010, 10:59

Iterating over hundreds of users for time based events?

Postby jonas » 14 Jun 2011, 12:39

Hi there,

I try to explain my problem very briefly. We'll try to make a browser/flash based real time mmorpg.

My extension holds various information about the game state, world, entities (players, npcs) and so on.
Because it's not round based and action-heavy, there are many many things happening like buffs expiring, spells get finished casting, npc events are triggered and so on.

At the moment (we're testing with like ~5-10 real players) there are like three scheduled tasks like in the example (http://docs2x.smartfoxserver.com/Advanc ... extensions) which are acting like server "ticks" with an interval ~1 to 10ms, they do exactly what we need (iterating over ALL registered entities on the server and checking for buffs expiring, if a casts are finished etc.).

With 10 Players, this just works. But i have a bad feeling about the performance if we're getting more and more players (hopefully). Are there other concepts to manage this massive amount of time based events?

Any help and tipps would be so appreciated.

Thanks,
jonas
User avatar
Bax
Site Admin
Posts: 4609
Joined: 29 Mar 2005, 09:50
Location: Italy
Contact:

Postby Bax » 15 Jun 2011, 09:35

I don't see other ways to achieve this. We strongly suggest you to load test your game to see it this can work. If not, you will probably need to fine tune the intervals.
Paolo Bax
The SmartFoxServer Team
jonas
Posts: 5
Joined: 27 Oct 2010, 10:59

Postby jonas » 15 Jun 2011, 10:14

I already expected this answer so at least we didn't do anything wrong.

We thought about making not only one queue per job, but like multiple for the specific jobs. Maybe concurrency will soothe our minds ;)

Thank you anyway for your answer.
tchen
Posts: 191
Joined: 11 Dec 2010, 14:14

Postby tchen » 19 Jun 2011, 10:56

Also consider sorted queues based on action-events if your design permits. That is, buff-start and buff-end would be queued events which you probably know ahead of time and can put into the event queue. Doing this, you can avoid walking the list.

Return to “SFS2X Questions”

Who is online

Users browsing this forum: Google [Bot] and 43 guests