'LinKin Posted May 13, 2014 Share Posted May 13, 2014 Hello, I readed that using callRemote inside the implementation of the onPlayerJoin event causes lag.. Is this true? How about a MySQL connection? For example if I want that when a player joins it takes some value from an EXTERNAL* MySQL database. *External: Because the MySQL database is hosted in another VPS. If someone can clear out the doubt. Thanks. Link to comment
tosfera Posted May 13, 2014 Share Posted May 13, 2014 I've been scripting for a server that has an external database, it did cause some lag. For example, I wrote a turf system which loaded all of the turfs ( positions to capture ) out of an mysql, it had over 40 spots and did cause the well known 'network trouble'. I would strongly advise you to move your database to the same vps. If you want to keep it this way, you can just create your mysql connection with onResourceStart. When a play joins, use mysql_ping to see if the database is still connected, if not. Connect it again. This will cause lag. Because the database is not hosted at the same location, it first has to connect, retrieve data, send data back and receive the data. Which, in some cases, might take a while. Link to comment
'LinKin Posted May 13, 2014 Author Share Posted May 13, 2014 Hi tosfera, the link you gave for mysql_ping is wrong. Is this the MTA mysql module? Thanks Link to comment
LonelyRoad Posted May 14, 2014 Share Posted May 14, 2014 I think he is referring to the MySQL Module's ping... Having said that, back on topic - there will inevitably be some lag, but how severe it is depends on the 'network distance' of the two physical servers (or VPS' or whatever). Link to comment
'LinKin Posted May 14, 2014 Author Share Posted May 14, 2014 The MySQL db is in Brazil. I'd be accepting connections from Latin America as well as from Europe. Perhaps, the best thing would get a MySQL db somewhere in central europe. Regarding MySQL module's function (mysql_ping), is it nessesary? I've always tried to avoid using that module, instead of it I use dbConnect etc.. https://wiki.multitheftauto.com/wiki/DbConnect Link to comment
LonelyRoad Posted May 15, 2014 Share Posted May 15, 2014 The integrated db functions are a much better option for being future-proof, though I'm still in the process of converting my gamemode to that (not long ago did I start the project, and I regret starting with the module now). The point I was trying to make with the distance is where the actual game server is hosted, and where the DB is hosted. You need to allow for lag between the two servers, especially if they're in remote locations. You'd be much better off getting one good server to run it all through instead, or at least move the servers closer together, both VPS' through one company for example. Link to comment
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now