Choosing a database

04/23/2014 21:05 Wolfy.#16
I went over for MySQL, can't complain.
04/23/2014 23:05 Y u k i#17
Quote:
Originally Posted by InsomniacPro View Post
I'm sorry for updating an old post, but just some heads up. I was working with a source that uses completely ini. As I was converting to MsSQL, I noticed this.
Loading NPCs went from ~300ms, to ~12ms. Loading MonsterData+MonsterSpawns went from ~1300 ms, to ~260 ms. Loading map information went from ~1700 ms to ~200 ms. Among other things. This speed improvement should let people know a bit about this.
Waiting for Database Server to be ready...
Database Server Ready!
Loading Maps...
Loaded Maps in 1780ms
Loading Mobs...
Loaded Mobs in 245ms
Spawning Mobs...
Spawned 59087 Mobs!
Spawned Mobs in 864ms
Loading Npcs...
Loaded: 565 Npcs
Loaded Npcs in 86ms
Loading Items (11k files)...
Loaded Items in 1505ms
Loading LevelExp File ...
Loaded LevelExp in 0ms
Loading StatPoint files...
Loaded Statopints in 4ms
Loading All Shops...
Loaded 25 shops!
Loaded Shops in 6ms
Configuring Scriptengines...
Configured Engines in 6ms
Starting all Threads...
Started Threads in 7ms
Loading Portals...
Loading portal information...
Loaded Portals in 2ms
Starting Socketsystem...
Server Online!

INI's :)

I see that you already outperform me in some cases. I will now optimize my code to destroy you :D

My main problem is that every mob, every spawn, every item is one seperate ini. thats how I dumped the TQ Db...
04/23/2014 23:14 InsomniacPro#18
Quote:
Originally Posted by Y u k i View Post
My main problem is that every mob, every spawn, every item is one seperate ini. thats how I dumped the TQ Db...
That's what made mobs/spawns load so slow. I completely obliterated the old loading time.

Btw, once I convert my itemtype loading to sql, you'll cry.
04/23/2014 23:16 Y u k i#19
How fast do you process packets at this point? Still 30ms per packet? XD
04/23/2014 23:19 InsomniacPro#20
Quote:
Originally Posted by Y u k i View Post
How fast do you process packets at this point? Still 30ms per packet? XD
iirc, it was never scaled correctly(at about 1-2ms) compared to yours considering you had a lot of other shit going on that my server didnt have done yet.
04/23/2014 23:21 Y u k i#21
Quote:
Originally Posted by InsomniacPro View Post
iirc, it was never scaled correctly(at about 1-2ms) compared to yours considering you had a lot of other shit going on that my server didnt have done yet.
You really need to look into Task Async. You can do some nasty asynchronus shit without having to spin up new threads!

1005 took 0 ms
1022 took 0 ms
1005 took 0 ms
1005 took 0 ms
1022 took 0 ms
1005 took 0 ms
1005 took 0 ms
1005 took 0 ms
1005 took 0 ms
1022 took 0 ms
1009 took 0 ms
1010 took 0 ms
1009 took 0 ms
1009 took 0 ms
1009 took 0 ms

^ Surrounded by a crapload of mobs.

I need something more sensitive than the Stopwatch class...
04/23/2014 23:29 InsomniacPro#22
Quote:
Originally Posted by Y u k i View Post
You really need to look into Task Async. You can do some nasty asynchronus shit without having to spin up new threads!

1005 took 0 ms
1022 took 0 ms
1005 took 0 ms
1005 took 0 ms
1022 took 0 ms
1005 took 0 ms
1005 took 0 ms
1005 took 0 ms
1005 took 0 ms
1022 took 0 ms
1009 took 0 ms
1010 took 0 ms
1009 took 0 ms
1009 took 0 ms
1009 took 0 ms

^ Surrounded by a crapload of mobs.

I need something more sensitive than the Stopwatch class...
Console.WriteLine(packet->type + " took 0 ms");
;O
04/23/2014 23:40 © Haydz#23
Quote:
Originally Posted by Y u k i View Post
You really need to look into Task Async. You can do some nasty asynchronus shit without having to spin up new threads!

1005 took 0 ms
1022 took 0 ms
1005 took 0 ms
1005 took 0 ms
1022 took 0 ms
1005 took 0 ms
1005 took 0 ms
1005 took 0 ms
1005 took 0 ms
1022 took 0 ms
1009 took 0 ms
1010 took 0 ms
1009 took 0 ms
1009 took 0 ms
1009 took 0 ms

^ Surrounded by a crapload of mobs.

I need something more sensitive than the Stopwatch class...
I'm going to completely ignore the ridiculous nonsense about using Initialization files as a database, it's like there's some sort of conspiracy involving SQL/Relational Databases that only this section of elitepvpers is in on.

Anyway since .NET 2.0 Stopwatch is [Only registered and activated users can see links. Click Here To Register...], it doesn't get anymore sensitive.

Try using Elapsed.TotalMilliseconds as it returns whole and fractional milliseconds.
04/23/2014 23:47 SteveRambo#24
Quote:
Originally Posted by InsomniacPro View Post
Console.WriteLine(packet->type + " took 0 ms");
;O
More like:
Code:
Stopwatch stopwatch = new Stopwatch();
stopwatch.Start();

Task t = new Task(() =>
{
            // Handle packet here
            // ...
            // ...
            // ...
});

t.Start();

stopwatch.Stop();

Console.WriteLine("{0} took {1} ms", msg.MsgType, stopwatch.ElapsedMilliseconds);
Because he's bad.

Edit:
I give him too much credit, of course he doesn't know about lamdbas, but you get what I mean.
04/24/2014 00:08 Y u k i#25
Quote:
Originally Posted by SteveRambo View Post
More like:
Code:
Stopwatch stopwatch = new Stopwatch();
stopwatch.Start();

Task t = new Task(() =>
{
            // Handle packet here
            // ...
            // ...
            // ...
});

t.Start();

stopwatch.Stop();

Console.WriteLine("{0} took {1} ms", msg.MsgType, stopwatch.ElapsedMilliseconds);
Because he's bad.

Edit:
I give him too much credit, of course he doesn't know about lamdbas, but you get what I mean.
I don't know what made you attack me on a personal level but oh well: I do know about Lambdas <- BD not DB mr. I know it all. And yes, essentially thats how I handle most of my packets.
04/24/2014 05:02 Spirited#26
I'm a bit disappointed that people are still using flat-file databases as well. Looking at times is insignificant unless it's under high load. From experience, I know how slow a hard drive can get under stress. If you're interested in seeing numbers... I don't have any on flat-files, but I did do some performance testing on my MySQL connection pool system (absolutely nothing fancy, just using the C API). It takes 200-600 microseconds (0.2 -0.6 milliseconds) to initialize the connection (insignificant since that's done on server startup), and then 80-120 microseconds (0.08 - 0.12 milliseconds) to use a connection under heavy stress. MySQL in C# is probably a bit more costly, but it scales very well. Give it a go.
04/24/2014 08:15 Super Aids#27
Why are we not drawing all the datas we need to store in our database into a bitmap and using OCR to load it again? Pretty neat if you ask me.

Not only would it be handy as fk to just transfer database.png
but you could edit your database in paint.
04/24/2014 11:07 SteveRambo#28
Quote:
Originally Posted by Y u k i View Post
I don't know what made you attack me on a personal level but oh well: I do know about Lambdas <- BD not DB mr. I know it all. And yes, essentially thats how I handle most of my packets.
You did understand why the code I posted was a joke, right?
04/24/2014 12:08 KraHen#29
Consider SQLite if you don`t need a remote DB server as well. I used it with my C++/boost source, and it works quite well. ;) You get the speed of a flat-file or even binary database, and all the nice SQL tools.
04/24/2014 15:43 CptSky#30
Quote:
Originally Posted by KraHen View Post
Consider SQLite if you don`t need a remote DB server as well. I used it with my C++/boost source, and it works quite well. ;) You get the speed of a flat-file or even binary database, and all the nice SQL tools.
MySQL Embedded Server will probably scale a lot better than SQLite.