Hey guys, I’m here with a simple question about networking (no I’m not going to ask how to get it working haha) Basically my question is about handling a ton of people on a server at once (think MMO) and have the server running efficiently with no data loss.
Here’s the way I see a MMO work in a perfect world (well not even an MMO, just thin a MO, not massive)
Client -> Server -> Database -> Server -> Client
The problem with that is going to be (i would imagine) too much of a load on the server to run database queries that often. Maybe a more logical solution would be something along the lines of
Client -> Server -> Client
Storing temporary data in the server application and every minute or so run a query to inject the data into a database. The problems with that approach will be if the server goes down you’ll lose everyone’s last minute or so of activity seeing as the server is set of a specific inject timer.
Which brings me to my final approach, same as the last one it would be a simple
Client -> Server -> Client
Except the server’s storing a client inject timer; so at a specific time (different for each client) it’ll inject tiny bits of data into the database (taking a server load off injecting massive amounts of data at once). Also the benefits of that would be the ability to force a client inject upon logoff, so there would be minimal room for dataloss.
So my question now is, am I correct with my hypothesis for these approaches?
Which is more CPU intensive for a server if we’re, say, injecting 1 meg of data into a database:
1 Query injecting 1 Megabyte of information into a database,
or 100 Queries each injecting 10kb into a database?
Thanks for your time I’d also appreciate an explanation to your answers, so don’t just say “this method is better”. Rather, say “this method is better, BECAUSE”. I don’t want to be told what is what, I want to be told why. I’m here to learn
Look forward to hearing some responses!