fivem-mysql-async
fivem-mysql-async copied to clipboard
mysql-async high tick
running mysql-async 3.2.0
Having the same problem, also running gcphone, I saw in the server logs that it causing high sql ms. Tell me if you got anything
Same problem
Are you running OneSync 64/128 slots ? @ArmoredSoldiers @MohamedAmrMahdy
Are you running OneSync 64/128 slots ? @ArmoredSoldiers @MohamedAmrMahdy
yes this issue happens when players get over 45 players online
Me too [But only when 50+], have you found any solution or something to help it ?
Have you tried to disable the gcphone ? @MohamedAmrMahdy
Have you tried to disable the gcphone ? @MohamedAmrMahdy
no but i think it is not the main reason because others recourse queries get same lag
I debugged the mysql, I saw that the gcphone has slow query [high ms], I've checked myself and with some of my programmers [in my server] and we saw that the phone itself built all on mysql [always query the sql and not saving data on the server/client script]
I'm gonna make some tests to see if it does the gcphone who is causing the problem, I'll let you know. @MohamedAmrMahdy
I've noticed to this thing in my console [on server startup]:
[32m[mysql-async][0m Database server connection established.
Authenticating with Nucleus...
server thread hitch warning: timer interval of 3040 milliseconds
Btw: I've tried to disable the gcphone and there's still high mysql tick that is causing a delay.
Samuray, yes, i running 75 slot with 256 player loops, and high tick up to 40-45 player up... i using OneSync plus, and use gcphone.
Currently I'm working on finding the problem in my server. I've updated some resources and removed ones I don't need. I'll update if there's any change.
Same here. Tried everything and disabling resources.
Still no solution?
running mysql-async 3.2.0
Hello, I want to know what is this analyzing tool?
Still problem :) Nothing fixed yet
Recurring issue for us from time to time aswell, not exactly sure.
Just a small question but... wouldn't changing your for loops to use the GetActivePlayers() native be much better than looping 1-256?
for _, player in ipairs(GetActivePlayers()) do
local ped = GetPlayerPed(player)
-- do stuff
end
Just a small question but... wouldn't changing your for loops to use the GetActivePlayers() native be much better than looping 1-256?
for _, player in ipairs(GetActivePlayers()) do local ped = GetPlayerPed(player) -- do stuff end
Are you refering to other plugins or the mysql plugin?
Has anyone tried messing around with mysql variables?
Just a small question but... wouldn't changing your for loops to use the GetActivePlayers() native be much better than looping 1-256?
for _, player in ipairs(GetActivePlayers()) do local ped = GetPlayerPed(player) -- do stuff end
Are you refering to other plugins or the mysql plugin?
Anything that maybe using it, is there a case that a script maybe doing something unintended which is looping up to 256 instead of the number of players connected which could cause a high tick rate. Its just a general question as I'm looking to step back tom GHMatti's C# MySQL resource that I'm using (because I like things being referenced in my C# Projects using ADO.NET as exports raise concerns for me) and use something that is more up to date like this resource as it looks to be widely used.
After more research, some of the lag can be fended off by improving the MySQL variables, but at around ~64 people the DB queries usually has over 1000ms sometimes when there is too much it racks up to 100k+ ms (until all queries are caught up). Most of our issues during lower pop (~50) was fixed by experimenting with variables.
All our tables are properly indexed as per needed I wonder if GHMatti can offer a solution or provide tips to look at to investigate it
@CruelAlpha how many queries per second are you running, which ones are slow?
where im putting this code? for _, player in ipairs(GetActivePlayers()) do local ped = GetPlayerPed(player) -- do stuff end
and how i change the loop to 256? thnx!!!
Hi, its because you have an server loop like this:
for i=1, #players, 1 do
-- MySQL.Async - Stuff
end
My solution to remove the high hitch time was this:
for i=1, #players, 1 do
doMySQLStuff(players[i])
end
function doMySQLStuff(player)
-- your MySQL.Async function stuff here
Citizen.Wait(50)
end
Info: When you put the Wait inside an for loop the server send an error
Try it and pease send feetback ^^ I hope it works on your servers to!!!
@Antontonov , you mean something like this ?
Before : `
MySQL.Async.fetchAll('SELECT owner FROM owned_vehicles WHERE owner = @owner AND plate = @plate', {
['@owner'] = identifier,
['@plate'] = plate
}, function(result)
if result[1] then
cb(result[1].owner == identifier)
else
cb(false)
end
end)
end)`
After : `
MySQL.Async.fetchAll('SELECT owner FROM owned_vehicles WHERE owner = @owner AND plate = @plate', {
['@owner'] = identifier,
['@plate'] = plate
}, function(result)
if result[1] then
cb(result[1].owner == identifier)
else
cb(false)
-- test
Citizen.Wait(50)
end
end)
end)`
Hi, First Citizien.Wait(msec) than cb() But for only one request you dont need any wait ... i ll do that for my mysql functions inside "for"-Loops It works fine for me and i haven t any big fat hitch warnings anymore.
Edit: And in your function the poor Citizen have to wait 50 msec longer to store/get his veh. or other stuff ^^
@Antontonov Interesting. I'll try to find out + I make the same thing but in client-side, which also works nice. The idea is simple. When someone uses an function from Ui menu or anywhere, he will have like 2-3 seconds cooldown, so the function will be triggered after that amount of time (the server-side code). This also works good, what you think about it ?
@Antontonov thanks for sharing this, looks interesting! Do you mind explaining, in what way the wait call decreases the hitch time?