MySQL 40 - 50 queries/s benchmark
#1

Hello,

I'm new to this sort of stuff. I'm developing a gamemode based on BlueG's MySQL plugin and have been getting some questionable performance from it, no doubt a fault of my own most likely.

I decided to benchmark my calling function:
  • 1818 ticks for 100 iterations just querying - no callback provided.
  • 1982 ticks for 100 iterations w/ empty callback function.
The function itself:
Код:
new string[100];	
mysql_format(g_SQL, string, sizeof(string), "SELECT * FROM `test_data` WHERE `id` = 1");
mysql_tquery(g_SQL, string, "DataThread");
Close to 2 seconds to query a name & empty int field - I have no base as to whether this is an expected speed or not. I was also getting 0.03-6 times m/s using https://sampforum.blast.hk/showthread.php?tid=218491. My question, is this an ideal speed for a gamemode to utilise efficiently?

If it helps, the cache_get_query_exec_time() was proving to be very, very little - a matter of several hundred microseconds in my callback.

I'd greatly appreciate if someone could clarify this, thanks.
Reply
#2

You can't benchmark this like this, cause this is multi-threaded.

Actually if you benchmark functions, this is only in one thread so you can look how long it takes.

But mysql_tquery starts a new thread, where the sql query gets execuded and so on...

With your benchmark you just check how long it takes so that these functions get called..and not how fast mysql works

But actually this isn't matter..cause its multi threaded (async)
Reply
#3

Information

I don't actually think its multi-threaded, I believe I read not long ago that they simulate multi-threading by queuing the functions within the main Process Tick.

I maybe incorrect or mis-informed, but I believe that is how it works. SA-MP is not multi-threaded capable, so I don't think its even possible?
Reply
#4

Quote:
Originally Posted by azzerking
Посмотреть сообщение
Informationinformed, but I believe that is how it works. SA-MP is not multi-threaded capable, so I don't think its even possible?
Sure it is: https://sampforum.blast.hk/showthread.php?tid=264178

I am not 100% sure, if this is done in the mysql plugin..but i think so
Reply
#5

Quote:
Originally Posted by Kaliber
Посмотреть сообщение
Sure it is: https://sampforum.blast.hk/showthread.php?tid=264178

I am not 100% sure, if this is done in the mysql plugin..but i think so
If I remember correctly that plugin doesn't work or at least not in the way it is described to. Due to the fact that it can cause your gamemode to become corrupt is the reason why Multi-Threading is a bad idea.

Don't use it.
Reply
#6

I just said it is possible...not that this should be used xD

But if you work only in the Thread...it should be save...
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)