Vice City: Multiplayer

VC:MP Discussion => General Discussion => Topic started by: Luis_Labarca on Nov 02, 2016, 11:08 PM

Title: questions sqlite and ini
Post by: Luis_Labarca on Nov 02, 2016, 11:08 PM
Hello we all know that saving data continuously with sqlite does lag
my doubt is if I keep data continuously with ini produceria lag?

Another thing and I could tell the advantages and desventanjas of ini and sqlite
Title: Re: questions sqlite and ini
Post by: jWeb on Nov 03, 2016, 05:41 AM
Huh? The coca happened here?
Title: Re: questions sqlite and ini
Post by: Kewun on Nov 03, 2016, 06:35 AM
Ini also does "lag". But I don't understand as my server doesn't lag by it. I never use sqlite because it sucks for me. Use ini, I don't really understand why people say it lags shit.
I'm using like 50 ini data's, and no lag.
Title: Re: questions sqlite and ini
Post by: Thijn on Nov 03, 2016, 07:55 AM
SQLite doesn't lag if you use it properly. INIs are always a bad idea. They're not made for storing and retrieving data for VC:MP.
Title: Re: questions sqlite and ini
Post by: Luis_Labarca on Nov 03, 2016, 08:18 AM
Quote from: Thijn on Nov 03, 2016, 07:55 AMSQLite doesn't lag if you use it properly. INIs are always a bad idea. They're not made for storing and retrieving data for VC:MP.
aah ok thanks
Title: Re: questions sqlite and ini
Post by: Luis_Labarca on Nov 03, 2016, 08:19 AM
Quote from: Kewun on Nov 03, 2016, 06:35 AMIni also does "lag". But I don't understand as my server doesn't lag by it. I never use sqlite because it sucks for me. Use ini, I don't really understand why people say it lags shit.
I'm using like 50 ini data's, and no lag.
good used the function ini in them functions that I gave lag with sqlite usare the ini for some things thank you for comment
Title: Re: questions sqlite and ini
Post by: Luis_Labarca on Nov 03, 2016, 08:19 AM
Quote from: jWeb on Nov 03, 2016, 05:41 AMHuh? The coca happened here?
is thing hahaha
Title: Re: questions sqlite and ini
Post by: Mötley on Nov 03, 2016, 02:20 PM
Well I did not see the vcmp version of FBS, So hear is the LU version.

Your real question should be "How are you going about reading and writing data", Are you writing it and retrieving it like these examples?
function PlayerKills( player )
{
// This gets the players kill count
local Kills = hsh_Stats.Get( player.Name.tolower() + "Kills" );
return Kills;
}

function IncreaseKills( player )
{
// This increases the amount of kills a player has
hsh_Stats.Inc( player.Name.tolower() + "Kills", 1 );
}

function IncreaseDeaths( player )
{
// This increases the amount of deaths a player has
hsh_Stats.Inc( player.Name.tolower() + "Deaths", 1 );
}

function PlayerCash( player )
{
// This gets the amount of cash that a player has
local Cash;
Cash = hsh_Finance.Get( player.Name.tolower() + "Cash" );

if ( Cash ) return Cash;
else return 0;
}

function IncreaseCash( player, amount )
{
// This increases the amount of cash a player has
hsh_Finance.Inc( player.Name.tolower() + "Cash", amount );
player.Cash += amount;
}

function PlayerBank( player )
{
// This gets the players bank balance
local Bank;
Bank = hsh_Finance.Get( player.Name.tolower() + "Bank" );

if ( Bank ) return Bank;
else return 0;
}

function DecreaseCash( player, amount )
{
// This decreases the amount of cash a player has
hsh_Finance.Dec( player.Name.tolower() + "Cash", amount );
player.Cash -= amount;
}

function IncreaseBank( player, amount )
{
// This increases the players bank balanace
hsh_Finance.Inc( player.Name.tolower() + "Bank", amount );
player.Cash -= amount;
}

OR are you storing the data in a array/class and writing the data every five minutes or so?

This is something you should figure out, As it really matters to which way you plan to use your system for storing the players data.

 :P Theres not ONE array/class in FBS ;D
Title: Re: questions sqlite and ini
Post by: KAKAN on Nov 03, 2016, 04:29 PM
My suggestion, load everything into arrays/tables. Done, now your performance is very fast because you fetch from RAM, which is faster than SSD or HDD.
Title: Re: questions sqlite and ini
Post by: EK.IceFlake on Nov 04, 2016, 10:25 AM
Quote from: KAKAN on Nov 03, 2016, 04:29 PMMy suggestion, load everything into arrays/tables. Done, now your performance is very fast because you fetch from RAM, which is faster than SSD or HDD.
oh f* my server crashed
Exactly.
Title: Re: questions sqlite and ini
Post by: KAKAN on Nov 04, 2016, 12:27 PM
Quote from: EK.CrystalBlue on Nov 04, 2016, 10:25 AM
Quote from: KAKAN on Nov 03, 2016, 04:29 PMMy suggestion, load everything into arrays/tables. Done, now your performance is very fast because you fetch from RAM, which is faster than SSD or HDD.
oh f* my server crashed
Exactly.
lol? That won't crash the server unless you got a stone age PC.
Title: Re: questions sqlite and ini
Post by: EK.IceFlake on Nov 04, 2016, 12:41 PM
No I mean if your server crashes then data is lost -- imagine an admin just went through 2000 accounts and did some shits and now the server crashed.
Or a player won 16M in an event
Title: Re: questions sqlite and ini
Post by: KAKAN on Nov 04, 2016, 05:24 PM
Quote from: EK.CrystalBlue on Nov 04, 2016, 12:41 PMNo I mean if your server crashes then data is lost -- imagine an admin just went through 2000 accounts and did some shits and now the server crashed.
Or a player won 16M in an event
you can keep updating. But, why would the server crash? Use SLC's plugin, do some really good scripting and your server won't crash.
Title: Re: questions sqlite and ini
Post by: EK.IceFlake on Nov 04, 2016, 06:27 PM
Quote from: KAKAN on Nov 04, 2016, 05:24 PM
Quote from: EK.CrystalBlue on Nov 04, 2016, 12:41 PMNo I mean if your server crashes then data is lost -- imagine an admin just went through 2000 accounts and did some shits and now the server crashed.
Or a player won 16M in an event
you can keep updating. But, why would the server crash? Use SLC's plugin, do some really good scripting and your server won't crash.
Power fault?
Title: Re: questions sqlite and ini
Post by: . on Nov 04, 2016, 07:00 PM
Quote from: EK.CrystalBlue on Nov 04, 2016, 06:27 PMPower fault?

I believe that's considered to be your fault for hosting on your local PC. Besides, it's not as if you've never synchronized with the database. Who in their right minds read from database and only save on shutdown? So what? a few nabs lost a few stats from the past minute. Will the world end somehow? No! The problem was you hosting on you grandma's PC. Get a VPS ffs.

But that's not the issue here. The issue is that people don't know how to tackle SQLite and use it properly. So they just claim SQLite sucks and lags. There's a saying here in my country "Cats will say it stinks where they can't reach". And I find that to describe many of you that keep saying SQLite sucks.

You don't understand transactions and how costly they are to insert statements. And the fact that each query will demand a transaction. Regardless of who provides it.

The second and even bigger problem is that SQLite has no caching mechanism. By default, it uses a very safe writing mechanism where it makes sure that every single bit you specified is written to the disk and then it proceeds on you the next query (*cough* transaction *cough*). Read more (http://www.sqlite.org/faq.html#q19). But used properly, you can get around that.

Get real people. INI can't do sh!t when it comes to complex database operations. There's no point in giving you examples because you wouldn't understand sh!t.
Title: Re: questions sqlite and ini
Post by: EK.IceFlake on Nov 04, 2016, 07:32 PM
Quote from: . on Nov 04, 2016, 07:00 PM
Quote from: EK.CrystalBlue on Nov 04, 2016, 06:27 PMPower fault?

I believe that's considered to be your fault for hosting on your local PC. Besides, it's not as if you've never synchronized with the database. Who in their right minds read from database and only save on shutdown? So what? a few nabs lost a few stats from the past minute. Will the world end somehow? No! The problem was you hosting on you grandma's PC. Get a VPS ffs.

But that's not the issue here. The issue is that people don't know how to tackle SQLite and use it properly. So they just claim SQLite sucks and lags. There's a saying here in my country "Cat will say it stinks where she can't reach". And I find that to describe many of you that keep saying SQLite sucks.

You don't understand transactions and how costly they are to insert statements. And the fact that each query will demand a transaction. Regardless of who provides it.

The second and even bigger problem is that SQLite has no caching mechanism. By default, it uses a very safe writing mechanism where it makes sure that every single bit you specified is written to the disk and then it proceeds on you the next query (*cough* transaction *cough*). Read more (http://www.sqlite.org/faq.html#q19).

Get real people. INI can't do sh!t when it comes to complex database operations. There's no point in giving you examples because you wouldn't understand sh!t.
How many VPS's do you see with 100% uptime? Exactly.

Also like I said lets say an admin has went through 2000 accounts or so and the server crashed.
Title: Re: questions sqlite and ini
Post by: . on Nov 04, 2016, 07:47 PM
Quote from: EK.CrystalBlue on Nov 04, 2016, 07:32 PM...an admin has went through 2000 accounts or so...

Explain what do you mean by that because it can't be what I think it is. And if it is, that can't be your argument.
Title: Re: questions sqlite and ini
Post by: EK.IceFlake on Nov 05, 2016, 05:54 AM
Quote from: . on Nov 04, 2016, 07:47 PM
Quote from: EK.CrystalBlue on Nov 04, 2016, 07:32 PM...an admin has went through 2000 accounts or so...

Explain what do you mean by that because it can't be what I think it is. And if it is, that can't be your argument.
/setaccinfo 1 16 250
/setaccinfo 2 16 250
/setaccinfo 3 16 250
/setaccinfo 4 16 250
/setaccinfo 5 16 250

Anyways in VKs server which might have about 100 database calls or so every minute (when we are reaching our peak player count) we use direct SQLite without any arrays, and it doesn't lag at all. Not even slightly.

p.s. /setaccinfo is a command that sets something about an account in a database, for example /setaccinfo 1 16 250 will set account id 1 column 16 to 250
Title: Re: questions sqlite and ini
Post by: jWeb on Nov 05, 2016, 12:14 PM
But doesn't that mean the information is already in the database and written on disk? So how would a power outage or crash produce any data loss at this point?
Title: Re: questions sqlite and ini
Post by: EK.IceFlake on Nov 05, 2016, 12:36 PM
Quote from: jWeb on Nov 05, 2016, 12:14 PMBut doesn't that mean the information is already in the database and written on disk? So how would a power outage or crash produce any data loss at this point?
That's the point, if we save it on disk directly we won't lose it.