Lobby server high availability

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

Moderators: Lapo, Bax

feynman
Posts: 1
Joined: 23 Mar 2017, 19:05

Lobby server high availability

Postby feynman » 23 Mar 2017, 19:22

Hi,
I`m trying to implement HA for lobby server. I have configuration with one Active and one Standby server, when active goes down, standby is started and persisted rooms are restored and virtual IP address is moved to the new server.

I need to reconnect client to new lobby server, the easiest solution would be HRC (http://docs2x.smartfoxserver.com/Gettin ... n-hrc-plus), but when I try to use HRC system I get following error when client tries to reconnect:

Code: Select all

::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

23 Mar 2017 | 19:17:34,114 | WARN  | SocketReader | protocol.binary.BinaryIoHandler |     | java.lang.IllegalStateException:
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
Exception: java.lang.IllegalStateException
Message: Session does not support encryption: { Id: 1, Type: DEFAULT, Logged: No, IP: x.x.x.x:37267 }
Sender: { Id: 1, Type: DEFAULT, Logged: No, IP: x.x.x.x:37267 }
+--- --- ---+
Stack Trace:
+--- --- ---+
com.smartfoxserver.v2.protocol.binary.DefaultPacketEncrypter.execute(DefaultPacketEncrypter.java:42)
com.smartfoxserver.v2.protocol.binary.DefaultPacketEncrypter.decrypt(DefaultPacketEncrypter.java:22)
com.smartfoxserver.v2.protocol.binary.BinaryIoHandler.handlePacketData(BinaryIoHandler.java:410)
com.smartfoxserver.v2.protocol.binary.BinaryIoHandler.handleRead(BinaryIoHandler.java:197)
com.smartfoxserver.v2.protocol.SFSIoHandler.onDataRead(SFSIoHandler.java:142)
com.smartfoxserver.bitswarm.core.SocketReader.readTcpData(SocketReader.java:336)
com.smartfoxserver.bitswarm.core.SocketReader.readIncomingSocketData(SocketReader.java:220)
com.smartfoxserver.bitswarm.core.SocketReader.run(SocketReader.java:171)
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
java.lang.Thread.run(Thread.java:745)


It's probably because the session and TCP connection does not exists on newly started server and encryption is not initialized. Is there a way how to fix this?

Thanks for any suggestion.
User avatar
Lapo
Site Admin
Posts: 23008
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: Lobby server high availability

Postby Lapo » 24 Mar 2017, 10:35

Hi,
this isn't possible. The state of all previous users is not available on the new active server, so there's no way to reconnect people and restart from where they left.

To do that you would need to distribute most of the server state, which is a highly complex business, especially if you want to generalize it (i.e. be able to work correctly in all possible scenarios)

An "easier" way could be to store some of the important state in a central database so that user connecting back to the new server could restore the state. This is also not as easy as it sounds, because it potentially involves a lot of database work to keep everyone's state up to date and it could create a bottleneck for the server ( in other words, too much DB calls would add too much latency )

Cheers
Lapo
--
gotoAndPlay()
...addicted to flash games

Return to “SFS2X Questions”

Who is online

Users browsing this forum: No registered users and 51 guests