Query Posted July 29, 2018 Share Posted July 29, 2018 Hi, I have a Roleplay server over 200 players per day. But we have a problem with the "Account" issue. 6.000 accounts, 14,000 characters available in SQL. When we reach the high player numbers, there is a function in "setElementData" that treats the data that SQL has drawn when entering each character. This function goes to CPUs that reach 100% - 200% and sometimes 300% when we check it in "ipb" script. How can we fix this? Is there any way that I and my team can help with this? Link to comment
Discord Moderators Pirulax Posted July 30, 2018 Discord Moderators Share Posted July 30, 2018 (edited) dont use element data maybe? Because the way it works is that every element data is synced to everyone. Even the ones set at the client I think. So, that's the problem. Edited July 30, 2018 by Pirulax Link to comment
Query Posted July 30, 2018 Author Share Posted July 30, 2018 Sample: local characterData = false if theAdmin then accountID = remoteAccountID characterData = mysql:query_fetch_assoc("SELECT * FROM `characters` LEFT JOIN `jobs` ON `characters`.`id` = `jobs`.`jobCharID` AND `characters`.`job` = `jobs`.`jobID` WHERE `id`='" .. tostring(characterID) .. "' AND `account`='" .. tostring(accountID) .. "'") else characterData = mysql:query_fetch_assoc("SELECT * FROM `characters` LEFT JOIN `jobs` ON `characters`.`id` = `jobs`.`jobCharID` AND `characters`.`job` = `jobs`.`jobID` WHERE `id`='" .. tostring(characterID) .. "' AND `account`='" .. tostring(accountID) .. "' AND `cked`=0") end setElementDataEx(client, "maxvehicles", tonumber(characterData["maxvehicles"])) the last "setElementData" slaves as each player leaves the game. There's no problem here, it's not lagging. The problem occurs when retrieving repetitive data from SQL while doing "setElementData". When the player exits the server, we have no problems with SQL operations. No LAG. When logging into the server, when logging into the character, when pouring the data in SQL into "setElementData", the CPU usage increases considerably. We are experiencing a delay in high player numbers. We exported the entire SQL structure to the table, and we took the "setElementData" by pulling the table with the table. The problem is the same again. Even when the CPU usage was made with the tabulation structure, it increased even more. What kind of solution can you offer us? How did the big servers solve this problem? Link to comment
itHyperoX Posted July 30, 2018 Share Posted July 30, 2018 try to use dbQuery, check if is that better, if not, then try to use less elementData Link to comment
Query Posted July 30, 2018 Author Share Posted July 30, 2018 (edited) We tried dbQuery. The problem did not change. We can not reduce the number of elements at this time, the server is an active server. So I do not think we can drop it. We need a different solution. and plus a total of 90 elements. When you enter the character 90 elements are working. It's impossible to reduce it. Edited July 30, 2018 by Query Link to comment
SycroX Posted July 30, 2018 Share Posted July 30, 2018 do you try to replace the elementData with tables ? Link to comment
Query Posted July 30, 2018 Author Share Posted July 30, 2018 When the script runs, we have turned all SQL into a table. Later in the Quit process we updated the table. However, in the same function, each player has detected the username of the table on input and updated it with "setElementData". But according to SQL the table used more CPU. This was not a solution. We did the tests in this way. Link to comment
Discord Moderators Pirulax Posted July 30, 2018 Discord Moderators Share Posted July 30, 2018 That SQL query you just posted is totally inject safe, you should know that. Nah, back to the thing: buy a better VPS, or actually, a server. The problem is that(mostly) setElementData causes a big bottleneck, since it's synced to everyone who joins to the server. Try optimizing ur vehicle-system, since a lot of elements can cause big CPU usage too. Try reducing server-side elements, like create maps client side instead of server-side. Link to comment
Query Posted July 30, 2018 Author Share Posted July 30, 2018 Yes, you're right, I need to get a better server. (lul) I'm talking about a server that can see 300 players in total. You're telling me to buy a new server, it's funny. Link to comment
Moderators IIYAMA Posted July 31, 2018 Moderators Share Posted July 31, 2018 Are your queries limiting the search result? (Just check it if you haven't done it yet, because not doing it can improve the performance with 0 t/m 1000% depending on the situation) 1. Limit search results Your situation: queries are taking too long to complete and your lua memory is waiting for the results.(because you didn't use callbacks) 2. Use callbacks instead of pause the lua memory. 2.1 See also coroutines: https://www.lua.org/pil/9.1.html 3. Last resort You have to queue your queries and let it better work with your internal lua memory. 1 Link to comment
Query Posted August 2, 2018 Author Share Posted August 2, 2018 Thank you for your valuable comment. We will test with our developer team friends and re-comment. 1 Link to comment
Discord Moderators Pirulax Posted August 2, 2018 Discord Moderators Share Posted August 2, 2018 I'm sure that you have a professional team.(sarcasm) They didn't used callbacks. Neither LIMIT 1 in sql queries. Neither '?' but instead they simply concated string which leads to SQL injection.... On 7/31/2018 at 00:52, Query said: Yes, you're right, I need to get a better server. (lul) I'm talking about a server that can see 300 players in total. You're telling me to buy a new server, it's funny. Dont insult me, alright? Link to comment
Query Posted August 3, 2018 Author Share Posted August 3, 2018 (edited) You do not need to talk in a sarcastic way. 'IIYAMA's recommendation was our job. We solved the problem by 75%. Good people in the field of developers in my team. At least I have the best first four in Turkey. In the meantime I did not insult you, I do not want to be misunderstood. Rather; I did not insult anyone. Edited August 3, 2018 by Query Link to comment
Query Posted August 8, 2018 Author Share Posted August 8, 2018 We are also open to different suggestions. Link to comment
Discord Moderators Pirulax Posted August 9, 2018 Discord Moderators Share Posted August 9, 2018 @Query If they are the top 4 in turkey, then turkey is a big shame. Nah, back on the topic: Maybe try using batch=1 In dbConnect's option list. 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