Raised This Month: $32 Target: $400
 8% 

Slow Queries with remote connection


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
alerad
Junior Member
Join Date: Mar 2016
Old 09-03-2018 , 10:57   Slow Queries with remote connection
Reply With Quote #1

On map change, I'm running 8*PlayersOnline queries, I know this is a lot and can't avoid doing it without several hours of refactoring stuff.

My problem is the following:

If I run this queries connected to a local db (Same amount of rows and stuff as the remote db), they execute pretty fast, say 1 second.

However, I need to run this queries connected to a remote-hosted DB, and that's where stuff slows down. They take up to 8 seconds, and I'm sure the problem is on the sourcemod side since I tried connecting to the DB via CLI and got 0.004s responses for the same queries.

I also get really different query time results on local db, but they are less prominent. If I run the query on CLI, they aren't a hassle at all and execute really quick.

Any idea on how to approach this?

Thanks!

Last edited by alerad; 09-03-2018 at 11:14.
alerad is offline
asherkin
SourceMod Developer
Join Date: Aug 2009
Location: OnGameFrame()
Old 09-03-2018 , 11:35   Re: Slow Queries with remote connection
Reply With Quote #2

The result set was probably cached when you ran it manually. The only artificial limit in SM for DB stuff is that threaded queries are rate limited to 20 per second.
__________________
asherkin is offline
alerad
Junior Member
Join Date: Mar 2016
Old 09-03-2018 , 12:47   Re: Slow Queries with remote connection
Reply With Quote #3

Yeah, I thought about caching, but if I execute the same query twice with sourcemod, loading time doesn't differ by much, it's still reasonably high, will keep looking into it I guess

Last edited by alerad; 09-03-2018 at 12:47.
alerad is offline
shanapu
Veteran Member
Join Date: Apr 2015
Location: .de
Old 09-03-2018 , 12:56   Re: Slow Queries with remote connection
Reply With Quote #4

If I understand you correct, putting your 8*N queries in a transaction would speed this up.
__________________
coding & free software
shanapu is offline
alerad
Junior Member
Join Date: Mar 2016
Old 09-03-2018 , 13:15   Re: Slow Queries with remote connection
Reply With Quote #5

Sadly, all of my queries have complex callbacks, so I think using a transaction isn't an option (Maybe i'm wrong)
alerad is offline
asherkin
SourceMod Developer
Join Date: Aug 2009
Location: OnGameFrame()
Old 09-03-2018 , 13:17   Re: Slow Queries with remote connection
Reply With Quote #6

Oh, I didn't see that this was 8*N queries - yeah, it is probably the rate limit getting you.
__________________
asherkin is offline
alerad
Junior Member
Join Date: Mar 2016
Old 09-03-2018 , 13:52   Re: Slow Queries with remote connection
Reply With Quote #7

I doubt it's solely the rate limit, when I test it with only one player, only 8 queries are executed on map start, yet they still delay quite a bit.

Also, there's no way to edit that rate other than forking and hosting my own sourcemod version right?
alerad is offline
Reply


Thread Tools
Display Modes

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 19:42.


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