mtarainbow Posted October 12, 2014 Share Posted October 12, 2014 I have a large database and the database lag(network trouble) occurs when I tabled. How can I solve this? Link to comment
Anubhav Posted October 12, 2014 Share Posted October 12, 2014 Reduce the queriers and increase your server's RAM. Link to comment
Moderators IIYAMA Posted October 12, 2014 Moderators Share Posted October 12, 2014 By reducing requests of your database. ( make updates after a while ) Link to comment
mtarainbow Posted October 12, 2014 Author Share Posted October 12, 2014 Reduce the queriers and increase your server's RAM. 2 gb ram 2.1 ghz CPU By reducing requests of your database. ( make updates after a while ) that script.. addEvent("sortTopclans", true) addEventHandler("sortTopclans", root, function() triggerClientEvent("returnTopclans", source, loadall("wins")) end) function loadall (datatype) local root = xmlLoadFile ("DataBase.xml") if (root) then local usersNode = xmlFindChild (root,"user",0) if (usersNode) then local allPlayers = xmlNodeGetChildren(usersNode) allPlayersData = {} nrDD = 0 nrDM = 0 for i,data in ipairs(allPlayers) do if datatype == "achievements" then AchCount = 0 for j=1,#AchievementsName do local ac = tonumber(xmlNodeGetAttribute (data,"ac"..j.."")) if ac == 1 then AchCount = AchCount + 1 end end local playerName = xmlNodeGetAttribute (data,"playerName") allPlayersData[i] = {pName = playerName or "???",dType = AchCount or 0} elseif datatype == "ddratio" then local played = tonumber(xmlNodeGetAttribute (data,"mapsPlayedDD")) or 0 local wins = tonumber(xmlNodeGetAttribute (data,"mapsWonDD")) or 0 local ratio = 0 if played == 0 and wins == 0 then ratio = 0 elseif played ~= 0 and wins == 0 then ratio = 0 elseif played ~= 0 and wins ~= 0 then ratio = (100/played)*wins elseif wins > played then ratio = 0 end if played >= 100 then nrDD = nrDD + 1 local playerName = xmlNodeGetAttribute (data,"playerName") allPlayersData[nrDD] = {pName = playerName or "???",dType = ratio or 0} end elseif datatype == "dmratio" then local played = tonumber(xmlNodeGetAttribute (data,"mapsPlayedDM")) or 0 local wins = tonumber(xmlNodeGetAttribute (data,"mapsWonDM")) or 0 local ratio = 0 if played == 0 and wins == 0 then ratio = 0 elseif played ~= 0 and wins == 0 then ratio = 0 elseif played ~= 0 and wins ~= 0 then ratio = (100/played)*wins elseif wins > played then ratio = 0 end if played >= 100 then nrDM = nrDM + 1 local playerName = xmlNodeGetAttribute (data,"playerName") allPlayersData[nrDM] = {pName = playerName or "???",dType = ratio or 0} end else local playerData = tonumber(xmlNodeGetAttribute (data,datatype)) local playerName = xmlNodeGetAttribute (data,"nick") local playerKill = xmlNodeGetAttribute (data,"kills") allPlayersData[i] = {pName = playerName or "???",dType = playerData or 0 ,pKill = playerKill or 0} end end xmlUnloadFile (root) return allPlayersData end end end Link to comment
Moderators IIYAMA Posted October 12, 2014 Moderators Share Posted October 12, 2014 Use a lua table, to manage the data. Save the dat(to xml) a ones in the 30 min and when you shut it down. 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