AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Better save system than nvault (https://forums.alliedmods.net/showthread.php?t=228999)

bcKq 10-30-2013 15:41

Better save system than nvault
 
Hello, does anyone know a better save system than nvault?
I have a problem with nVault that the bigger the db is the more lags are on my server, and after a week from server start (4k players passing by * 30 classes = 120 000 records) the server crashes and deletes half of the data (resets levels for players, or changes them, well it does weird stuff).
I need a system that can handle a biig database without crashes or lags.
I have mysql on localhost with the server but will that do better than nvault?
Or maybe you know any better system?

YamiKaitou 10-30-2013 15:50

Re: Better save system than nvault
 
SQLite is another option

stigma 10-30-2013 16:06

Re: Better save system than nvault
 
I wouldn't be a problem for MySQL do handle such a small amount of records for sure, unless you have wooden server.

...and make sure to use threaded queries.

Bugsy 11-03-2013 12:00

Re: Better save system than nvault
 
nVault is good because it's the easiest. Depending on the amount of data and the types of queries you need to make, SQL could be a better option. If you want to continue with nVault, is it possible to change how your data is being saved to less the number of entries per-player? Give an example of each players entries.

bcKq 11-05-2013 15:36

Re: Better save system than nvault
 
PHP Code:

Buli&Soldat \y(SuperVIP)&cod#9834110#300#0#0#248#0 

First is nick, second is class. There are X number of player data entries where X stands for number of class (about 30). The remaining data are stats, split by # (I use replace_all in loaddata)

I already use SQL and nVault together, SQL is for storing player's clans (1st table, uses IDs of players from the second one) and orders (money) + passwords (second table).
Should I make another table for Player Class Data? It would make another 30 entries per each player. Would it be better optimized than nVault?

The queries I make with nvault are:
LoadData, SaveData and that's pretty much it.

For SQL it's a lot more queries (1000+ per second?) because I use it in a function that is called each 0.1 second for EACH player (so if there are 32 players it is 32 queries per 0.1 second). I know it's not optimized and I'm working on a rewrite of this part. There are also queries made when someone says in chat like /clan, /account, /login, player connect, disconnect, synchronize data with SQL etc.

I really don't know what save system would be best for that type of databases (I really work on them a lot).
I think now I will work on pure SQL, but I have a question:
Should I use SQL queries like I do now:
PHP Code:

new Handle:hPolaczenieiErrorszError[256];
    if((
hPolaczenie SQL_Connect(g_PojemnikSQLiErrorszError255)))
    {
        new 
Handle:hQuery SQL_PrepareQuery(hPolaczenie"SELECT * FROM gracze WHERE `nick` = '%s'"g_NickGracza[id]);
        new 
szHaslo[32];
        
        if(
SQL_Execute(hQuery))
        {
            
SQL_ReadResult(hQuerySQL_FieldNameToNum(hQuery"haslo"), szHaslo31);
            if( !
equali(szHaslo"") )
            {
                
g_bZarejestrowany[id] = true;
            }
            else
            {
                
g_bZarejestrowany[id] = false;
            }
        } 
SQL_FreeHandle(hQuery);
    } 
SQL_FreeHandle(hPolaczenie); 

Or would it be better to use that module:
http://forums.alliedmods.net/showthread.php?t=227170

If you have any suggestions please post below

baneado 11-06-2013 05:09

Re: Better save system than nvault
 
to save player data, do it on client_disconnect and when round ends.

not do it in a forward that's called 0.1 seconds per each player on the server...

bcKq 11-06-2013 06:42

Re: Better save system than nvault
 
Save player data (on nvault) is done on client_disconnect, load is done on client_connect.
I use SQL queries each 0.1 second (they are small ones, just one select, but I will change it so it will be executed like each 5 seconds).
The problem is for sure with nVault, because I had the same problem in before, back then I didn't use SQL at all.
Of course I'm talking about MySQL on LOCAL server.

So, anyone can tell me if http://forums.alliedmods.net/showthread.php?t=227170 is better than using sqlx SQL_Connect and SQL_Execute? Because I'm rewriting my SQL code anyways and I need to find the most efficient functions.


All times are GMT -4. The time now is 23:20.

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