-
Server lag [LIBCOD]
I use a script to save the statistics in the database (mysql):
PHP Code:
Endmap()
{
players = getentarray("player", "classname");
for(i = 0; i < players.size; i++)
{
players[i] database_save();
wait 0.25; //without, lags so much that the card does not end
}
}
database_save()
{
sql_zapros="UPDATE `base_rank_players` SET `rank`='"+self.data["rank"]+"', `kills`='"+self.data["kills"]+"' WHERE `login_player`='"+self.accdata["login"]+"'";
mysql_query(level.db["mysql"], sql_zapros);
}
The data is saved, but if the number of players is greater than 5 server lag.
Characteristics my VDS:
RAM: 1024 (Indications at 10 players and change maps: 204/1024)
Proccesor Core's: 2 (2.8 + 2.8 Mhz); Ubuntu-14.04-x86_64-minimal
//////
Could it be due to libcod?????
-
-
You mean to keep everything in one common request ??
-
Code:
mysql_async_create_query
mysql_async_create_query_nosave
mysql_async_getdone_list
mysql_async_getresult_and_free
mysql_async_initializer
Whether it is possible to carry out not using:http://killtube.org/showthread.php?1...-mysql-queries and using these features!
I am a bit do not understand (Write an example using my code) I will be very, very, very etc. Grateful to
-
There IS an example function in that thread. If you dont understand that, you shouldnt be trying to program asynchronously.
-
I need to create a connection?
PHP Code:
mysql_async_initializer(host, user, pass, db, port, 4); //???
-
Have you even read the code?
-
Izno, look.
PHP Code:
Endmap()
{
players = getentarray("player", "classname");
for(i = 0; i < players.size; i++)
{
players[i] database_save();
}
}
database_save()
{
sql_zapros="UPDATE `base_rank_players` SET `rank`='"+self.data["rank"]+"', `kills`='"+self.data["kills"]+"' WHERE `login_player`='"+self.accdata["login"]+"'";
mysql_async_create_query(sql_zapros);
}
so necessary?