cuwo icon indicating copy to clipboard operation
cuwo copied to clipboard

Traffic usage is slightly higher than normal server

Open matpow2 opened this issue 11 years ago • 2 comments

Just making a single issue for this. The reason for the higher traffic is due to the way entities are handled, as currently only full entity updates are sent. Need to check for changes to the entity, and only send changed attributes.

matpow2 avatar Jul 18 '13 18:07 matpow2

Maybe just decrease FPS of the server in the constants to 25. I have tested it and it seems to run with lesser laggs than with 50 FPS. It's just one possibility.

Also you could take a look into my fork where I made some (hopefully) improvements like sending the time every second instead of every update call: https://github.com/Jakky89/cuwo/commit/ae7171e9fc2fa07cf79df3e2da81f14813305856

This is the important part for network packages that don't need to be sent in such a high frequency (in the server.py update procedure):

        # secondly check
        secondly_check = False
        uxtime = int(reactor.seconds())
        if uxtime != self.last_secondly_check:
            self.last_secondly_check = uxtime
            secondly_check = True

Then you simply can check if the secondly_check flag is set everywhere in the procedure to perform non-high-frequency updates like this:

        if secondly_check:
            # time update
            time_packet.time = self.get_time()
            time_packet.day = self.get_day()
            self.broadcast_packet(time_packet)

Also I begun integrating SQLite (for players onlinetime, last online times, (temp-)bans etc.) and I will commit the newer changes in a few hours or days I think.

Jakky89 avatar Jul 19 '13 18:07 Jakky89

This should be fixed trunk through the partial entity updates. Hopefully people can confirm?

matpow2 avatar Jul 20 '13 19:07 matpow2