SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Plugin Development

Reply
 
Thread Tools Display Modes
Old 12/02/2017, 11:26 AM   #11
ExTaZZ69
Big Clucker
 
ExTaZZ69's Avatar
 
Join Date: Mar 2015
Location: Romania
Posts: 129
Reputation: 17
Default Re: Redis (cache, database and message queue)

Quote:
Originally Posted by isti37 View Post
I have a friend working on a server and he aims for 1000 players and today I came back on this forum and got a nice suprise.

If we can make this client work with under 3ms 100% latency as in the benchmarks https://redis.io/topics/benchmarks one could theoretically split up a gamemode into multiple servers and sync the callbacks/data through redis to create a multithreaded and highly available system. Basically, you could round robin 4 servers on 4 different ips on different servers and sync all data through redis. If a server crashes the client just reconnects to another server in round robin because there is no state stored in the server.

Even if a single server is capable of only 1000 players, you could just sync in players from other servers with redis and do everything from chat to quests with redis messaging.
How can you stream the players from a server to another one? I know you can sync a lot of stuff, but the visual gameplay, (like players/cars) can't be synced, right?
ExTaZZ69 is offline   Reply With Quote
Old 12/02/2017, 05:11 PM   #12
[HLF]Southclaw
High-roller
 
[HLF]Southclaw's Avatar
 
Join Date: Apr 2009
Location: England
Posts: 4,645
Reputation: 1231
Default Re: Redis (cache, database and message queue)

Quote:
Originally Posted by isti37 View Post
I have a friend working on a server and he aims for 1000 players and today I came back on this forum and got a nice suprise.

If we can make this client work with under 3ms 100% latency as in the benchmarks https://redis.io/topics/benchmarks one could theoretically split up a gamemode into multiple servers and sync the callbacks/data through redis to create a multithreaded and highly available system. Basically, you could round robin 4 servers on 4 different ips on different servers and sync all data through redis. If a server crashes the client just reconnects to another server in round robin because there is no state stored in the server.

Even if a single server is capable of only 1000 players, you could just sync in players from other servers with redis and do everything from chat to quests with redis messaging. Splitting the map to different servers to offload processing and maintaining one master to sync only the data from slaves would also be nice.
That's partly a motivation for this plugin and also something I'll cover in that upcoming post I mentioned to Pottus about cluster servers. It's certainly possible and very attainable with this plugin. The next few commits will likely be speed tests in the test script because I haven't actually checked. Redis (and Hiredis) are well known for speed due to them being written (well) in C. I can imagine the largest bottleneck being Pawn but even that's not as slow as most people seem to think. Being asynchronous, there's not much to worry about really!

I'm aiming to get my Scavenge and Survive project completely IO free with this plugin and let another app handle all the state tracking. I actually thought of opening up a database access API so multiple SS servers can share the same player data much like the original DayZ mod did. I doubt many people would be interested in that little experiment though.
__________________
PSA: I changed my username everywhere to "Southclaws" (including GitHub!)

Contact me:
My discord: dc.southcla.ws

Scavenge and Survive 2017 is coming soonish...
[HLF]Southclaw is offline   Reply With Quote
Old 13/02/2017, 01:38 PM   #13
Crystallize
High-roller
 
Join Date: Aug 2013
Posts: 1,378
Reputation: 267
Default Re: Redis (cache, database and message queue)

Quote:
Originally Posted by isti37 View Post
I have a friend working on a server and he aims for 1000 players and today I came back on this forum and got a nice suprise.

If we can make this client work with under 3ms 100% latency as in the benchmarks https://redis.io/topics/benchmarks one could theoretically split up a gamemode into multiple servers and sync the callbacks/data through redis to create a multithreaded and highly available system. Basically, you could round robin 4 servers on 4 different ips on different servers and sync all data through redis. If a server crashes the client just reconnects to another server in round robin because there is no state stored in the server.

Even if a single server is capable of only 1000 players, you could just sync in players from other servers with redis and do everything from chat to quests with redis messaging. Splitting the map to different servers to offload processing and maintaining one master to sync only the data from slaves would also be nice.
Im pretty sure you cannot sync players from one server to another one.
__________________
Quote:
Originally Posted by Meller View Post
I thought you were supposed to work at the job?
Crystallize is offline   Reply With Quote
Old 13/02/2017, 05:50 PM   #14
[HLF]Southclaw
High-roller
 
[HLF]Southclaw's Avatar
 
Join Date: Apr 2009
Location: England
Posts: 4,645
Reputation: 1231
Default Re: Redis (cache, database and message queue)

Quote:
Originally Posted by Crystallize View Post
Im pretty sure you cannot sync players from one server to another one.
> "If a server crashes the client just reconnects to another server"

He's not talking about synchronising UDP data, he's talking about an MMO-style cluster architecture where multiple backends serve a single public IP and they all share the same data and events. It's entirely possible, each server would effectively be analogous to a virtual world on a regular server and to switch a player's "world" you simply disconnect them at the proxy level and redirect their traffic to another backend. The player would just see a "lost connection to server, reconnecting..." for a few seconds and they'd be on a different server.

On the player's perspective, they only connect to a single IP address but the backend can be composed of many distributed systems. When you load up google.com, the same thing happens effectively (massive simplification) - you see a single entry point but the backend that process your request will vary (because obviously a single server can't handle all the Google requests!)

The article I'm writing is actually using Kubernetes for this task (similar to League of Legends and their Admiral orchestration backend) where a front facing load-balancer acts as the proxy and each server node lives inside a container inside the cluster. When you want to direct a player to a new world you simply tell the load-balancer to switch their connection to a new node.
__________________
PSA: I changed my username everywhere to "Southclaws" (including GitHub!)

Contact me:
My discord: dc.southcla.ws

Scavenge and Survive 2017 is coming soonish...
[HLF]Southclaw is offline   Reply With Quote
Old 13/02/2017, 06:50 PM   #15
Slawiii
Huge Clucker
 
Slawiii's Avatar
 
Join Date: May 2015
Location: Morocco, Missour
Posts: 299
Reputation: 16
Default Re: Redis (cache, database and message queue)

Awesome Man ! very useful
__________________

[FilterScript] SVIP System (0.01%)
Slawiii is offline   Reply With Quote
Old 13/02/2017, 11:12 PM   #16
Pottus
Godfather
 
Pottus's Avatar
 
Join Date: Jun 2012
Posts: 5,266
Reputation: 1140
Default Re: Redis (cache, database and message queue)

Quote:
Originally Posted by [HLF]Southclaw View Post
> "If a server crashes the client just reconnects to another server"

He's not talking about synchronising UDP data, he's talking about an MMO-style cluster architecture where multiple backends serve a single public IP and they all share the same data and events. It's entirely possible, each server would effectively be analogous to a virtual world on a regular server and to switch a player's "world" you simply disconnect them at the proxy level and redirect their traffic to another backend. The player would just see a "lost connection to server, reconnecting..." for a few seconds and they'd be on a different server.

On the player's perspective, they only connect to a single IP address but the backend can be composed of many distributed systems. When you load up google.com, the same thing happens effectively (massive simplification) - you see a single entry point but the backend that process your request will vary (because obviously a single server can't handle all the Google requests!)

The article I'm writing is actually using Kubernetes for this task (similar to League of Legends and their Admiral orchestration backend) where a front facing load-balancer acts as the proxy and each server node lives inside a container inside the cluster. When you want to direct a player to a new world you simply tell the load-balancer to switch their connection to a new node.
There is a few issues essentially it is no different then a gmx and we know that doing gmx does cause client bugs but it can work.
Pottus is offline   Reply With Quote
Old 13/02/2017, 11:22 PM   #17
X337
Banned
 
Join Date: Sep 2014
Location: Indonesia
Posts: 823
Reputation: 174
Default Re: Redis (cache, database and message queue)

Good work, i'm thinking of making a real-time UCP using this plugin. Thank you.
X337 is offline   Reply With Quote
Old 14/02/2017, 07:39 AM   #18
PistolWhip
Little Clucker
 
Join Date: Mar 2016
Posts: 4
Reputation: 0
Thumbs up Re: Redis (cache, database and message queue)

If this is working just fine, you will have a special place in my heart
PistolWhip is offline   Reply With Quote
Old 15/02/2017, 09:17 AM   #19
klap
Big Clucker
 
Join Date: Jul 2010
Posts: 84
Reputation: 7
Default Re: Redis (cache, database and message queue)

Oh, a cache plugin... nice
klap is offline   Reply With Quote
Old 15/02/2017, 07:31 PM   #20
Hiddos
High-roller
 
Hiddos's Avatar
 
Join Date: Sep 2008
Posts: 4,882
Reputation: 2179
Default Re: Redis (cache, database and message queue)

Quote:
Originally Posted by [HLF]Southclaw View Post
> "If a server crashes the client just reconnects to another server"

He's not talking about synchronising UDP data, he's talking about an MMO-style cluster architecture where multiple backends serve a single public IP and they all share the same data and events. It's entirely possible, each server would effectively be analogous to a virtual world on a regular server and to switch a player's "world" you simply disconnect them at the proxy level and redirect their traffic to another backend. The player would just see a "lost connection to server, reconnecting..." for a few seconds and they'd be on a different server.

On the player's perspective, they only connect to a single IP address but the backend can be composed of many distributed systems. When you load up google.com, the same thing happens effectively (massive simplification) - you see a single entry point but the backend that process your request will vary (because obviously a single server can't handle all the Google requests!)

The article I'm writing is actually using Kubernetes for this task (similar to League of Legends and their Admiral orchestration backend) where a front facing load-balancer acts as the proxy and each server node lives inside a container inside the cluster. When you want to direct a player to a new world you simply tell the load-balancer to switch their connection to a new node.
I'd love to read up more on this or even see a proof of concept, any tips?
__________________
Quote:
Originally Posted by DeWolf View Post
For fuck's sake people, this whole thread is fucked up now.
Hiddos is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Redis cache and message queue plugin for SA:MP [HLF]Southclaw Discussion 2 06/02/2017 05:47 PM
Using Redis Misiur Discussion 3 11/08/2014 09:17 PM
Moderation Queue Syncro Screenshots and Videos 1 07/05/2014 11:57 AM
Queue iJumbo Discussion 13 06/08/2013 08:29 AM


All times are GMT. The time now is 10:52 PM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.