Hi everyone
Since last year, I have been making C# programs some related to A.I. technology so I needed to build a fast database to get all the data quickly.
To start clearing things up, I am not making a Cache System but rather an Internal Database System.
The main purposes of this database system are to remove the processing codes that are used when doing SQL requests along with the enormous amount of large strings that are parsed in the SQL connector, in other words this database system is meant to remove L2J's dependancy on SQL servers.
This database system uses native double-dimensional arrays and is based on IDs (ints) to get to the data.
I added a tag system to seek the location ID of tables and columns in the database using a binarySearch but this will only be used at the start to get the location ID of the data in the database. After getting the location IDs, classes will be able to change the data withough any need of processing.
The database system is currently able to import the SQL database into the internal database, several parsers were made to detect which type of variable is supposebly used in L2J (most of the data in the SQL database is of type decimal and sometimes the data type is not the same as in L2J so I had to check in L2J to see in which cases ints, longs, doubles and Strings were used). The parsers also process null values as (Null), it takes about 5 seconds to successfully finish the import.
Finally, I created a binary file importer and exporter to store or retrieve the database from the hard drive. It takes around 7 seconds to export database to the HD and 4 seconds to import database from the HD.
The exported DB is 4.75 MB and can be compressed to 471 KB compared to the l2jdb.sql file which takes 6.57 MB and can be compressed to 851 KB.
When the server shuts down, the database will export the database to the Hard Drive.
While running, the database will be making rotating exports (DB1 -> DB2 -> DB3 -> DB1 -> etc.) of the actively modified database parts using both database modification count and time checks at the specified count number which will progressively change based on the server stress level (the delay between when the count was set to 0 and when the count number is reached).
This basically means that if nothing happens on the server, no checks or exports will be done since no timer is used and that if a party starts attacking a group of monsters then these players' character will be more frequently saved.
Also, since the server will only export small tables (like characters) which could hold something like 200 values compared to the 953,051 values in the database, it will take a very small portion of the 7 seconds needed to export the full database which will be about 0.1469 second to export. Happy
The database system is still missing an SQL exporter to transfer the internal database data to the connected SQL server and the 168 SQL access points will need to be binded to the internal database system.
The reason I added an SQL importer and later an SQL exporter is to be able to easiler edit the database through navicat.