Page 1 of 1

[Performance] Find out a solution for a game with big data.

Posted: 11 Jul 2018, 10:15
by giapdq
Hi all,

I'm using smartfox to develop a game with big data, might this game will have 4-5 billion records in some of table in database.
I don't want to call query when game's running, that will make the game has delay time.

My solution:
I will load all data from database then store in RAM in ZoneExtension when starting server.
Something like this:

Code: Select all

private Map<Long, MyEntity> myData = new ConcurrentHashMap<Long, MyEntity>();
private Map<Long, MyEntity1> myData1 = new ConcurrentHashMap<Long, MyEntity1>();
....
And using these Map to have the needed data when game running.

Right now, It works well for me on my dev environment with small database, but i wonder that when these map size be increased to 4 or 5 billion, even more-> Is it still work well?
If you have experience in same this issue please share me.

Thanks alot

Re: [Performance] Find out a solution for a game with big data.

Posted: 11 Jul 2018, 15:44
by Lapo
Hi,
no it's a terrible idea :) Sorry I have to be blunt :)
But seriously don't do that. Find a good "big data" database, such as Mongo, Redis etc., and use on of those. They can give you very good performance while keeping your data reliable and secure.
I don't want to call query when game's running, that will make the game has delay time.
This assumptions needs to tested, otherwise you're going to design your system based on something you haven't verified.
Database calls are not that heavy to add latency to your game and they can run asynchronously so there's no blocking time. Or they can run in separate threads.

You may also want to check a product like Hazelcast, which works as a distributed in-memory database or it can work as a big cache for a Big Data DB.

Cheers

Re: [Performance] Find out a solution for a game with big data.

Posted: 12 Jul 2018, 02:13
by giapdq
Hi Lapo
It is impossible to me to change database as Mongo due to project deadline. Hazelcast might be a good solution for me.
Thanks for your advice.

Re: [Performance] Find out a solution for a game with big data.

Posted: 12 Jul 2018, 08:06
by Lapo
Hi,
sure Hazelcast is a very solid pick for a in-memory database. We've written an article on how to integrate Hazelcast with SFS2X.
It should give you an overall idea on how to get started.

See here:
http://docs2x.smartfoxserver.com/Overview/white-papers
(second to last document)

Good luck