Hi,
Is there any way to quickly find out which user is dropping packets? I can see sometimes how 10-15 packets are being dropped every 1-2 seconds. I need to see which user is responsible for it.
Milen
List of user's that are dropping packets
Re: List of user's that are dropping packets
Hi,
what version of SFS2X are you currently using?
Thanks
what version of SFS2X are you currently using?
Thanks
Re: List of user's that are dropping packets
version 2.16.1
Re: List of user's that are dropping packets
You could add a listener for an internal event called BitSwarmEvent.PACKET_DROPPED.
Generally speaking this is not a good idea in production because dropped packet events can be generated in the thousands per second and running custom listeners can become performance intensive.
In any case this is a quick example. This is what a listener could look like:
And this is to attach the event listener in your Extension init() method:
NOTE:
Starting from SFS2X 2.16.3 and higher this event is no longer triggered by default.
Here's the release note extract:
Cheers
Generally speaking this is not a good idea in production because dropped packet events can be generated in the thousands per second and running custom listeners can become performance intensive.
In any case this is a quick example. This is what a listener could look like:
Code: Select all
import package com.smartfoxserver.bitswarm.events.*;
public class MyListener implements IEventListener
{
@Override
void handleEvent(IEvent event)
{
ISession session = (ISession) event.getParameter("session");
User user = SmartFoxServer.getInstance().getUserManager().getUserBySession(session);
}
}
And this is to attach the event listener in your Extension init() method:
Code: Select all
@Override
public void init()
{
BaseCoreService sw = (BaseCoreService) BitSwarmEngine.getInstance().getSocketWriter();
sw.addEventListener(BitSwarmEvents.PACKET_DROPPED, new MyListener());
}
NOTE:
Starting from SFS2X 2.16.3 and higher this event is no longer triggered by default.
Here's the release note extract:
- [NEW] By default Bitswarm events BitSwarmEvents.PACKET_DROPPED are no longer triggered, as they are rarely utilized and can use up performance in high traffic servers with lots of outgoing packet loss. Developers can manually enable the event via config/core.xml by adding the following: <triggerDroppedPacketEvents>true</triggerDroppedPacketEvents>.
Cheers
Re: List of user's that are dropping packets
How can I add this to Admin?
Re: List of user's that are dropping packets
It can't be added to the Admin, sorry. This is a low level event listener that you can add to your Extension code if you want to see which connections are dropping.
Honestly though, I am not sure how this can help since packet dropping is not something you can correct. It typically depends on the client's connection and there's not much you can do. The server already handles the situation automatically to the best of its ability (which depends on the client's network in the end).
Cheers
Honestly though, I am not sure how this can help since packet dropping is not something you can correct. It typically depends on the client's connection and there's not much you can do. The server already handles the situation automatically to the best of its ability (which depends on the client's network in the end).
Cheers
Re: List of user's that are dropping packets
Thanks. Will give it a tray int he extension and see how it impacts.
Re: List of user's that are dropping packets
I'm in real trouble here. we use SFS for an educational product ( student and teachers ). Teachers monitor sometimes a couple of hundred students playing bridge and provide robot moves when needed. So a lot of data goes out to the teachers. However, somewhere in our code, there is a bug that comes up rarely and we can't trace it. The only symptom is we start to see a lot of dropped packets and need a way to figure out which teacher is dropping them without too much of a performance hit.
Any chance you can add some utility that fires an event if say 1000 packets are dropped per second by a session. All we need is the username for that session.
Any chance you can add some utility that fires an event if say 1000 packets are dropped per second by a session. All we need is the username for that session.
Re: List of user's that are dropping packets
Hi,
every User's Session object has a dropped packet counter. So you can go through the list of teachers, check their packet-drop count and see which User has the highest values.
Example:
Cheers
every User's Session object has a dropped packet counter. So you can go through the list of teachers, check their packet-drop count and see which User has the highest values.
Example:
Code: Select all
int packetDropCount = user.getSession().getDroppedMessages();
Cheers
Re: List of user's that are dropping packets
Thank you. That is perfect.
Who is online
Users browsing this forum: No registered users and 127 guests