My SourceBans module causes massive lag on some servers.
5 replies, posted
I've been working for a while on an implementation of SourceBans in Lua. I've managed to get it from [url=http://pastebin.com/0UnnDEKT]messy PoC[/url] to clean working module with very few problems on my local server, where it performs beautifully.
However, as soon as I toss it onto my normal server, it starts to lag out to about 1.5 FPS and no one can join.
I've had a good look, and I can't see any reason why. Any help?
[[url=http://lexi.org.uk/modules/sourcebans.lua]Module[/url]]
[[url=http://lexi.org.uk/modules/sourcebans.html]Documentation[/url]]
[[url=http://www.facepunch.com/showthread.php?t=933647]MySQLOO[/url]]
Usage:
[lua]--[[
~ Sourcebans Setup Example ~
~ Lexi ~
--]]
require("sourcebans")
sourcebans.SetConfig("hostname", "localhost");
sourcebans.SetConfig("username", "root");
sourcebans.SetConfig("password", "");
sourcebans.SetConfig("database", "sourcebans");
sourcebans.SetConfig("dbprefix", "sbans");
sourcebans.SetConfig("portnumb", 3306);
sourcebans.SetConfig("serverid", 1);
sourcebans.Activate();[/lua]
Had a quick scan through the code, nothing obvious. The sourcebans database is on the same box as the server, yeah?
Actually I think it's off on some kind of cloud host somewhere, but I used the same database for testing locally.
I would suggest a mysql module that isn't so complicated, but I also see that you're calling
[lua]
local status = database:status();
[/lua]
Every tick, which will call mysql_ping. That's blocking.
status function on a database on MySQLOO lags very badly, dont use it
I see, thank you. I will change that to a 5 minute timer.
Sorry, you need to Log In to post a reply to this thread.