[UGRENT] - Outgoing message queue size is very hight

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

Moderators: Lapo, Bax

mrtun9z
Posts: 3
Joined: 13 Mar 2017, 06:58

[UGRENT] - Outgoing message queue size is very hight

Postby mrtun9z » 05 May 2017, 05:02

Hi, i have problem when ccu in my game ~1000 then outgoing message queue is very high => my game is lag :(
I tried set socketWriterThreadPoolSize = 8 in core.xml but it not effective :(
Help me please :(
Thanks!

Screen Shot 2017-05-05 at 11.50.17 AM.png
(164.32 KiB) Not downloaded yet

Screen Shot 2017-05-05 at 11.50.08 AM.png
(232.39 KiB) Not downloaded yet
User avatar
Lapo
Site Admin
Posts: 23008
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: [UGRENT] - Outgoing message queue size is very hight

Postby Lapo » 05 May 2017, 08:09

Hi,
you seem to be running an old SFS2X version, what version is it exactly?

As regards the issue you have described adding more threads it's unlikely to resolve the problem. The issue could be caused by two factors:

1- lack of bandwidth on the server side
2- too much data being sent to the clients

or a mix of the two.

The very big spikes in the graph of the outgoing data suggest that you're sending too much data at certain times, causing massive load on the network. In fact some of those spikes reach 60-70Mb/s while the base traffic is much lower.

If I had to guess why this is happening I would think that it's due to massive broadcasts, like sending messages in Rooms with hundreds or thousands of clients.

If you have created Rooms that hold hundreds of people you will need to be very careful with broadcast messages because that's what they do, they cause massive traffic.
Example -> Room for 500 people: if every one sends a public message at the same time you will have 500x500 message = 250.000 messages at once! :)

Hope it helps
Lapo
--
gotoAndPlay()
...addicted to flash games
mrtun9z
Posts: 3
Joined: 13 Mar 2017, 06:58

Re: [UGRENT] - Outgoing message queue size is very hight

Postby mrtun9z » 06 May 2017, 08:21

I'm using SFS version 2.13.0
As you say, my game has jackpot and we must broadcasts for all user on the interval period time (current it = 3 seconds).
Can you suggest for me handler it?
Thanks you!
User avatar
Lapo
Site Admin
Posts: 23008
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: [UGRENT] - Outgoing message queue size is very hight

Postby Lapo » 07 May 2017, 07:28

Can you clarify how this broadcast works?
Lapo

--

gotoAndPlay()

...addicted to flash games
mrtun9z
Posts: 3
Joined: 13 Mar 2017, 06:58

Re: [UGRENT] - Outgoing message queue size is very hight

Postby mrtun9z » 07 May 2017, 09:32

I created Runnable instance when server already, on the "run" method i send message to all user.
This is my code

Code: Select all

SmartFoxServer.getInstance().getTaskScheduler().scheduleAtFixedRate(new UpdateJackPotAllGameServices(), 5, 3, TimeUnit.SECONDS);

Code: Select all

 @Override
    public void run() {
        SendNotifyUpdateJackPotAllGame msg = new SendNotifyUpdateJackPotAllGame();
        msg.data = this.data;
        zoneServer.send(msg, new ArrayList<>(zoneServer.getExt().getParentZone().getUserList()));
    }
User avatar
Lapo
Site Admin
Posts: 23008
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: [UGRENT] - Outgoing message queue size is very hight

Postby Lapo » 08 May 2017, 07:00

I've given a second look at the pictures you have posted and I don't think there's anything wrong with your server setup.
The "Outgoing queue" graph has small spikes up to 800-900 messages that correlate with the code you have posted, meaning that all of a sudden your code will generate a spike of outgoing traffic, which is rapidly dealt with. In fact the spikes are very thin, meaning that the queue is filled and emptied very fast.

You could worry about those spikes if they covered very large areas of the graph, but this is not the case. Also I don't recommend adding more threads because it won't make any difference. The speed at which data is sent out depends only on 2 factors: your server side bandwidth and the client's ability to receive data.

Hope it helps
Lapo

--

gotoAndPlay()

...addicted to flash games

Return to “SFS2X Questions”

Who is online

Users browsing this forum: No registered users and 53 guests