Proximity Manager really big

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

Moderators: Lapo, Bax

trianglehead
Posts: 60
Joined: 13 Aug 2016, 04:28

Proximity Manager really big

Postby trianglehead » 07 Jan 2020, 02:30

Hi! I am noticing the ProximityManager bloating and eventually causes performance issues, CPU spiking, etc. I wonder if this following code causes this issue:

Code: Select all

               
               list = mroom.getProximityList(u);
               if(list!=null) {
                  list.add(u);// I think prox list doesn't include self, and we have coded everything to assume self is included
               }
               

Image
Annotation 2020-01-06 203216.jpg
(95.31 KiB) Not downloaded yet
User avatar
Lapo
Site Admin
Posts: 21340
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: Proximity Manager really big

Postby Lapo » 07 Jan 2020, 08:21

Hi,
the proximity system can use quite a bit of memory as it basically maps the world in a 3D data structure that keeps track of every user.
However there are multiple variables at play, such as the number of players in an MMORoom, their distribution in space and the available hardware resources.

As regards the code snippet, I am not sure what it is and I'd need more context to understand what you're doing.

Thanks
Lapo
--
gotoAndPlay()
...addicted to flash games
trianglehead
Posts: 60
Joined: 13 Aug 2016, 04:28

Re: Proximity Manager really big

Postby trianglehead » 15 Jan 2020, 16:13

Hi. So I had to restart the server, and let the server run again as it grinded to a halt. With the same amount of user base, around 100-150 ccu all day everyday, the MMORoom object just keeps growing over time. Currently it has run for 7 days, and the object grew to 2g in size. First couple days when I did a jcmd heap dump it was only 150m.

Image


My code uses MMOROOM in this manner:
1.)

Code: Select all

 mroom.getProximityList(pos, aoi); // to get list of users at certain positions and specify an area of interest

2.) I also create MMOItems:

Code: Select all

ISFSMMOApi mmoApi = SmartFoxServer.getInstance().getAPIManager().getMMOApi();

      // Set the Item in the room at specific coordinates
      mmoApi.setMMOItemPosition(item, new Vec3D(x, y, z), room);


But if you look at the attachment, the memory consumption is with SFSUser objects. With only 100-150 ccus, after 7 days There are 145k SFSUser objects and over 2gig retained heap size.


What is it that I can do? I'm running Smartfox 2.13.6.
Attachments
Annotation 2020-01-15 090803.jpg
(15.12 KiB) Not downloaded yet
User avatar
Lapo
Site Admin
Posts: 21340
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: Proximity Manager really big

Postby Lapo » 15 Jan 2020, 18:39

Are you doing any manual Room management such as calling MMORoom.addUser or MMORoom.removeUser?
Since the Room is apparently not releasing User objects, have you noticed any anomaly in the number of joined Users?

What are the hardware specs of the server running SFS2X?

Thanks
Lapo

--

gotoAndPlay()

...addicted to flash games
trianglehead
Posts: 60
Joined: 13 Aug 2016, 04:28

Re: Proximity Manager really big

Postby trianglehead » 15 Jan 2020, 19:01

Hi. Thanks for replying.

I only join room like this:

Code: Select all

getApi().joinRoom(sfUser, rooms.get(0));

Specs are EC2 c5.2xlarge with 16 gigs ram which I allocate 8 gigs, but the specs are not the issue, I got another game running on Smartfox with 7-10x the ccu. But does not use MMORoom and can run for months and no memory issues.

Any other idea would be greatly appreciated.
User avatar
Lapo
Site Admin
Posts: 21340
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: Proximity Manager really big

Postby Lapo » 16 Jan 2020, 09:09

Please also let us know about my previous question:
Since the Room is apparently not releasing User objects, have you noticed any anomaly in the number of joined Users?

Thanks
Lapo

--

gotoAndPlay()

...addicted to flash games
User avatar
Lapo
Site Admin
Posts: 21340
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: Proximity Manager really big

Postby Lapo » 16 Jan 2020, 11:20

I went back to the top of the original post and noticed this code snippet that you posted.

Code: Select all

list = mroom.getProximityList(u);
               if(list!=null) {
                  list.add(u);// I think prox list doesn't include self, and we have coded everything to assume self is included
               }


Can you explain what you're trying to accomplish with this?
When you're referring to "self" what is it? From the server-side perspective there is no "self". Because the server is not an entity in the game.

This is likely the cause of the problem, by the way, because you're not supposed to manipulate the ProximityList manually.
Thanks
Lapo

--

gotoAndPlay()

...addicted to flash games
trianglehead
Posts: 60
Joined: 13 Aug 2016, 04:28

Re: Proximity Manager really big

Postby trianglehead » 16 Jan 2020, 13:38

Thank you for reply. Self is a sfs user object of the user who made this call. I had changed this since last reboot so the original list no longer gets modified as I suspected that to be the cause. But still the bloat happens. This is how I changed it since last reboot but problem persists.

Code: Select all

list = mroom.getProximityList(u);
               if(list!=null) {
List newList = new ArrayList(list);
                 
                  newList.add(u);// I think prox list doesn't include self, and we have coded everything to assume self is included
return newList;
               }


So that original list isn't modified.
User avatar
Lapo
Site Admin
Posts: 21340
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: Proximity Manager really big

Postby Lapo » 16 Jan 2020, 16:04

In order to investigate this we would need to see the server logs: ideally the last 1-2 days before the server was restarted.
Also we would need to see you server side code to better understand what you're doing.

If you're running a commercial license, you can send us the material by zipping it and emailing it to our support@... email box.
(Please add a reference to this conversation as well)

Thanks
Lapo

--

gotoAndPlay()

...addicted to flash games

Return to “SFS2X Questions”

Who is online

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