Just want to get this out for all the people who seem to be unaware and just clutter their exports/events.
Down below are the files for two resources servemaster and askingforit.
servemaster just returns a string of one character repeated n-times.
Executing these shows that sending too much data through exports/events, will cause your server to hitch.
It will show up as a high tick rate for the sending resource, even tho the resource finished its code, execution within less of a millisecond.
Starting a data transfer rate (at my local pc) of 1MB/s I start getting hitches, above 100kB/s the sending times start spiraling out of control.
Conclusions for developers
With a growing number of players thanks to OneSync on your servers, you should follow some basic principles.
Send only necessary data through exports/events.
Send static data via JSON files to users, load these JSON files from other resources instead of accessing data via exports/events
Avoid sending entire objects through exports like ESX does.
I see, luckily I already do that, I’ve never understood why most scripters put static data in the DB anyway. For static data I mainly use lua tables that are shared by both client and server, are there any performance benefits in using a JSON file instad of a Lua table?