Raised This Month: $ Target: $400
 0% 

server performance on mysql connection accross other plugins


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
deprale
Senior Member
Join Date: Oct 2018
Location: Leeds
Old 02-20-2023 , 23:05   Re: server performance on mysql connection accross other plugins
Reply With Quote #4

Quote:
Originally Posted by Rohanlogs View Post
Yes, I think it would be smarter to have 1 plugin handle the queries.
However it could be a rather tiresome coding task if you have many plugins with a lot of functions and variables, to have them all communicate to a single plugin.

Idk if the improvement would be that dramatic, but I noticed a long time ago when using the sqlx library on many plugins to save data on mapchange, even with threaded queries, it caused heavy lag/small crash everytime the map changed, making the loading screen like 4x longer.

I solved this lag by hooking a function X seconds before mapchange to save players stats.
I made some variation on each plugin when to execute the save so they don't all execute at once.
This completely fixed the laggy loading screen when the map changed.
If you do something like this you need to add a check on client_disconnect if the players stats are already saved, to not save them again.

This of course may cause some "lost" stats, for example if you are tracking player kills, and a player kills someone during the last second after the save queries were already called, that kill would not be saved.
But in my case it was well worth it to fix the lag/crash of the loading screen.
I fixed this by completely just not using mysql at all, but rather communicate with my mongodb through a crud api, with amxxeasyhttp, i can do all queries whenever and it won't lag the server or hang the thread (sql would do that even when using threaded tuples).
__________________
deprale is offline
 



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 10:12.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode